-
Notifications
You must be signed in to change notification settings - Fork 35
OpenCV description
UFPA – Feb. 07, 2016 Face Detection using OpenCV code
A description of the OpenCV source code (in C++) to help debugging.
Most of the functionality is at opencv\sources\modules\objdetect\src\cascadedetect.cpp
For example, the method at line 1632 void CascadeClassifier::detectMultiScale is the first one to be invoked in the provided example opencv_ufpafacedet.cpp. At that point, many variables are not initialized, such as: scaleFactor=0, int minNeighbors=32767, int flags=-9856,
Then, the code goes to line 1351 Then, the code goes to line 1316 At this point, most variables are initialized. For example: scaleFactor=1.1, int minNeighbors=3, flags=0
Then go to line 1215 void CascadeClassifierImpl:: ( InputArray _image, std::vector& candidates, ... where maxObjectSize is made equal to the image size In our system, OpenCL is not used, so: use_ocl=false For one of the tested images, 46 scales were used, which can be seen as scales.size() = 46 For each of these, the image size is decreased using linear interpolation, with something line imresize in Matlab The code that actually computes the features for the given image starts at Line 474: bool FeatureEvaluator::setImage( InputArray _image, const std::vector& _scales )
Line 425: bool FeatureEvaluator::updateScaleData( Size imgsz, const std::vector& _scales )
Line 660: void HaarEvaluator::computeOptFeatures()
It becomes a little confusing because OpenCV supports parallel processing. Line 953: class CascadeClassifierInvoker : public ParallelLoopBody
Line 1595: void clipObjects(Size sz, std::vector& objects,
Compute integral, etc:
Runs for all scales: bool FeatureEvaluator::setImage( InputArray _image, const std::vector& _scales )
HaarEvaluator::computeChannels(int scaleIdx, InputArray img) integral(img, sum, sqsum, noArray(), CV_32S, CV_32S);