提交 a26c4fa2 编写于 作者: H Heinz Hofbauer

Bugfix for an overlapping size of image and template for matchTemplate.

Example: img of size 10x10 and templ of size 11x9.
In subsequent code this will results in either width or height of
corrSize to be zero (0).
Line 261 will call crossCorr which will then have a zero size of either
blocksize.width or blocksize.height resulting in a division by zero
crach in lines 137 or 138.
上级 6bf8f474
......@@ -248,6 +248,8 @@ void cv::matchTemplate( InputArray _img, InputArray _templ, OutputArray _result,
CV_Assert( (img.depth() == CV_8U || img.depth() == CV_32F) &&
img.type() == templ.type() );
CV_Assert( img.rows >= templ.rows && img.cols >= templ.cols);
Size corrSize(img.cols - templ.cols + 1, img.rows - templ.rows + 1);
_result.create(corrSize, CV_32F);
Mat result = _result.getMat();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册