From: Andrey Kamaev Date: Tue, 13 Mar 2012 12:33:16 +0000 (+0000) Subject: Made dependency of features2d and calib3d from highgui optional X-Git-Tag: accepted/tizen/6.0/unified/20201030.111113~5375 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e4307d05f35537eb41b2e9e82b928e89a10bf6f4;p=platform%2Fupstream%2Fopencv.git Made dependency of features2d and calib3d from highgui optional --- diff --git a/cmake/OpenCVModule.cmake b/cmake/OpenCVModule.cmake index 699808c..0cef119 100644 --- a/cmake/OpenCVModule.cmake +++ b/cmake/OpenCVModule.cmake @@ -277,7 +277,12 @@ macro(ocv_glob_modules) if(__ocvmodules) list(SORT __ocvmodules) foreach(mod ${__ocvmodules}) - if(EXISTS "${__path}/${mod}/CMakeLists.txt") + if(CMAKE_VERSION VERSION_LESS 2.8) + get_filename_component(__realpath "${__path}/${mod}" ABSOLUTE) + else() + get_filename_component(__realpath "${__path}/${mod}" REALPATH) + endif() + if(EXISTS "${__realpath}/CMakeLists.txt" AND NOT __realpath STREQUAL CMAKE_CURRENT_SOURCE_DIR) add_subdirectory("${__path}/${mod}" "${CMAKE_CURRENT_BINARY_DIR}/${mod}/.${mod}") endif() endforeach() diff --git a/modules/calib3d/src/calibinit.cpp b/modules/calib3d/src/calibinit.cpp index 362b62f..cb2f51d 100644 --- a/modules/calib3d/src/calibinit.cpp +++ b/modules/calib3d/src/calibinit.cpp @@ -65,16 +65,22 @@ //#define ENABLE_TRIM_COL_ROW -//#pragma comment(lib, "highgui200d.lib") //#define DEBUG_CHESSBOARD #ifdef DEBUG_CHESSBOARD +# include "opencv2/opencv_modules.hpp" +# ifdef HAVE_OPENCV_HIGHGUI +# include "opencv2/highgui/highgui.hpp" +# else +# undef DEBUG_CHESSBOARD +# endif +#endif +#ifdef DEBUG_CHESSBOARD static int PRINTF( const char* fmt, ... ) { va_list args; va_start(args, fmt); return vprintf(fmt, args); } -#include "..//..//include/opencv/highgui.h" #else static int PRINTF( const char*, ... ) { diff --git a/modules/calib3d/src/checkchessboard.cpp b/modules/calib3d/src/checkchessboard.cpp index 99594a6..61e44a7 100644 --- a/modules/calib3d/src/checkchessboard.cpp +++ b/modules/calib3d/src/checkchessboard.cpp @@ -47,7 +47,12 @@ //#define DEBUG_WINDOWS #if defined(DEBUG_WINDOWS) -#include "highgui.h" +# include "opencv2/opencv_modules.hpp" +# ifdef HAVE_OPENCV_HIGHGUI +# include "opencv2/highgui/highgui.hpp" +# else +# undef DEBUG_WINDOWS +# endif #endif void icvGetQuadrangleHypotheses(CvSeq* contours, std::vector >& quads, int class_id) diff --git a/modules/calib3d/src/circlesgrid.cpp b/modules/calib3d/src/circlesgrid.cpp index 3fc1190..870a657 100644 --- a/modules/calib3d/src/circlesgrid.cpp +++ b/modules/calib3d/src/circlesgrid.cpp @@ -44,7 +44,12 @@ //#define DEBUG_CIRCLES #ifdef DEBUG_CIRCLES -#include "opencv2/highgui/highgui.hpp" +# include "opencv2/opencv_modules.hpp" +# ifdef HAVE_OPENCV_HIGHGUI +# include "opencv2/highgui/highgui.hpp" +# else +# undef DEBUG_CIRCLES +# endif #endif using namespace cv; diff --git a/modules/features2d/CMakeLists.txt b/modules/features2d/CMakeLists.txt index 99a46f9..7d36a58 100644 --- a/modules/features2d/CMakeLists.txt +++ b/modules/features2d/CMakeLists.txt @@ -1,3 +1,3 @@ set(the_description "2D Features Framework") -ocv_define_module(features2d opencv_imgproc opencv_highgui opencv_flann) +ocv_define_module(features2d opencv_imgproc opencv_flann OPTIONAL opencv_highgui) diff --git a/modules/features2d/src/blobdetector.cpp b/modules/features2d/src/blobdetector.cpp index 4fa9207..72329d3 100644 --- a/modules/features2d/src/blobdetector.cpp +++ b/modules/features2d/src/blobdetector.cpp @@ -46,7 +46,12 @@ //#define DEBUG_BLOB_DETECTOR #ifdef DEBUG_BLOB_DETECTOR -#include "opencv2/highgui/highgui.hpp" +# include "opencv2/opencv_modules.hpp" +# ifdef HAVE_OPENCV_HIGHGUI +# include "opencv2/highgui/highgui.hpp" +# else +# undef DEBUG_BLOB_DETECTOR +# endif #endif using namespace cv; diff --git a/modules/features2d/src/oneway.cpp b/modules/features2d/src/oneway.cpp index 3e57dbd..5af607c 100644 --- a/modules/features2d/src/oneway.cpp +++ b/modules/features2d/src/oneway.cpp @@ -8,9 +8,13 @@ */ #include "precomp.hpp" -#include "opencv2/highgui/highgui.hpp" +#include "opencv2/opencv_modules.hpp" #include +#ifdef HAVE_OPENCV_HIGHGUI +# include "opencv2/highgui/highgui.hpp" +#endif + namespace cv{ inline int round(float value) @@ -655,6 +659,7 @@ namespace cv{ void OneWayDescriptor::Save(const char* path) { +#ifdef HAVE_OPENCV_HIGHGUI for(int i = 0; i < m_pose_count; i++) { char buf[1024]; @@ -669,6 +674,9 @@ namespace cv{ cvReleaseImage(&patch); } +#else + CV_Error( CV_StsNotImplemented, "This method required opencv_highgui disabled in current build" ); +#endif } void OneWayDescriptor::Write(CvFileStorage* fs, const char* name) @@ -1772,6 +1780,7 @@ namespace cv{ void loadPCAFeatures(const char* path, const char* images_list, vector& patches, CvSize patch_size) { +#ifdef HAVE_OPENCV_HIGHGUI char images_filename[1024]; sprintf(images_filename, "%s/%s", path, images_list); FILE *pFile = fopen(images_filename, "r"); @@ -1800,6 +1809,9 @@ namespace cv{ cvReleaseImage(&img); } fclose(pFile); +#else + CV_Error( CV_StsNotImplemented, "This method required opencv_highgui disabled in current build" ); +#endif } void generatePCAFeatures(const char* path, const char* img_filename, FileStorage& fs, const char* postfix, diff --git a/modules/objdetect/src/datamatrix.cpp b/modules/objdetect/src/datamatrix.cpp index 3a8381e..34f3a83 100644 --- a/modules/objdetect/src/datamatrix.cpp +++ b/modules/objdetect/src/datamatrix.cpp @@ -493,7 +493,6 @@ endo: ; // end search for this o } #include -#include namespace cv {