Made dependency of opencv_objdetect from opencv_highgui optional.

This commit is contained in:
Andrey Kamaev 2012-03-27 20:17:31 +00:00
parent e1378aad79
commit 67838a7a66
4 changed files with 87 additions and 73 deletions

View File

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

View File

@ -388,7 +388,9 @@ int showRootFilterBoxes(IplImage *image,
cvRectangle(image, points[i], oppositePoint, cvRectangle(image, points[i], oppositePoint,
color, thickness, line_type, shift); color, thickness, line_type, shift);
} }
#ifdef HAVE_OPENCV_HIGHGUI
cvShowImage("Initial image", image); cvShowImage("Initial image", image);
#endif
return LATENT_SVM_OK; return LATENT_SVM_OK;
} }
@ -442,7 +444,9 @@ int showPartFilterBoxes(IplImage *image,
color, thickness, line_type, shift); color, thickness, line_type, shift);
} }
} }
#ifdef HAVE_OPENCV_HIGHGUI
cvShowImage("Initial image", image); cvShowImage("Initial image", image);
#endif
return LATENT_SVM_OK; return LATENT_SVM_OK;
} }
@ -476,7 +480,9 @@ int showBoxes(IplImage *img,
cvRectangle(img, points[i], oppositePoints[i], cvRectangle(img, points[i], oppositePoints[i],
color, thickness, line_type, shift); color, thickness, line_type, shift);
} }
#ifdef HAVE_OPENCV_HIGHGUI
cvShowImage("Initial image", img); cvShowImage("Initial image", img);
#endif
return LATENT_SVM_OK; return LATENT_SVM_OK;
} }

View File

@ -97,7 +97,9 @@ CvSeq* cvLatentSvmDetectObjects(IplImage* image,
CvSeq* result_seq = 0; CvSeq* result_seq = 0;
int error = 0; int error = 0;
cvConvertImage(image, image, CV_CVTIMG_SWAP_RB); if(image->nChannels == 3)
cvCvtColor(image, image, CV_BGR2RGB);
// Getting maximum filter dimensions // Getting maximum filter dimensions
getMaxFilterDims((const CvLSVMFilterObject**)(detector->filters), detector->num_components, getMaxFilterDims((const CvLSVMFilterObject**)(detector->filters), detector->num_components,
detector->num_part_filters, &maxXBorder, &maxYBorder); detector->num_part_filters, &maxXBorder, &maxYBorder);
@ -132,7 +134,9 @@ CvSeq* cvLatentSvmDetectObjects(IplImage* image,
detection.rect = bounding_box; detection.rect = bounding_box;
cvSeqPush(result_seq, &detection); cvSeqPush(result_seq, &detection);
} }
cvConvertImage(image, image, CV_CVTIMG_SWAP_RB);
if(image->nChannels == 3)
cvCvtColor(image, image, CV_RGB2BGR);
freeFeaturePyramidObject(&H); freeFeaturePyramidObject(&H);
free(points); free(points);

View File

@ -55,11 +55,15 @@
#include "opencv2/imgproc/imgproc.hpp" #include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/imgproc/imgproc_c.h" #include "opencv2/imgproc/imgproc_c.h"
#include "opencv2/core/core_c.h" #include "opencv2/core/core_c.h"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/core/internal.hpp" #include "opencv2/core/internal.hpp"
#include "opencv2/features2d/features2d.hpp" #include "opencv2/features2d/features2d.hpp"
#include "opencv2/calib3d/calib3d.hpp" #include "opencv2/calib3d/calib3d.hpp"
#include "opencv2/opencv_modules.hpp"
#ifdef HAVE_OPENCV_HIGHGUI
# include "opencv2/highgui/highgui.hpp"
#endif
#ifdef HAVE_TEGRA_OPTIMIZATION #ifdef HAVE_TEGRA_OPTIMIZATION
#include "opencv2/objdetect/objdetect_tegra.hpp" #include "opencv2/objdetect/objdetect_tegra.hpp"
#endif #endif