OpenCV detectMultiScale()参数的建议值 [英] Recommended values for OpenCV detectMultiScale() parameters

查看:6373
本文介绍了OpenCV detectMultiScale()参数的建议值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

CascadeClassifier :: detectMultiScale的建议参数) ,根据哪些因素我应该更改默认参数?

What are the recommended parameters for CascadeClassifier::detectMultiScale() and depending on which factors I should change default parameters?

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


推荐答案

在这些参数中,您需要更多关注其中四个:

Amongst these parameters, you need to pay more attention to four of them:


  • p> scaleFactor - 指定每个图像缩放比例缩小图像大小的参数。
  • scaleFactor – Parameter specifying how much the image size is reduced at each image scale.

基本上,比例因子用于创建您的缩放金字塔。有关详情,请访问此处。简而言之,如这里,您的模型在训练期间定义的固定大小,在 xml 中可见。这意味着在图像中检测到该面部大小(如果存在)。但是,通过重新缩放输入图像,您可以将较大的面部调整为较小的面部,从而使其可以被算法检测到。

Basically the scale factor is used to create your scale pyramid. More explanation can be found here. In short, as described here, your model has a fixed size defined during training, which is visible in the xml. This means that this size of face is detected in the image if present. However, by rescaling the input image, you can resize a larger face to a smaller one, making it detectable by the algorithm.

1.05 是一个很好的值,步骤调整大小,即减小大小5%,您增加匹配大小与检测模型匹配的机会。这也意味着算法工作速度较慢,因为它更彻底。

1.05 is a good possible value for this, which means you use a small step for resizing, i.e. reduce size by 5%, you increase the chance of a matching size with the model for detection is found. This also means that the algorithm works slower since it is more thorough. You may increase it to as much as 1.4 for faster detection, with the risk of missing some faces altogether.

minNeighbors

minNeighbors – Parameter specifying how many neighbors each candidate rectangle should have to retain it.

minSize - 最小对象大小。小于此值的对象将被忽略。

minSize – Minimum possible object size. Objects smaller than that are ignored.

此参数确定要检测的小尺寸。你决定吧!通常, [30,30] 是面部检测的好开始。

This parameter determine how small size you want to detect. You decide it! Usually, [30, 30] is a good start for face detection.

maxSize - 可能的对象大小上限。大于此值的对象将被忽略。

maxSize – Maximum possible object size. Objects bigger than this are ignored.

此参数确定要检测的大小大小。再次,你决定! 通常情况下,您不需要手动设置,默认值假设您想要在没有脸部大小上限的情况下检测。

This parameter determine how big size you want to detect. Again, you decide it! Usually, you don't need to set it manually, the default value assumes you want to detect without an upper limit on the size of the face.

这篇关于OpenCV detectMultiScale()参数的建议值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