From 15d85f441d93a18cdb4a50a811ef98e09f04008b Mon Sep 17 00:00:00 2001 From: vp153 Date: Fri, 26 Mar 2010 13:10:13 +0000 Subject: [PATCH] renamed tbb's proxy split struct to Split; cleaned up find_obj_ferns.cpp; restored QuickTime support (ticket #211) git-svn-id: https://code.ros.org/svn/opencv/trunk@2924 73c94f0f-984f-4a5f-82bc-2d8db8d8ee08 --- opencv/CMakeLists.txt | 10 ++++++++++ opencv/include/opencv/cvinternal.h | 4 ++-- opencv/samples/c/find_obj_ferns.cpp | 17 +++++++++++------ opencv/src/highgui/CMakeLists.txt | 17 +++++++++++++---- 4 files changed, 36 insertions(+), 12 deletions(-) diff --git a/opencv/CMakeLists.txt b/opencv/CMakeLists.txt index e9fc0ca6..e21a6a1d 100644 --- a/opencv/CMakeLists.txt +++ b/opencv/CMakeLists.txt @@ -276,6 +276,7 @@ endif() if(APPLE) set(WITH_CARBON OFF CACHE BOOL "Use Carbon for UI instead of Cocoa") + set(WITH_QUICKTIME OFF CACHE BOOL "Use QuickTime for Video I/O insted of QTKit") endif() set(WITH_TBB OFF CACHE BOOL "Include TBB support") @@ -1099,6 +1100,15 @@ endif() message(STATUS " Xine: ${HAVE_XINE}") endif() +if(APPLE) +message(STATUS "") +if(WITH_QUICKTIME) +message(STATUS " Video I/O: QuickTime") +else() +message(STATUS " Video I/O: QTKit") +endif() +endif() + message(STATUS "") message(STATUS " Interfaces: ") if(PYTHONLIBS_FOUND AND BUILD_SWIG_PYTHON_SUPPORT) diff --git a/opencv/include/opencv/cvinternal.h b/opencv/include/opencv/cvinternal.h index 342df260..a50937d4 100644 --- a/opencv/include/opencv/cvinternal.h +++ b/opencv/include/opencv/cvinternal.h @@ -155,7 +155,7 @@ CV_INLINE IppiSize ippiSize(int width, int height) tbb::parallel_do(first, last, body); } - typedef tbb::split split; + typedef tbb::split Split; template static inline void parallel_reduce( const BlockedRange& range, const Body& body ) @@ -194,7 +194,7 @@ CV_INLINE IppiSize ippiSize(int width, int height) body(*first); } - class split {}; + class Split {}; template static inline void parallel_reduce( const BlockedRange& range, const Body& body ) diff --git a/opencv/samples/c/find_obj_ferns.cpp b/opencv/samples/c/find_obj_ferns.cpp index d29aa449..a222dcf5 100644 --- a/opencv/samples/c/find_obj_ferns.cpp +++ b/opencv/samples/c/find_obj_ferns.cpp @@ -51,23 +51,29 @@ int main(int argc, char** argv) vector objKeypoints, imgKeypoints; PatchGenerator gen(0,256,5,true,0.8,1.2,-CV_PI/2,CV_PI/2,-CV_PI/2,CV_PI/2); - FileStorage fs("outlet_model.xml", FileStorage::READ); + string model_filename = format("%s_model.xml.gz", object_filename); + printf("Trying to load %s ...\n", model_filename.c_str()); + FileStorage fs(model_filename, FileStorage::READ); if( fs.isOpened() ) { detector.read(fs.getFirstTopLevelNode()); - FileStorage fs2("outlet_model_copy.xml", FileStorage::WRITE); - detector.write(fs2, "outlet-detector"); + printf("Successfully loaded %s.\n", model_filename.c_str()); } else { + printf("The file not found and can not be read. Let's train the model.\n"); + printf("Step 1. Finding the robust keypoints ...\n"); ldetector.setVerbose(true); ldetector.getMostStable2D(object, objKeypoints, 100, gen); + printf("Done.\nStep 2. Training ferns-based planar object detector ...\n"); detector.setVerbose(true); detector.train(objpyr, objKeypoints, patchSize.width, 100, 11, 10000, ldetector, gen); - if( fs.open("outlet_model.xml", FileStorage::WRITE) ) - detector.write(fs, "outlet-detector"); + printf("Done.\nStep 3. Saving the model to %s ...\n", model_filename.c_str()); + if( fs.open(model_filename, FileStorage::WRITE) ) + detector.write(fs, "ferns_model"); } + printf("Now find the keypoints in the image, try recognize them and compute the homography matrix\n"); fs.release(); vector dst_corners; @@ -77,7 +83,6 @@ int main(int argc, char** argv) cvtColor(object, part, CV_GRAY2BGR); part = Mat(correspond, Rect(0, object.rows, image.cols, image.rows)); cvtColor(image, part, CV_GRAY2BGR); - vector pairs; Mat H; diff --git a/opencv/src/highgui/CMakeLists.txt b/opencv/src/highgui/CMakeLists.txt index f4b64c02..19b93e40 100644 --- a/opencv/src/highgui/CMakeLists.txt +++ b/opencv/src/highgui/CMakeLists.txt @@ -118,7 +118,9 @@ if(UNIX) if(HAVE_LIBV4L) set(highgui_srcs ${highgui_srcs} cvcap_libv4l.cpp) else() - set(highgui_srcs ${highgui_srcs} cvcap_v4l.cpp) + if(HAVE_CAMV4L OR HAVE_CAMV4L2) + set(highgui_srcs ${highgui_srcs} cvcap_v4l.cpp) + endif() endif() if(JPEG_FOUND) @@ -149,7 +151,6 @@ if(APPLE) if(NOT OPENCV_BUILD_3RDPARTY_LIBS) add_definitions(-DHAVE_IMAGEIO=1) endif() - set(highgui_srcs ${highgui_srcs} cvcap_qt.mm) if(WITH_CARBON) add_definitions(-DHAVE_CARBON=1) set(highgui_srcs ${highgui_srcs} window_carbon.cpp) @@ -157,6 +158,11 @@ if(APPLE) add_definitions(-DHAVE_COCOA=1) set(highgui_srcs ${highgui_srcs} window_cocoa.mm) endif() + if(WITH_QUICKTIME) + set(highgui_srcs ${highgui_srcs} cvcap_qt.cpp) + else() + set(highgui_srcs ${highgui_srcs} cvcap_qt.mm) + endif() endif(APPLE) source_group("Src" FILES ${highgui_srcs} ${highgui_hdrs}) @@ -265,9 +271,12 @@ if(WIN32) endif() if(APPLE) - target_link_libraries(${the_target} "-framework QTKit -lbz2 -framework Cocoa -framework CoreFoundation -framework QuartzCore") + target_link_libraries(${the_target} "-lbz2 -framework Cocoa -framework QuickTime -framework CoreFoundation -framework QuartzCore") if(WITH_CARBON) - target_link_libraries(${the_target} "-framework Carbon -framework QuickTime") + target_link_libraries(${the_target} "-framework Carbon") + endif() + if(NOT WITH_QUICKTIME) + target_link_libraries(${the_target} "-framework QTKit") endif() endif() -- 2.39.2