Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

CascadeClasifier detectMultiScale arguments

Hello, I'm an opencv/c++ noob so please bare with me. I was looking at the objectdetect sample and tried it with a couple of body detection cascades(haarcascade_fullbody/haarcascade_upperbody/haarcascade_lowerbody,haarcascade_mcs_upperbody) on some footage I took with a camera of a pedestrian bridge. So far so good, but it's a demanding functionality.

I though thinks might run smoother if I pass the min/max Sizes since my camera is always in the same place and I figure out the min/max bounding boxes. Unfortunately I ran into syntax errors when trying to do so:

//my call
body.detectMultiScale( gray, bodies, 1.1, 2, 0|CV_HAAR_SCALE_IMAGE, cv::Size(30, 30),cv::Size(0,0),cv::Size(5,13),cv::Size(45,80));
//errors:
main.cpp:43: error: no matching function for call to 'cv::CascadeClassifier::detectMultiScale(cv::Mat&, std::vector<cv::Rect_<int>, std::allocator<cv::Rect_<int> > >&, double, int, int, cv::Size, cv::Size, cv::Size, cv::Size)'
/opt/local/include/opencv2/objdetect/objdetect.hpp:383: note: candidates are: virtual void cv::CascadeClassifier::detectMultiScale(const cv::Mat&, std::vector<cv::Rect_<int>, std::allocator<cv::Rect_<int> > >&, double, int, int, cv::Size, cv::Size)
/opt/local/include/opencv2/objdetect/objdetect.hpp:393: note:                 virtual void cv::CascadeClassifier::detectMultiScale(const cv::Mat&, std::vector<cv::Rect_<int>, std::allocator<cv::Rect_<int> > >&, std::vector<int, std::allocator<int> >&, std::vector<double, std::allocator<double> >&, double, int, int, cv::Size, cv::Size, bool)

I simply added two cv::Size objects as the min max, but to be honest I'm not sure: 1. Why the previous arguments are Size() objects as well when the docs list them as ints ? 2. Am I looking at the wrong docs or at the docs in a wrong way ?

C++: void CascadeClassifier::detectMultiScale(const Mat& image, vector<rect>& objects, double scaleFactor=1.1, int minNeighbors=3, int flags=0, Size minSize=Size(), Size maxSize=Size())

from docs.

Would this improve detection by much ? Also, I'm thinking about running the detection every few frames (not all the time) and track the detected points. What functions should I look for to tell OpenCV to track specified coordinates ?

Thanks!