trying to eliminate compile problems

This commit is contained in:
Vadim Pisarevsky 2013-12-04 21:56:35 +04:00
parent ff87385201
commit fe11ca886a
4 changed files with 43 additions and 69 deletions

View File

@ -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 * (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<FeatureEvaluator>& 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<FeatureEvaluator>& 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 groupRectangles
------------------- -------------------
Groups the object candidate rectangles. Groups the object candidate rectangles.

View File

@ -193,22 +193,23 @@ public:
virtual Ptr<MaskGenerator> getMaskGenerator() = 0; virtual Ptr<MaskGenerator> getMaskGenerator() = 0;
}; };
class CV_EXPORTS_W CascadeClassifier : public BaseCascadeClassifier class CV_EXPORTS_W CascadeClassifier
{ {
public: public:
CV_WRAP CascadeClassifier(); CV_WRAP CascadeClassifier();
CV_WRAP explicit CascadeClassifier(const String& filename); CV_WRAP explicit CascadeClassifier(const String& filename);
virtual ~CascadeClassifier(); ~CascadeClassifier();
CV_WRAP virtual bool empty() const; CV_WRAP bool empty() const;
CV_WRAP virtual bool load( const String& filename ); CV_WRAP bool load( const String& filename );
CV_WRAP virtual void detectMultiScale( InputArray image, CV_WRAP bool read( const FileNode& node );
CV_WRAP void detectMultiScale( InputArray image,
CV_OUT std::vector<Rect>& objects, CV_OUT std::vector<Rect>& objects,
double scaleFactor = 1.1, double scaleFactor = 1.1,
int minNeighbors = 3, int flags = 0, int minNeighbors = 3, int flags = 0,
Size minSize = Size(), Size minSize = Size(),
Size maxSize = Size() ); Size maxSize = Size() );
CV_WRAP virtual void detectMultiScale( InputArray image, CV_WRAP void detectMultiScale( InputArray image,
CV_OUT std::vector<Rect>& objects, CV_OUT std::vector<Rect>& objects,
CV_OUT std::vector<int>& numDetections, CV_OUT std::vector<int>& numDetections,
double scaleFactor=1.1, double scaleFactor=1.1,
@ -216,7 +217,7 @@ public:
Size minSize=Size(), Size minSize=Size(),
Size maxSize=Size() ); Size maxSize=Size() );
CV_WRAP virtual void detectMultiScale( InputArray image, CV_WRAP void detectMultiScale( InputArray image,
CV_OUT std::vector<Rect>& objects, CV_OUT std::vector<Rect>& objects,
CV_OUT std::vector<int>& rejectLevels, CV_OUT std::vector<int>& rejectLevels,
CV_OUT std::vector<double>& levelWeights, CV_OUT std::vector<double>& levelWeights,
@ -226,18 +227,18 @@ public:
Size maxSize = Size(), Size maxSize = Size(),
bool outputRejectLevels = false ); bool outputRejectLevels = false );
CV_WRAP virtual bool isOldFormatCascade() const; CV_WRAP bool isOldFormatCascade() const;
CV_WRAP virtual Size getOriginalWindowSize() const; CV_WRAP Size getOriginalWindowSize() const;
CV_WRAP virtual int getFeatureType() const; CV_WRAP int getFeatureType() const;
virtual void* getOldCascade(); void* getOldCascade();
virtual void setMaskGenerator(const Ptr<MaskGenerator>& maskGenerator); void setMaskGenerator(const Ptr<BaseCascadeClassifier::MaskGenerator>& maskGenerator);
virtual Ptr<MaskGenerator> getMaskGenerator(); Ptr<BaseCascadeClassifier::MaskGenerator> getMaskGenerator();
protected: protected:
Ptr<BaseCascadeClassifier> cc; Ptr<BaseCascadeClassifier> cc;
}; };
CV_EXPORTS Ptr<CascadeClassifier::MaskGenerator> createFaceDetectionMaskGenerator(); CV_EXPORTS Ptr<BaseCascadeClassifier::MaskGenerator> createFaceDetectionMaskGenerator();
//////////////// HOG (Histogram-of-Oriented-Gradients) Descriptor and Object Detector ////////////// //////////////// HOG (Histogram-of-Oriented-Gradients) Descriptor and Object Detector //////////////

View File

@ -918,12 +918,12 @@ Ptr<CascadeClassifierImpl::MaskGenerator> CascadeClassifierImpl::getMaskGenerato
return maskGenerator; return maskGenerator;
} }
Ptr<CascadeClassifier::MaskGenerator> createFaceDetectionMaskGenerator() Ptr<BaseCascadeClassifier::MaskGenerator> createFaceDetectionMaskGenerator()
{ {
#ifdef HAVE_TEGRA_OPTIMIZATION #ifdef HAVE_TEGRA_OPTIMIZATION
return tegra::getCascadeClassifierMaskGenerator(*this); return tegra::getCascadeClassifierMaskGenerator(*this);
#else #else
return Ptr<CascadeClassifierImpl::MaskGenerator>(); return Ptr<BaseCascadeClassifier::MaskGenerator>();
#endif #endif
} }
@ -1390,6 +1390,17 @@ bool CascadeClassifier::load( const String& filename )
return !empty(); return !empty();
} }
bool CascadeClassifier::read(const FileNode &root)
{
Ptr<CascadeClassifierImpl> ccimpl;
bool ok = ccimpl->read_(root);
if( ok )
cc = ccimpl.staticCast<BaseCascadeClassifier>();
else
cc.release();
return ok;
}
void CascadeClassifier::detectMultiScale( InputArray image, void CascadeClassifier::detectMultiScale( InputArray image,
CV_OUT std::vector<Rect>& objects, CV_OUT std::vector<Rect>& objects,
double scaleFactor, double scaleFactor,
@ -1452,7 +1463,7 @@ void* CascadeClassifier::getOldCascade()
return cc->getOldCascade(); return cc->getOldCascade();
} }
void CascadeClassifier::setMaskGenerator(const Ptr<MaskGenerator>& maskGenerator) void CascadeClassifier::setMaskGenerator(const Ptr<BaseCascadeClassifier::MaskGenerator>& maskGenerator)
{ {
CV_Assert(!empty()); CV_Assert(!empty());
cc->setMaskGenerator(maskGenerator); cc->setMaskGenerator(maskGenerator);

View File

@ -86,7 +86,7 @@ protected:
class Data class Data
{ {
public: public:
struct CV_EXPORTS DTreeNode struct DTreeNode
{ {
int featureIdx; int featureIdx;
float threshold; // for ordered features only float threshold; // for ordered features only
@ -94,12 +94,12 @@ protected:
int right; int right;
}; };
struct CV_EXPORTS DTree struct DTree
{ {
int nodeCount; int nodeCount;
}; };
struct CV_EXPORTS Stage struct Stage
{ {
int first; int first;
int ntrees; int ntrees;