Commit 5e048d1f authored by Andrey Kamaev's avatar Andrey Kamaev

Move C API of opencv_objdetect to separate file

Also move cv::linemod to own header
parent e5a33723
...@@ -64,11 +64,10 @@ ...@@ -64,11 +64,10 @@
#include "opencv2/imgproc/imgproc_c.h" #include "opencv2/imgproc/imgproc_c.h"
#include "opencv2/photo/photo_c.h" #include "opencv2/photo/photo_c.h"
#include "opencv2/video/tracking_c.h" #include "opencv2/video/tracking_c.h"
#include "opencv2/objdetect/objdetect_c.h"
#include "opencv2/legacy.hpp" #include "opencv2/legacy.hpp"
#include "opencv2/legacy/compat.hpp" #include "opencv2/legacy/compat.hpp"
#include "opencv2/objdetect.hpp"
#if !defined(CV_IMPL) #if !defined(CV_IMPL)
#define CV_IMPL extern "C" #define CV_IMPL extern "C"
#endif //CV_IMPL #endif //CV_IMPL
......
...@@ -55,5 +55,6 @@ ...@@ -55,5 +55,6 @@
#include "opencv2/highgui.hpp" #include "opencv2/highgui.hpp"
#include "opencv2/features2d.hpp" #include "opencv2/features2d.hpp"
#include "opencv2/calib3d.hpp" #include "opencv2/calib3d.hpp"
#include "opencv2/objdetect.hpp"
#endif #endif
...@@ -50,12 +50,11 @@ ...@@ -50,12 +50,11 @@
#include "opencv2/imgproc/imgproc_c.h" #include "opencv2/imgproc/imgproc_c.h"
#include "opencv2/photo/photo_c.h" #include "opencv2/photo/photo_c.h"
#include "opencv2/video/tracking_c.h" #include "opencv2/video/tracking_c.h"
#include "opencv2/objdetect/objdetect_c.h"
#include "opencv2/legacy.hpp" #include "opencv2/legacy.hpp"
#include "opencv2/legacy/compat.hpp" #include "opencv2/legacy/compat.hpp"
#include "opencv2/legacy/blobtrack.hpp" #include "opencv2/legacy/blobtrack.hpp"
#include "opencv2/objdetect.hpp"
#include "opencv2/contrib.hpp" #include "opencv2/contrib.hpp"
#endif #endif
......
...@@ -48,6 +48,8 @@ ...@@ -48,6 +48,8 @@
#include "opencv2/features2d.hpp" #include "opencv2/features2d.hpp"
#include "opencv2/objdetect.hpp" #include "opencv2/objdetect.hpp"
#include "opencv2/core/core_c.h"
#include <ostream> #include <ostream>
#ifdef __cplusplus #ifdef __cplusplus
......
This diff is collapsed.
This diff is collapsed.
#ifndef _LSVM_ROUTINE_H_ #ifndef _LSVM_ROUTINE_H_
#define _LSVM_ROUTINE_H_ #define _LSVM_ROUTINE_H_
#include "opencv2/objdetect/objdetect_c.h"
#include "_lsvm_types.h" #include "_lsvm_types.h"
#include "_lsvm_error.h" #include "_lsvm_error.h"
......
#ifndef LSVM_PARSER #ifndef LSVM_PARSER
#define LSVM_PARSER #define LSVM_PARSER
#include "opencv2/objdetect/objdetect_c.h"
#include "_lsvm_types.h" #include "_lsvm_types.h"
......
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
#include <cstdio> #include <cstdio>
#include "cascadedetect.hpp" #include "cascadedetect.hpp"
#include "opencv2/objdetect/objdetect_c.h"
#if defined (LOG_CASCADE_STATISTIC) #if defined (LOG_CASCADE_STATISTIC)
struct Logger struct Logger
......
#include "precomp.hpp" #include "precomp.hpp"
#include "opencv2/imgproc/imgproc_c.h" #include "opencv2/imgproc/imgproc_c.h"
#include "opencv2/objdetect/objdetect_c.h"
#include <deque>
#include <algorithm> #include <algorithm>
class Sampler { class Sampler {
......
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
#include "precomp.hpp" #include "precomp.hpp"
#include "opencv2/imgproc/imgproc_c.h" #include "opencv2/imgproc/imgproc_c.h"
#include "opencv2/objdetect/objdetect_c.h"
#include <stdio.h> #include <stdio.h>
#if CV_SSE2 #if CV_SSE2
......
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
//M*/ //M*/
#include "precomp.hpp" #include "precomp.hpp"
#include "opencv2/core/core_c.h"
#include <cstdio> #include <cstdio>
#include <iterator> #include <iterator>
...@@ -2862,7 +2863,7 @@ void HOGDescriptor::readALTModel(String modelfile) ...@@ -2862,7 +2863,7 @@ void HOGDescriptor::readALTModel(String modelfile)
String eerr("file not exist"); String eerr("file not exist");
String efile(__FILE__); String efile(__FILE__);
String efunc(__FUNCTION__); String efunc(__FUNCTION__);
throw Exception(CV_StsError, eerr, efile, efunc, __LINE__); throw Exception(Error::StsError, eerr, efile, efunc, __LINE__);
} }
char version_buffer[10]; char version_buffer[10];
if (!fread (&version_buffer,sizeof(char),10,modelfl)) if (!fread (&version_buffer,sizeof(char),10,modelfl))
...@@ -2870,13 +2871,13 @@ void HOGDescriptor::readALTModel(String modelfile) ...@@ -2870,13 +2871,13 @@ void HOGDescriptor::readALTModel(String modelfile)
String eerr("version?"); String eerr("version?");
String efile(__FILE__); String efile(__FILE__);
String efunc(__FUNCTION__); String efunc(__FUNCTION__);
throw Exception(CV_StsError, eerr, efile, efunc, __LINE__); throw Exception(Error::StsError, eerr, efile, efunc, __LINE__);
} }
if(strcmp(version_buffer,"V6.01")) { if(strcmp(version_buffer,"V6.01")) {
String eerr("version doesnot match"); String eerr("version doesnot match");
String efile(__FILE__); String efile(__FILE__);
String efunc(__FUNCTION__); String efunc(__FUNCTION__);
throw Exception(CV_StsError, eerr, efile, efunc, __LINE__); throw Exception(Error::StsError, eerr, efile, efunc, __LINE__);
} }
/* read version number */ /* read version number */
int version = 0; int version = 0;
......
#include "precomp.hpp" #include "precomp.hpp"
#include "opencv2/imgproc/imgproc_c.h" #include "opencv2/imgproc/imgproc_c.h"
#include "opencv2/objdetect/objdetect_c.h"
#include "_lsvmparser.h" #include "_lsvmparser.h"
#include "_lsvm_matching.h" #include "_lsvm_matching.h"
......
...@@ -66,7 +66,7 @@ static inline int getLabel(int quantized) ...@@ -66,7 +66,7 @@ static inline int getLabel(int quantized)
case 64: return 6; case 64: return 6;
case 128: return 7; case 128: return 7;
default: default:
CV_Error(CV_StsBadArg, "Invalid value of quantized parameter"); CV_Error(Error::StsBadArg, "Invalid value of quantized parameter");
return -1; //avoid warning return -1; //avoid warning
} }
} }
...@@ -1398,17 +1398,17 @@ void Detector::match(const std::vector<Mat>& sources, float threshold, std::vect ...@@ -1398,17 +1398,17 @@ void Detector::match(const std::vector<Mat>& sources, float threshold, std::vect
if (quantized_images.needed()) if (quantized_images.needed())
quantized_images.create(1, static_cast<int>(pyramid_levels * modalities.size()), CV_8U); quantized_images.create(1, static_cast<int>(pyramid_levels * modalities.size()), CV_8U);
assert(sources.size() == modalities.size()); CV_Assert(sources.size() == modalities.size());
// Initialize each modality with our sources // Initialize each modality with our sources
std::vector< Ptr<QuantizedPyramid> > quantizers; std::vector< Ptr<QuantizedPyramid> > quantizers;
for (int i = 0; i < (int)modalities.size(); ++i){ for (int i = 0; i < (int)modalities.size(); ++i){
Mat mask, source; Mat mask, source;
source = sources[i]; source = sources[i];
if(!masks.empty()){ if(!masks.empty()){
assert(masks.size() == modalities.size()); CV_Assert(masks.size() == modalities.size());
mask = masks[i]; mask = masks[i];
} }
assert(mask.empty() || mask.size() == source.size()); CV_Assert(mask.empty() || mask.size() == source.size());
quantizers.push_back(modalities[i]->process(source, mask)); quantizers.push_back(modalities[i]->process(source, mask));
} }
// pyramid level -> modality -> quantization // pyramid level -> modality -> quantization
......
#include "precomp.hpp" #include "precomp.hpp"
#include "opencv2/objdetect/objdetect_c.h"
#include "_lsvm_matching.h" #include "_lsvm_matching.h"
#include <stdio.h> #include <stdio.h>
......
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
#include "test_precomp.hpp" #include "test_precomp.hpp"
#include "opencv2/imgproc.hpp" #include "opencv2/imgproc.hpp"
#include "opencv2/objdetect/objdetect_c.h"
using namespace cv; using namespace cv;
using namespace std; using namespace std;
...@@ -117,7 +118,7 @@ int CV_DetectorTest::prepareData( FileStorage& _fs ) ...@@ -117,7 +118,7 @@ int CV_DetectorTest::prepareData( FileStorage& _fs )
// fn[TOTAL_NO_PAIR_E] >> eps.totalNoPair; // fn[TOTAL_NO_PAIR_E] >> eps.totalNoPair;
// read detectors // read detectors
if( fn[DETECTOR_NAMES].node->data.seq != 0 ) if( fn[DETECTOR_NAMES].size() != 0 )
{ {
FileNodeIterator it = fn[DETECTOR_NAMES].begin(); FileNodeIterator it = fn[DETECTOR_NAMES].begin();
for( ; it != fn[DETECTOR_NAMES].end(); ) for( ; it != fn[DETECTOR_NAMES].end(); )
...@@ -132,7 +133,7 @@ int CV_DetectorTest::prepareData( FileStorage& _fs ) ...@@ -132,7 +133,7 @@ int CV_DetectorTest::prepareData( FileStorage& _fs )
// read images filenames and images // read images filenames and images
string dataPath = ts->get_data_path(); string dataPath = ts->get_data_path();
if( fn[IMAGE_FILENAMES].node->data.seq != 0 ) if( fn[IMAGE_FILENAMES].size() != 0 )
{ {
for( FileNodeIterator it = fn[IMAGE_FILENAMES].begin(); it != fn[IMAGE_FILENAMES].end(); ) for( FileNodeIterator it = fn[IMAGE_FILENAMES].begin(); it != fn[IMAGE_FILENAMES].end(); )
{ {
...@@ -210,7 +211,7 @@ void CV_DetectorTest::run( int ) ...@@ -210,7 +211,7 @@ void CV_DetectorTest::run( int )
{ {
char buf[10]; char buf[10];
sprintf( buf, "%s%d", "img_", ii ); sprintf( buf, "%s%d", "img_", ii );
cvWriteComment( validationFS.fs, buf, 0 ); //cvWriteComment( validationFS.fs, buf, 0 );
validationFS << *it; validationFS << *it;
} }
validationFS << "]"; // IMAGE_FILENAMES validationFS << "]"; // IMAGE_FILENAMES
...@@ -316,7 +317,7 @@ int CV_DetectorTest::validate( int detectorIdx, vector<vector<Rect> >& objects ) ...@@ -316,7 +317,7 @@ int CV_DetectorTest::validate( int detectorIdx, vector<vector<Rect> >& objects )
string imageIdxStr = buf; string imageIdxStr = buf;
FileNode node = validationFS.getFirstTopLevelNode()[VALIDATION][detectorNames[detectorIdx]][imageIdxStr]; FileNode node = validationFS.getFirstTopLevelNode()[VALIDATION][detectorNames[detectorIdx]][imageIdxStr];
vector<Rect> valRects; vector<Rect> valRects;
if( node.node->data.seq != 0 ) if( node.size() != 0 )
{ {
for( FileNodeIterator it2 = node.begin(); it2 != node.end(); ) for( FileNodeIterator it2 = node.begin(); it2 != node.end(); )
{ {
...@@ -410,12 +411,12 @@ void CV_CascadeDetectorTest::readDetector( const FileNode& fn ) ...@@ -410,12 +411,12 @@ void CV_CascadeDetectorTest::readDetector( const FileNode& fn )
if( flag ) if( flag )
flags.push_back( 0 ); flags.push_back( 0 );
else else
flags.push_back( CV_HAAR_SCALE_IMAGE ); flags.push_back( CASCADE_SCALE_IMAGE );
} }
void CV_CascadeDetectorTest::writeDetector( FileStorage& fs, int di ) void CV_CascadeDetectorTest::writeDetector( FileStorage& fs, int di )
{ {
int sc = flags[di] & CV_HAAR_SCALE_IMAGE ? 0 : 1; int sc = flags[di] & CASCADE_SCALE_IMAGE ? 0 : 1;
fs << FILENAME << detectorFilenames[di]; fs << FILENAME << detectorFilenames[di];
fs << C_SCALE_CASCADE << sc; fs << C_SCALE_CASCADE << sc;
} }
...@@ -439,7 +440,7 @@ int CV_CascadeDetectorTest::detectMultiScale_C( const string& filename, ...@@ -439,7 +440,7 @@ int CV_CascadeDetectorTest::detectMultiScale_C( const string& filename,
CvMat c_gray = grayImg; CvMat c_gray = grayImg;
CvSeq* rs = cvHaarDetectObjects(&c_gray, c_cascade, storage, 1.1, 3, flags[di] ); CvSeq* rs = cvHaarDetectObjects(&c_gray, c_cascade, storage, 1.1, 3, flags[di] );
objects.clear(); objects.clear();
for( int i = 0; i < rs->total; i++ ) for( int i = 0; i < rs->total; i++ )
{ {
...@@ -494,7 +495,7 @@ CV_HOGDetectorTest::CV_HOGDetectorTest() ...@@ -494,7 +495,7 @@ CV_HOGDetectorTest::CV_HOGDetectorTest()
void CV_HOGDetectorTest::readDetector( const FileNode& fn ) void CV_HOGDetectorTest::readDetector( const FileNode& fn )
{ {
String filename; String filename;
if( fn[FILENAME].node->data.seq != 0 ) if( fn[FILENAME].size() != 0 )
fn[FILENAME] >> filename; fn[FILENAME] >> filename;
detectorFilenames.push_back( filename); detectorFilenames.push_back( filename);
} }
...@@ -1085,7 +1086,7 @@ void HOGDescriptorTester::detect(const Mat& img, ...@@ -1085,7 +1086,7 @@ void HOGDescriptorTester::detect(const Mat& img,
} }
const double eps = 0.0; const double eps = 0.0;
double diff_norm = norm(Mat(actual_weights) - Mat(weights), CV_L2); double diff_norm = norm(Mat(actual_weights) - Mat(weights), NORM_L2);
if (diff_norm > eps) if (diff_norm > eps)
{ {
ts->printf(cvtest::TS::SUMMARY, "Weights for found locations aren't equal.\n" ts->printf(cvtest::TS::SUMMARY, "Weights for found locations aren't equal.\n"
...@@ -1164,7 +1165,7 @@ void HOGDescriptorTester::compute(const Mat& img, vector<float>& descriptors, ...@@ -1164,7 +1165,7 @@ void HOGDescriptorTester::compute(const Mat& img, vector<float>& descriptors,
std::vector<float> actual_descriptors; std::vector<float> actual_descriptors;
actual_hog->compute(img, actual_descriptors, winStride, padding, locations); actual_hog->compute(img, actual_descriptors, winStride, padding, locations);
double diff_norm = cv::norm(Mat(actual_descriptors) - Mat(descriptors), CV_L2); double diff_norm = cv::norm(Mat(actual_descriptors) - Mat(descriptors), NORM_L2);
const double eps = 0.0; const double eps = 0.0;
if (diff_norm > eps) if (diff_norm > eps)
{ {
...@@ -1314,7 +1315,7 @@ void HOGDescriptorTester::computeGradient(const Mat& img, Mat& grad, Mat& qangle ...@@ -1314,7 +1315,7 @@ void HOGDescriptorTester::computeGradient(const Mat& img, Mat& grad, Mat& qangle
const double eps = 0.0; const double eps = 0.0;
for (i = 0; i < 2; ++i) for (i = 0; i < 2; ++i)
{ {
double diff_norm = norm(reference_mats[i] - actual_mats[i], CV_L2); double diff_norm = norm(reference_mats[i] - actual_mats[i], NORM_L2);
if (diff_norm > eps) if (diff_norm > eps)
{ {
ts->printf(cvtest::TS::LOG, "%s matrices are not equal\n" ts->printf(cvtest::TS::LOG, "%s matrices are not equal\n"
......
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
//M*/ //M*/
#include "test_precomp.hpp" #include "test_precomp.hpp"
#include "opencv2/objdetect/objdetect_c.h"
#include <string> #include <string>
#ifdef HAVE_TBB #ifdef HAVE_TBB
......
...@@ -18,14 +18,14 @@ ...@@ -18,14 +18,14 @@
#include "opencv2/features2d.hpp" #include "opencv2/features2d.hpp"
#include "opencv2/objdetect.hpp" #include "opencv2/objdetect.hpp"
#include "opencv2/softcascade.hpp" #include "opencv2/softcascade.hpp"
#include "opencv2/video/tracking.hpp" #include "opencv2/video.hpp"
#include "opencv2/video/background_segm.hpp"
#include "opencv2/photo.hpp" #include "opencv2/photo.hpp"
#include "opencv2/highgui.hpp" #include "opencv2/highgui.hpp"
#include "opencv2/highgui/highgui_c.h" #include "opencv2/highgui/highgui_c.h"
#include "opencv2/photo/photo_c.h" #include "opencv2/photo/photo_c.h"
#include "opencv2/video/tracking_c.h" #include "opencv2/video/tracking_c.h"
#include "opencv2/objdetect/objdetect_c.h"
#include "opencv2/opencv_modules.hpp" #include "opencv2/opencv_modules.hpp"
......
...@@ -54,7 +54,7 @@ using namespace cv::superres::detail; ...@@ -54,7 +54,7 @@ using namespace cv::superres::detail;
Ptr<SuperResolution> cv::superres::createSuperResolution_BTVL1_GPU() Ptr<SuperResolution> cv::superres::createSuperResolution_BTVL1_GPU()
{ {
CV_Error(CV_StsNotImplemented, "The called functionality is disabled for current build or platform"); CV_Error(Error::StsNotImplemented, "The called functionality is disabled for current build or platform");
return Ptr<SuperResolution>(); return Ptr<SuperResolution>();
} }
......
#include "opencv2/objdetect/objdetect.hpp" #include "opencv2/objdetect/objdetect_c.h"
#include "opencv2/highgui/highgui_c.h" #include "opencv2/highgui/highgui_c.h"
#include <ctype.h> #include <ctype.h>
......
...@@ -216,9 +216,9 @@ void detectAndDraw( Mat& img, CascadeClassifier& cascade, ...@@ -216,9 +216,9 @@ void detectAndDraw( Mat& img, CascadeClassifier& cascade,
t = (double)cvGetTickCount(); t = (double)cvGetTickCount();
cascade.detectMultiScale( smallImg, faces, cascade.detectMultiScale( smallImg, faces,
1.1, 2, 0 1.1, 2, 0
//|CV_HAAR_FIND_BIGGEST_OBJECT //|CASCADE_FIND_BIGGEST_OBJECT
//|CV_HAAR_DO_ROUGH_SEARCH //|CASCADE_DO_ROUGH_SEARCH
|CV_HAAR_SCALE_IMAGE |CASCADE_SCALE_IMAGE
, ,
Size(30, 30) ); Size(30, 30) );
if( tryflip ) if( tryflip )
...@@ -226,9 +226,9 @@ void detectAndDraw( Mat& img, CascadeClassifier& cascade, ...@@ -226,9 +226,9 @@ void detectAndDraw( Mat& img, CascadeClassifier& cascade,
flip(smallImg, smallImg, 1); flip(smallImg, smallImg, 1);
cascade.detectMultiScale( smallImg, faces2, cascade.detectMultiScale( smallImg, faces2,
1.1, 2, 0 1.1, 2, 0
//|CV_HAAR_FIND_BIGGEST_OBJECT //|CASCADE_FIND_BIGGEST_OBJECT
//|CV_HAAR_DO_ROUGH_SEARCH //|CASCADE_DO_ROUGH_SEARCH
|CV_HAAR_SCALE_IMAGE |CASCADE_SCALE_IMAGE
, ,
Size(30, 30) ); Size(30, 30) );
for( vector<Rect>::const_iterator r = faces2.begin(); r != faces2.end(); r++ ) for( vector<Rect>::const_iterator r = faces2.begin(); r != faces2.end(); r++ )
...@@ -263,10 +263,10 @@ void detectAndDraw( Mat& img, CascadeClassifier& cascade, ...@@ -263,10 +263,10 @@ void detectAndDraw( Mat& img, CascadeClassifier& cascade,
smallImgROI = smallImg(*r); smallImgROI = smallImg(*r);
nestedCascade.detectMultiScale( smallImgROI, nestedObjects, nestedCascade.detectMultiScale( smallImgROI, nestedObjects,
1.1, 2, 0 1.1, 2, 0
//|CV_HAAR_FIND_BIGGEST_OBJECT //|CASCADE_FIND_BIGGEST_OBJECT
//|CV_HAAR_DO_ROUGH_SEARCH //|CASCADE_DO_ROUGH_SEARCH
//|CV_HAAR_DO_CANNY_PRUNING //|CASCADE_DO_CANNY_PRUNING
|CV_HAAR_SCALE_IMAGE |CASCADE_SCALE_IMAGE
, ,
Size(30, 30) ); Size(30, 30) );
for( vector<Rect>::const_iterator nr = nestedObjects.begin(); nr != nestedObjects.end(); nr++ ) for( vector<Rect>::const_iterator nr = nestedObjects.begin(); nr != nestedObjects.end(); nr++ )
......
#include "opencv2/objdetect.hpp" #include "opencv2/objdetect/objdetect_c.h"
#include "opencv2/highgui/highgui_c.h" #include "opencv2/highgui/highgui_c.h"
#include <stdio.h> #include <stdio.h>
......
...@@ -175,9 +175,9 @@ void detectAndDraw( Mat& img, CascadeClassifier& cascade, ...@@ -175,9 +175,9 @@ void detectAndDraw( Mat& img, CascadeClassifier& cascade,
cascade.detectMultiScale( smallImg, faces, cascade.detectMultiScale( smallImg, faces,
1.1, 2, 0 1.1, 2, 0
//|CV_HAAR_FIND_BIGGEST_OBJECT //|CASCADE_FIND_BIGGEST_OBJECT
//|CV_HAAR_DO_ROUGH_SEARCH //|CASCADE_DO_ROUGH_SEARCH
|CV_HAAR_SCALE_IMAGE |CASCADE_SCALE_IMAGE
, ,
Size(30, 30) ); Size(30, 30) );
if( tryflip ) if( tryflip )
...@@ -185,9 +185,9 @@ void detectAndDraw( Mat& img, CascadeClassifier& cascade, ...@@ -185,9 +185,9 @@ void detectAndDraw( Mat& img, CascadeClassifier& cascade,
flip(smallImg, smallImg, 1); flip(smallImg, smallImg, 1);
cascade.detectMultiScale( smallImg, faces2, cascade.detectMultiScale( smallImg, faces2,
1.1, 2, 0 1.1, 2, 0
//|CV_HAAR_FIND_BIGGEST_OBJECT //|CASCADE_FIND_BIGGEST_OBJECT
//|CV_HAAR_DO_ROUGH_SEARCH //|CASCADE_DO_ROUGH_SEARCH
|CV_HAAR_SCALE_IMAGE |CASCADE_SCALE_IMAGE
, ,
Size(30, 30) ); Size(30, 30) );
for( vector<Rect>::const_iterator r = faces2.begin(); r != faces2.end(); r++ ) for( vector<Rect>::const_iterator r = faces2.begin(); r != faces2.end(); r++ )
...@@ -223,10 +223,10 @@ void detectAndDraw( Mat& img, CascadeClassifier& cascade, ...@@ -223,10 +223,10 @@ void detectAndDraw( Mat& img, CascadeClassifier& cascade,
smallImgROI = smallImg(*r); smallImgROI = smallImg(*r);
nestedCascade.detectMultiScale( smallImgROI, nestedObjects, nestedCascade.detectMultiScale( smallImgROI, nestedObjects,
1.1, 0, 0 1.1, 0, 0
//|CV_HAAR_FIND_BIGGEST_OBJECT //|CASCADE_FIND_BIGGEST_OBJECT
//|CV_HAAR_DO_ROUGH_SEARCH //|CASCADE_DO_ROUGH_SEARCH
//|CV_HAAR_DO_CANNY_PRUNING //|CASCADE_DO_CANNY_PRUNING
|CV_HAAR_SCALE_IMAGE |CASCADE_SCALE_IMAGE
, ,
Size(30, 30) ); Size(30, 30) );
......
...@@ -79,7 +79,7 @@ int main(int , char** ) ...@@ -79,7 +79,7 @@ int main(int , char** )
for (size_t i = 0; i < Faces.size(); i++) for (size_t i = 0; i < Faces.size(); i++)
{ {
rectangle(ReferenceFrame, Faces[i], CV_RGB(0,255,0)); rectangle(ReferenceFrame, Faces[i], Scalar(0,255,0));
} }
imshow(WindowName, ReferenceFrame); imshow(WindowName, ReferenceFrame);
......
...@@ -141,7 +141,7 @@ int main(int argc, char** argv) ...@@ -141,7 +141,7 @@ int main(int argc, char** argv)
conf << d.confidence; conf << d.confidence;
cv::rectangle(frame, cv::Rect((int)d.x, (int)d.y, (int)d.w, (int)d.h), cv::Scalar(b, 0, 255 - b, 255), 2); cv::rectangle(frame, cv::Rect((int)d.x, (int)d.y, (int)d.w, (int)d.h), cv::Scalar(b, 0, 255 - b, 255), 2);
cv::putText(frame, conf.str() , cv::Point((int)d.x + 10, (int)d.y - 5),1, 1.1, cv::Scalar(25, 133, 255, 0), 1, CV_AA); cv::putText(frame, conf.str() , cv::Point((int)d.x + 10, (int)d.y - 5),1, 1.1, cv::Scalar(25, 133, 255, 0), 1, cv::LINE_AA);
if (wf) if (wf)
myfile << d.x << "," << d.y << "," << d.w << "," << d.h << "," << d.confidence << "\n"; myfile << d.x << "," << d.y << "," << d.w << "," << d.h << "," << d.confidence << "\n";
......
...@@ -73,7 +73,7 @@ void detectAndDisplay( Mat frame ) ...@@ -73,7 +73,7 @@ void detectAndDisplay( Mat frame )
cvtColor( frame, frame_gray, COLOR_BGR2GRAY ); cvtColor( frame, frame_gray, COLOR_BGR2GRAY );
equalizeHist( frame_gray, frame_gray ); equalizeHist( frame_gray, frame_gray );
//-- Detect faces //-- Detect faces
face_cascade.detectMultiScale( frame_gray, faces, 1.1, 2, 0|CV_HAAR_SCALE_IMAGE, Size(30, 30) ); face_cascade.detectMultiScale( frame_gray, faces, 1.1, 2, 0|CASCADE_SCALE_IMAGE, Size(30, 30) );
for( size_t i = 0; i < faces.size(); i++ ) for( size_t i = 0; i < faces.size(); i++ )
{ {
...@@ -84,7 +84,7 @@ void detectAndDisplay( Mat frame ) ...@@ -84,7 +84,7 @@ void detectAndDisplay( Mat frame )
std::vector<Rect> eyes; std::vector<Rect> eyes;
//-- In each face, detect eyes //-- In each face, detect eyes
eyes_cascade.detectMultiScale( faceROI, eyes, 1.1, 2, 0 |CV_HAAR_SCALE_IMAGE, Size(30, 30) ); eyes_cascade.detectMultiScale( faceROI, eyes, 1.1, 2, 0 |CASCADE_SCALE_IMAGE, Size(30, 30) );
for( size_t j = 0; j < eyes.size(); j++ ) for( size_t j = 0; j < eyes.size(); j++ )
{ {
......
...@@ -82,7 +82,7 @@ void detectAndDisplay( Mat frame ) ...@@ -82,7 +82,7 @@ void detectAndDisplay( Mat frame )
std::vector<Rect> eyes; std::vector<Rect> eyes;
//-- In each face, detect eyes //-- In each face, detect eyes
eyes_cascade.detectMultiScale( faceROI, eyes, 1.1, 2, 0 |CV_HAAR_SCALE_IMAGE, Size(30, 30) ); eyes_cascade.detectMultiScale( faceROI, eyes, 1.1, 2, 0 |CASCADE_SCALE_IMAGE, Size(30, 30) );
if( eyes.size() == 2) if( eyes.size() == 2)
{ {
//-- Draw the face //-- Draw the face
......
...@@ -228,8 +228,8 @@ int main(int argc, const char *argv[]) ...@@ -228,8 +228,8 @@ int main(int argc, const char *argv[])
Size minSize = cascade_gpu.getClassifierSize(); Size minSize = cascade_gpu.getClassifierSize();
cascade_cpu.detectMultiScale(resized_cpu, facesBuf_cpu, 1.2, cascade_cpu.detectMultiScale(resized_cpu, facesBuf_cpu, 1.2,
(filterRects || findLargestObject) ? 4 : 0, (filterRects || findLargestObject) ? 4 : 0,
(findLargestObject ? CV_HAAR_FIND_BIGGEST_OBJECT : 0) (findLargestObject ? CASCADE_FIND_BIGGEST_OBJECT : 0)
| CV_HAAR_SCALE_IMAGE, | CASCADE_SCALE_IMAGE,
minSize); minSize);
detections_num = (int)facesBuf_cpu.size(); detections_num = (int)facesBuf_cpu.size();
} }
......
...@@ -326,7 +326,7 @@ void App::run() ...@@ -326,7 +326,7 @@ void App::run()
for (size_t i = 0; i < found.size(); i++) for (size_t i = 0; i < found.size(); i++)
{ {
Rect r = found[i]; Rect r = found[i];
rectangle(img_to_show, r.tl(), r.br(), CV_RGB(0, 255, 0), 3); rectangle(img_to_show, r.tl(), r.br(), Scalar(0, 255, 0), 3);
} }
if (use_gpu) if (use_gpu)
......
...@@ -51,7 +51,7 @@ int main(int argc, const char* argv[]) ...@@ -51,7 +51,7 @@ int main(int argc, const char* argv[])
for (size_t i = 0; i < lines_cpu.size(); ++i) for (size_t i = 0; i < lines_cpu.size(); ++i)
{ {
Vec4i l = lines_cpu[i]; Vec4i l = lines_cpu[i];
line(dst_cpu, Point(l[0], l[1]), Point(l[2], l[3]), Scalar(0, 0, 255), 3, CV_AA); line(dst_cpu, Point(l[0], l[1]), Point(l[2], l[3]), Scalar(0, 0, 255), 3, LINE_AA);
} }
GpuMat d_src(mask); GpuMat d_src(mask);
...@@ -77,7 +77,7 @@ int main(int argc, const char* argv[]) ...@@ -77,7 +77,7 @@ int main(int argc, const char* argv[])
for (size_t i = 0; i < lines_gpu.size(); ++i) for (size_t i = 0; i < lines_gpu.size(); ++i)
{ {
Vec4i l = lines_gpu[i]; Vec4i l = lines_gpu[i];
line(dst_gpu, Point(l[0], l[1]), Point(l[2], l[3]), Scalar(0, 0, 255), 3, CV_AA); line(dst_gpu, Point(l[0], l[1]), Point(l[2], l[3]), Scalar(0, 0, 255), 3, LINE_AA);
} }
imshow("source", src); imshow("source", src);
......
...@@ -144,7 +144,7 @@ string abspath(const string& relpath) ...@@ -144,7 +144,7 @@ string abspath(const string& relpath)
} }
static int CV_CDECL cvErrorCallback(int /*status*/, const char* /*func_name*/, static int cvErrorCallback(int /*status*/, const char* /*func_name*/,
const char* err_msg, const char* /*file_name*/, const char* err_msg, const char* /*file_name*/,
int /*line*/, void* /*userdata*/) int /*line*/, void* /*userdata*/)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment