Assertion failed _img.size().height <= _templ.size().height && _img.size().width <= _templ.size().width in function 'cv::matchTemplate'

Asked by Krisjanis Berzins

Sometimes I get these errors:

org.opencv.core.CvException: CvException [org.opencv.core.CvException: cv::Exception: OpenCV(3.4.2) C:\build\3_4_winpack-bindings-win64-vc14-static\opencv\modules\imgproc\src\templmatch.cpp:1107: error: (-215:Assertion failed) _img.size().height <= _templ.size().height && _img.size().width <= _templ.size().width in function 'cv::matchTemplate'

Am I right in assuming they are to do with the region being too small or not fitting the image/pattern I am searching for when it is found? I think I am able to work around by extending/recapturing the region after which these errors stop. But I am not 100% certain.

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

Yes, right: the region to search in is in one or both directions smaller than the image.

But this problem should be detected by SikuliX itself before. I make it a bug.

BTW: in another question you talked about the C:\build... folder: this is a reference to the original build environment, where the bundled native libraries where build. This seems to be recorded in the libs to doc the reference into the source files (.cpp) in such cases.

Can you help with this problem?

Provide an answer of your own, or ask Krisjanis Berzins for more information if necessary.

To post a message you must log in.