4343#define __OPENCV_OBJDETECT_HPP__
4444
4545#include " opencv2/core.hpp"
46- #include " opencv2/core/core_c.h"
46+ // #include "opencv2/core/core_c.h"
4747
48- #ifdef __cplusplus
4948#include < map>
5049#include < vector>
5150#include < string>
52- #endif
5351
5452extern " C" {
5553
56-
57-
5854/* ***************************************************************************************\
5955* Latent SVM Object Detection functions *
6056\****************************************************************************************/
@@ -63,6 +59,7 @@ extern "C" {
6359// Structure describes the position of the filter in the feature pyramid
6460// l - level in the feature pyramid
6561// (x, y) - coordinate in level l
62+
6663typedef struct CvLSVMFilterPosition
6764{
6865 int x;
@@ -84,6 +81,7 @@ typedef struct CvLSVMFilterPosition
8481// used formula H[(j * sizeX + i) * p + k], where
8582// k - component of feature vector in cell (i, j)
8683// END OF FILTER DESCRIPTION
84+
8785typedef struct CvLSVMFilterObjectCaskade {
8886 CvLSVMFilterPosition V;
8987 float fineFunction[4 ];
@@ -106,6 +104,7 @@ typedef struct CvLSVMFilterObjectCaskade{
106104// filters - root and part filters for all model components
107105// b - biases for all model components
108106// score_threshold - confidence level threshold
107+
109108typedef struct CvLatentSvmDetectorCaskade
110109{
111110 int num_filters;
@@ -118,77 +117,7 @@ typedef struct CvLatentSvmDetectorCaskade
118117 int pca_size;
119118} CvLatentSvmDetectorCaskade;
120119
121- // data type: STRUCT CvObjectDetection
122- // structure contains the bounding box and confidence level for detected object
123- // rect - bounding box for a detected object
124- // score - confidence level
125- typedef struct CvObjectDetection
126- {
127- CvRect rect;
128- float score;
129- } CvObjectDetection;
130- }
131- // ////////////// Object Detection using Latent SVM //////////////
132-
133-
134- /*
135- // load trained detector from a file
136- //
137- // API
138- // CvLatentSvmDetector* cvLoadLatentSvmDetector(const char* filename);
139- // INPUT
140- // filename - path to the file containing the parameters of
141- - trained Latent SVM detector
142- // OUTPUT
143- // trained Latent SVM detector in internal representation
144- */
145- namespace cv
146- {
147- namespace lsvmc
148- {
149- CVAPI (CvLatentSvmDetectorCaskade*) cvLoadLatentSvmDetectorCaskade(const char * filename);
150-
151- /*
152- // release memory allocated for CvLatentSvmDetector structure
153- //
154- // API
155- // void cvReleaseLatentSvmDetector(CvLatentSvmDetector** detector);
156- // INPUT
157- // detector - CvLatentSvmDetector structure to be released
158- // OUTPUT
159- */
160- CVAPI (void ) cvReleaseLatentSvmDetectorCaskade(CvLatentSvmDetectorCaskade** detector);
161- /*
162- // find rectangular regions in the given image that are likely
163- // to contain objects and corresponding confidence levels
164- //
165- // API
166- // CvSeq* cvLatentSvmDetectObjects(const IplImage* image,
167- // CvLatentSvmDetector* detector,
168- // CvMemStorage* storage,
169- // float overlap_threshold = 0.5f,
170- // int numThreads = -1);
171- // INPUT
172- // image - image to detect objects in
173- // detector - Latent SVM detector in internal representation
174- // storage - memory storage to store the resultant sequence
175- // of the object candidate rectangles
176- // overlap_threshold - threshold for the non-maximum suppression algorithm
177- = 0.5f [P. Felzenszwalb, R. Girshick, D. McAllester Cascade
178- // Object Detection with Deformable Part Models
179- // IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2010]
180- // OUTPUT
181- // sequence of detected objects (bounding boxes and confidence levels stored in CvObjectDetection structures)
182- */
183- CVAPI (CvSeq*) cvLatentSvmDetectObjectsCaskade(IplImage* image,
184- CvLatentSvmDetectorCaskade* detector,
185- CvMemStorage* storage,
186- float overlap_threshold CV_DEFAULT (0 .5f ));
187- }
188120}
189- #ifdef __cplusplus
190-
191-
192121
193122namespace cv
194123{
@@ -224,8 +153,8 @@ class CV_EXPORTS LatentSvmDetector
224153 virtual bool empty () const ;
225154 bool load ( const std::vector<std::string>& filenames, const std::vector<std::string>& classNames=std::vector<std::string>() );
226155
227- virtual void detect ( const Mat& image,
228- std::vector<ObjectDetection>& objectDetections ,
156+ virtual void detect (const Mat& image,
157+ CV_OUT std::vector<ObjectDetection>& objects ,
229158 float overlapThreshold=0 .5f );
230159
231160 const std::vector<std::string>& getClassNames () const ;
@@ -239,5 +168,3 @@ class CV_EXPORTS LatentSvmDetector
239168} // namespace cv
240169
241170#endif
242-
243- #endif
0 commit comments