Making all dependencies from highgui module optional

pull/2/head
Andrey Kamaev 13 years ago
parent 700b685575
commit ecf6b5a87c
  1. 2
      modules/contrib/CMakeLists.txt
  2. 10
      modules/contrib/src/chamfermatching.cpp
  3. 9
      modules/contrib/src/rgbdodometry.cpp
  4. 2
      modules/legacy/CMakeLists.txt
  5. 25
      modules/legacy/src/image.cpp
  6. 16
      modules/legacy/src/oneway.cpp
  7. 2
      modules/objdetect/CMakeLists.txt
  8. 2
      modules/videostab/CMakeLists.txt
  9. 13
      modules/videostab/include/opencv2/videostab/frame_source.hpp
  10. 64
      modules/videostab/src/frame_source.cpp
  11. 1
      modules/videostab/src/precomp.hpp
  12. 2
      samples/cpp/dbt_face_detection.cpp

@ -1 +1 @@
ocv_define_module(contrib opencv_imgproc opencv_calib3d opencv_features2d opencv_highgui opencv_ml opencv_video opencv_objdetect)
ocv_define_module(contrib opencv_imgproc opencv_calib3d opencv_features2d opencv_ml opencv_video opencv_objdetect OPTIONAL opencv_highgui)

@ -44,7 +44,10 @@
//
#include "precomp.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/opencv_modules.hpp"
#ifdef HAVE_OPENCV_HIGHGUI
# include "opencv2/highgui/highgui.hpp"
#endif
#include <iostream>
#include <queue>
@ -907,13 +910,16 @@ void ChamferMatcher::Template::show() const
}
}
circle(templ_color,Point(center.x + pad, center.y + pad),1,CV_RGB(0,255,0));
#ifdef HAVE_OPENCV_HIGHGUI
namedWindow("templ",1);
imshow("templ",templ_color);
cvWaitKey(0);
#else
CV_Error(CV_StsNotImplemented, "OpenCV has been compiled without GUI support");
#endif
templ_color.release();
}

@ -39,10 +39,16 @@
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#define SHOW_DEBUG_IMAGES 0
#include "opencv2/core/core.hpp"
#include "opencv2/calib3d/calib3d.hpp"
#include "opencv2/highgui/highgui.hpp"
#if SHOW_DEBUG_IMAGES
# include "opencv2/highgui/highgui.hpp"
#endif
#include "precomp.hpp"
#include <iostream>
@ -58,7 +64,6 @@
#include <limits>
#define SHOW_DEBUG_IMAGES 0
using namespace cv;
inline static

@ -1 +1 @@
ocv_define_module(legacy opencv_calib3d opencv_highgui opencv_video opencv_ml)
ocv_define_module(legacy opencv_calib3d opencv_video opencv_ml OPTIONAL opencv_highgui)

@ -46,7 +46,10 @@
// */
#include "precomp.hpp"
#include "opencv2/highgui/highgui_c.h"
#include "opencv2/opencv_modules.hpp"
#ifdef HAVE_OPENCV_HIGHGUI
# include "opencv2/highgui/highgui_c.h"
#endif
/////////////////////////////// CvImage implementation //////////////////////////////////
@ -112,8 +115,10 @@ bool CvImage::load( const char* filename, const char* imgname, int color )
img = temp_img;
}*/
}
#ifdef HAVE_OPENCV_HIGHGUI
else
img = cvLoadImage( filename, color );
#endif
attach( img );
return img != 0;
@ -161,8 +166,12 @@ void CvImage::save( const char* filename, const char* imgname, const int* params
return;
if( icvIsXmlOrYaml( filename ) )
cvSave( filename, image, imgname );
#ifdef HAVE_OPENCV_HIGHGUI
else
cvSaveImage( filename, image, params );
#else
(void)params;
#endif
}
@ -175,8 +184,12 @@ void CvImage::write( CvFileStorage* fs, const char* imgname )
void CvImage::show( const char* window_name )
{
#ifdef HAVE_OPENCV_HIGHGUI
if( image )
cvShowImage( window_name, image );
#else
(void)window_name;
#endif
}
@ -238,8 +251,10 @@ bool CvMatrix::load( const char* filename, const char* matname, int color )
m = temp_mat;
}*/
}
#ifdef HAVE_OPENCV_HIGHGUI
else
m = cvLoadImageM( filename, color );
#endif
set( m, false );
return m != 0;
@ -287,8 +302,12 @@ void CvMatrix::save( const char* filename, const char* matname, const int* param
return;
if( icvIsXmlOrYaml( filename ) )
cvSave( filename, matrix, matname );
#ifdef HAVE_OPENCV_HIGHGUI
else
cvSaveImage( filename, matrix, params );
#else
(void)params;
#endif
}
@ -301,8 +320,12 @@ void CvMatrix::write( CvFileStorage* fs, const char* matname )
void CvMatrix::show( const char* window_name )
{
#ifdef HAVE_OPENCV_HIGHGUI
if( matrix )
cvShowImage( window_name, matrix );
#else
(void)window_name;
#endif
}

