-
-
Notifications
You must be signed in to change notification settings - Fork 56.5k
Is masked matchTemplate implementation correct? #6919
Copy link
Copy link
Closed
Labels
Description
System information (version)
- OpenCV => 3.1
- Operating System / Platform / Compiler => any
Detailed description
#6773 has brought a couple of question about masked matchTemplate implementation.
- The
CV_8UandCV_32Fmasks seem to be treated differently.CV_8Umask is treated as binary, but in case of aCV_32Fmask, the template pixels will be multiplied by the mask values (presumably, in [0..1] range). Is that intended? See https://github.com/opencv/opencv/blob/master/modules/imgproc/src/templmatch.cpp#L860 - I'm in doubt regarding the implementation correctness:
- For CV_TM_CCORR_NORMED metric, I would expect that the implementation will simply multiply the template by mask. But it does something more involved.
- For CV_TM_SQDIFF metric, I would expect it to multiply the squared bracket by mask. It looks like the implementation tries to replace the square of sum into separate units and multiply them by mask individually. But to me, the evaluation doesn't look correct.
@vpisarev, are you familiar with the implementation? Can you comment on this? Also, it looks like @wangyan42164 is the author of the implementation. Is that so? If yes, can you, please, comment as well?
Reactions are currently unavailable