From: Vadim Pisarevsky Date: Wed, 4 Dec 2013 17:56:35 +0000 (+0400) Subject: trying to eliminate compile problems X-Git-Tag: accepted/tizen/6.0/unified/20201030.111113~3655^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fe11ca886a62f5e44a5a93cb54e7c15b074239d7;p=platform%2Fupstream%2Fopencv.git trying to eliminate compile problems --- diff --git a/modules/objdetect/doc/cascade_classification.rst b/modules/objdetect/doc/cascade_classification.rst index ecd27c7..c351dc7 100644 --- a/modules/objdetect/doc/cascade_classification.rst +++ b/modules/objdetect/doc/cascade_classification.rst @@ -221,44 +221,6 @@ The function is parallelized with the TBB library. * (Python) A face detection example using cascade classifiers can be found at opencv_source_code/samples/python2/facedetect.py -CascadeClassifier::setImage -------------------------------- -Sets an image for detection. - -.. ocv:function:: bool CascadeClassifier::setImage( Ptr& feval, const Mat& image ) - -.. ocv:cfunction:: void cvSetImagesForHaarClassifierCascade( CvHaarClassifierCascade* cascade, const CvArr* sum, const CvArr* sqsum, const CvArr* tilted_sum, double scale ) - - :param cascade: Haar classifier cascade (OpenCV 1.x API only). See :ocv:func:`CascadeClassifier::detectMultiScale` for more information. - - :param feval: Pointer to the feature evaluator used for computing features. - - :param image: Matrix of the type ``CV_8UC1`` containing an image where the features are computed. - -The function is automatically called by :ocv:func:`CascadeClassifier::detectMultiScale` at every image scale. But if you want to test various locations manually using :ocv:func:`CascadeClassifier::runAt`, you need to call the function before, so that the integral images are computed. - -.. note:: in the old API you need to supply integral images (that can be obtained using :ocv:cfunc:`Integral`) instead of the original image. - - -CascadeClassifier::runAt ----------------------------- -Runs the detector at the specified point. - -.. ocv:function:: int CascadeClassifier::runAt( Ptr& feval, Point pt, double& weight ) - -.. ocv:cfunction:: int cvRunHaarClassifierCascade( const CvHaarClassifierCascade* cascade, CvPoint pt, int start_stage=0 ) - - :param cascade: Haar classifier cascade (OpenCV 1.x API only). See :ocv:func:`CascadeClassifier::detectMultiScale` for more information. - - :param feval: Feature evaluator used for computing features. - - :param pt: Upper left point of the window where the features are computed. Size of the window is equal to the size of training images. - -The function returns 1 if the cascade classifier detects an object in the given location. -Otherwise, it returns negated index of the stage at which the candidate has been rejected. - -Use :ocv:func:`CascadeClassifier::setImage` to set the image for the detector to work with. - groupRectangles ------------------- Groups the object candidate rectangles. diff --git a/modules/objdetect/include/opencv2/objdetect.hpp b/modules/objdetect/include/opencv2/objdetect.hpp index 26419bc..c587b26 100644 --- a/modules/objdetect/include/opencv2/objdetect.hpp +++ b/modules/objdetect/include/opencv2/objdetect.hpp @@ -193,30 +193,31 @@ public: virtual Ptr getMaskGenerator() = 0; }; -class CV_EXPORTS_W CascadeClassifier : public BaseCascadeClassifier +class CV_EXPORTS_W CascadeClassifier { public: CV_WRAP CascadeClassifier(); CV_WRAP explicit CascadeClassifier(const String& filename); - virtual ~CascadeClassifier(); - CV_WRAP virtual bool empty() const; - CV_WRAP virtual bool load( const String& filename ); - CV_WRAP virtual void detectMultiScale( InputArray image, - CV_OUT std::vector& objects, - double scaleFactor = 1.1, - int minNeighbors = 3, int flags = 0, - Size minSize = Size(), - Size maxSize = Size() ); - - CV_WRAP virtual void detectMultiScale( InputArray image, - CV_OUT std::vector& objects, - CV_OUT std::vector& numDetections, - double scaleFactor=1.1, - int minNeighbors=3, int flags=0, - Size minSize=Size(), - Size maxSize=Size() ); - - CV_WRAP virtual void detectMultiScale( InputArray image, + ~CascadeClassifier(); + CV_WRAP bool empty() const; + CV_WRAP bool load( const String& filename ); + CV_WRAP bool read( const FileNode& node ); + CV_WRAP void detectMultiScale( InputArray image, + CV_OUT std::vector& objects, + double scaleFactor = 1.1, + int minNeighbors = 3, int flags = 0, + Size minSize = Size(), + Size maxSize = Size() ); + + CV_WRAP void detectMultiScale( InputArray image, + CV_OUT std::vector& objects, + CV_OUT std::vector& numDetections, + double scaleFactor=1.1, + int minNeighbors=3, int flags=0, + Size minSize=Size(), + Size maxSize=Size() ); + + CV_WRAP void detectMultiScale( InputArray image, CV_OUT std::vector& objects, CV_OUT std::vector& rejectLevels, CV_OUT std::vector& levelWeights, @@ -226,18 +227,18 @@ public: Size maxSize = Size(), bool outputRejectLevels = false ); - CV_WRAP virtual bool isOldFormatCascade() const; - CV_WRAP virtual Size getOriginalWindowSize() const; - CV_WRAP virtual int getFeatureType() const; - virtual void* getOldCascade(); + CV_WRAP bool isOldFormatCascade() const; + CV_WRAP Size getOriginalWindowSize() const; + CV_WRAP int getFeatureType() const; + void* getOldCascade(); - virtual void setMaskGenerator(const Ptr& maskGenerator); - virtual Ptr getMaskGenerator(); + void setMaskGenerator(const Ptr& maskGenerator); + Ptr getMaskGenerator(); protected: Ptr cc; }; -CV_EXPORTS Ptr createFaceDetectionMaskGenerator(); +CV_EXPORTS Ptr createFaceDetectionMaskGenerator(); //////////////// HOG (Histogram-of-Oriented-Gradients) Descriptor and Object Detector ////////////// diff --git a/modules/objdetect/src/cascadedetect.cpp b/modules/objdetect/src/cascadedetect.cpp index 10c1b17..2922375 100644 --- a/modules/objdetect/src/cascadedetect.cpp +++ b/modules/objdetect/src/cascadedetect.cpp @@ -918,12 +918,12 @@ Ptr CascadeClassifierImpl::getMaskGenerato return maskGenerator; } -Ptr createFaceDetectionMaskGenerator() +Ptr createFaceDetectionMaskGenerator() { #ifdef HAVE_TEGRA_OPTIMIZATION return tegra::getCascadeClassifierMaskGenerator(*this); #else - return Ptr(); + return Ptr(); #endif } @@ -1390,6 +1390,17 @@ bool CascadeClassifier::load( const String& filename ) return !empty(); } +bool CascadeClassifier::read(const FileNode &root) +{ + Ptr ccimpl; + bool ok = ccimpl->read_(root); + if( ok ) + cc = ccimpl.staticCast(); + else + cc.release(); + return ok; +} + void CascadeClassifier::detectMultiScale( InputArray image, CV_OUT std::vector& objects, double scaleFactor, @@ -1452,7 +1463,7 @@ void* CascadeClassifier::getOldCascade() return cc->getOldCascade(); } -void CascadeClassifier::setMaskGenerator(const Ptr& maskGenerator) +void CascadeClassifier::setMaskGenerator(const Ptr& maskGenerator) { CV_Assert(!empty()); cc->setMaskGenerator(maskGenerator); diff --git a/modules/objdetect/src/cascadedetect.hpp b/modules/objdetect/src/cascadedetect.hpp index 862a273..2505ea0 100644 --- a/modules/objdetect/src/cascadedetect.hpp +++ b/modules/objdetect/src/cascadedetect.hpp @@ -86,7 +86,7 @@ protected: class Data { public: - struct CV_EXPORTS DTreeNode + struct DTreeNode { int featureIdx; float threshold; // for ordered features only @@ -94,12 +94,12 @@ protected: int right; }; - struct CV_EXPORTS DTree + struct DTree { int nodeCount; }; - struct CV_EXPORTS Stage + struct Stage { int first; int ntrees;