cvPyrDown vs cvResize for face detection optimization

假如想象 提交于 2020-01-02 05:45:10

问题


I want to optimize my face detection algorithm by scaling down the image. What is the best way? should I use cvPyrDown (as I saw in one example and yielded poor results so far), cvResize or another function?


回答1:


If you only want to scale the image, use cvResize as Adrian Popovici suggested.

cvPyrDown will apply a Gaussian blur to smooth the image, then by default it will down-sample the image by a factor of two by rejecting even columns and rows. This smoothing may be degrading your performance (I'm not sure how it affects the detection algorithm). Another possibility for the poor performance might be the discontinuities created by just dropping even rows and columns; whereas, the smooth interpolations (assuming you interpolated with something other than nearest neighbor) by cvResize allow the face detection to work better. Here is the documentation on cvPyrDown for more information on the exact kernel that is used.




回答2:


For scaling down images I would use :

void cvResize(const CvArr* src, CvArr* dst, int interpolation=CV_INTER_LINEAR )

To shrink an image, it will generally look best with CV_INTER_AREA interpolation, whereas to enlarge an image, it will generally look best with CV_INTER_CUBIC (slow) or CV_INTER_LINEAR (faster but still looks OK).

But also I haven't used cvPyrDown so far so i don't know it's performances...




回答3:


If your face detection algorithm uses haar features then you don't need any rescaling at all, just use the integral image to access any scale you want by scaling the detector. Also : cvResize seems to be way slower on the new version of OpenCV (2.X) than in OpenCV 1.X



来源:https://stackoverflow.com/questions/8412756/cvpyrdown-vs-cvresize-for-face-detection-optimization

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!