OpenCV 2.4级联分类的detectMultiScale参数

OpenCV 2.4 CascadeClassified detectMultiScale arguments

本文关键字:detectMultiScale 参数 分类 级联 OpenCV      更新时间:2023-10-16

我正在查看objectdetect样本,并在我用人行天桥的相机拍摄的一些镜头中使用了几个身体检测级联(*haarcascade_fullbody/haarcascade_upperbody/haercascade_lowerbody,haarcascarde_mcs_upperbody*)进行了尝试。到目前为止还不错,但功能要求很高。

不过,我认为如果我通过最小/最大尺寸,可能会运行得更平稳,因为我的相机总是在同一个地方,我会计算出最小/最大边界框。不幸的是,我在尝试这样做时遇到了语法错误:

//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)

我只是添加了两个cv::Size对象作为最小-最大值,但老实说,我不确定:

  1. 为什么前面的参数也是Size()对象将它们列为int
  2. 我看错了文件还是看错了以错误的方式

C++:void级联分类器::detectMultiScale(const Mat&image,矢量&对象,双比例因子=1.1,int minNeighbors=3,intflags=0,Size minSize=Size(),Size maxSize=Size())

来自文档。

我似乎传递了错误的参数。这起到了作用:

body.detectMultiScale(gray,bodies,1.1,3,3,cv::Size(5,13),cv::Size(45,80));

在我的案例中面临同样的问题。下面的行对我有效。如果你考虑的话,我只提供最小尺寸的cv::Size(45,80)。我仍在调查其他参数,但目前正在进行中。

haar_cascade.detectMultiScale(gray,faces,1.1,3,3,cv::Size(45,80));
相关文章:
  • 没有找到相关文章