@ -8,7 +8,10 @@
*/
#include "precomp.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/opencv_modules.hpp"
#ifdef HAVE_OPENCV_HIGHGUI
# include "opencv2/highgui/highgui.hpp"
#endif
#include <stdio.h>
namespace cv{
@ -665,7 +668,11 @@ namespace cv{
cvMinMaxLoc(m_samples[i], 0, &maxval);
cvConvertScale(m_samples[i], patch, 255/maxval);
#ifdef HAVE_OPENCV_HIGHGUI
cvSaveImage(buf, patch);
#else
CV_Error(CV_StsNotImplemented, "OpenCV has been compiled without image I/O support");
#endif
cvReleaseImage(&patch);
}
@ -1794,7 +1801,12 @@ namespace cv{
sprintf(filename, "%s/%s", path, imagename);
//printf("Reading image %s...", filename);
IplImage* img = cvLoadImage(filename, CV_LOAD_IMAGE_GRAYSCALE);
IplImage* img = 0;
#ifdef HAVE_OPENCV_HIGHGUI
img = cvLoadImage(filename, CV_LOAD_IMAGE_GRAYSCALE);
#else
CV_Error(CV_StsNotImplemented, "OpenCV has been compiled without image I/O support");
#endif
//printf("done\n");
extractPatches (img, patches, patch_size);

@ -1,2 +1,2 @@
set(the_description "Object Detection")
ocv_define_module(objdetect OPTIONAL opencv_highgui)
ocv_define_module(objdetect opencv_core opencv_imgproc OPTIONAL opencv_highgui)

@ -1,3 +1,3 @@
set(the_description "Video stabilization")
ocv_define_module(videostab opencv_imgproc opencv_features2d opencv_video opencv_highgui opencv_photo opencv_calib3d OPTIONAL opencv_gpu)
ocv_define_module(videostab opencv_imgproc opencv_features2d opencv_video opencv_photo opencv_calib3d OPTIONAL opencv_gpu opencv_highgui)

@ -46,7 +46,6 @@
#include <vector>
#include <string>
#include "opencv2/core/core.hpp"
#include "opencv2/highgui/highgui.hpp"
namespace cv
{
@ -76,15 +75,17 @@ public:
virtual void reset();
virtual Mat nextFrame();
int width() { return static_cast<int>(reader_.get(CV_CAP_PROP_FRAME_WIDTH)); }
int height() { return static_cast<int>(reader_.get(CV_CAP_PROP_FRAME_HEIGHT)); }
int count() { return static_cast<int>(reader_.get(CV_CAP_PROP_FRAME_COUNT)); }
double fps() { return reader_.get(CV_CAP_PROP_FPS); }
int width();
int height();
int count();
double fps();
private:
std::string path_;
bool volatileFrame_;
VideoCapture reader_;
struct VideoReader;
const VideoReader& reader_;
};
} // namespace videostab

@ -44,6 +44,11 @@
#include "opencv2/videostab/frame_source.hpp"
#include "opencv2/videostab/ring_buffer.hpp"
#include "opencv2/opencv_modules.hpp"
#ifdef HAVE_OPENCV_HIGHGUI
# include "opencv2/highgui/highgui.hpp"
#endif
using namespace std;
namespace cv
@ -51,25 +56,74 @@ namespace cv
namespace videostab
{
struct VideoFileSource::VideoReader
{
#ifdef HAVE_OPENCV_HIGHGUI
mutable VideoCapture vc;
#endif
};
VideoFileSource::VideoFileSource(const string &path, bool volatileFrame)
: path_(path), volatileFrame_(volatileFrame) { reset(); }
: path_(path), volatileFrame_(volatileFrame), reader_(VideoReader()) { reset(); }
void VideoFileSource::reset()
{
reader_.release();
reader_.open(path_);
if (!reader_.isOpened())
#ifdef HAVE_OPENCV_HIGHGUI
reader_.vc.release();
reader_.vc.open(path_);
if (!reader_.vc.isOpened())
throw runtime_error("can't open file: " + path_);
#else
CV_Error(CV_StsNotImplemented, "OpenCV has been compiled without video I/O support");
#endif
}
Mat VideoFileSource::nextFrame()
{
Mat frame;
reader_ >> frame;
#ifdef HAVE_OPENCV_HIGHGUI
reader_.vc >> frame;
#endif
return volatileFrame_ ? frame : frame.clone();
}
int VideoFileSource::width()
{
#ifdef HAVE_OPENCV_HIGHGUI
return static_cast<int>(reader_.vc.get(CV_CAP_PROP_FRAME_WIDTH));
#else
return 0;
#endif
}
int VideoFileSource::height()
{
#ifdef HAVE_OPENCV_HIGHGUI
return static_cast<int>(reader_.vc.get(CV_CAP_PROP_FRAME_HEIGHT));
#else
return 0;
#endif
}
int VideoFileSource::count()
{
#ifdef HAVE_OPENCV_HIGHGUI
return static_cast<int>(reader_.vc.get(CV_CAP_PROP_FRAME_COUNT));
#else
return 0;
#endif
}
double VideoFileSource::fps()
{
#ifdef HAVE_OPENCV_HIGHGUI
return reader_.vc.get(CV_CAP_PROP_FPS);
#else
return 0;
#endif
}
} // namespace videostab
} // namespace cv

@ -51,7 +51,6 @@
#include <iostream>
#include <ctime>
#include "opencv2/core/core.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/video/video.hpp"
#include "opencv2/features2d/features2d.hpp"

@ -38,7 +38,7 @@ class CascadeDetectorAdapter: public DetectionBasedTracker::IDetector
cv::Ptr<cv::CascadeClassifier> Detector;
};
int main(int argc, char* argv[])
int main(int , char** )
{
namedWindow(WindowName);

Loading…
Cancel
Save