Template Matching Using OpenCV in Python

前端 未结 2 1137
感情败类
感情败类 2021-01-21 05:59

I am a newbie in Image Processing and learning about Template Matching by getting some help from OpenCV documentation, but I didn\'t understand some lines of the code.
Here

相关标签:
2条回答
  • 2021-01-21 06:00

    The threshold 0.8 means the match should be at least 80% of template image and the source region of interest. Thus if it is greater than 80%, it is a coin. If you reduce the threshold the false positive results would increase even if it is not a coin.

    for pt in zip(*loc[::-1]): is for the points which have values greater than threshold. zip is a container of all such points and it will iterate to all such points and draw rectangle around this closed entity i.e. coins here.

    0 讨论(0)
  • 2021-01-21 06:12

    Threshold = 0.8 works according to lightness on the image you are working on. If lights are proper on your image then threshold > 0.8 will work but mostly in camera images brightness varies so lightness > 0.65 can work. To match more points you have to reduce your threshold value.

    0 讨论(0)
提交回复
热议问题