我的目的就是选取图像中的指示灯,识别那种功能的指示灯亮了,进而知道那种功能打开了。
模板匹配:
模板匹配是傻瓜似的识别,从一副图像中寻找与模板图像相似部分的技术。模板匹配由matchTemplate()函数完成。
介绍两个函数,matchTemplate()和minMaxLoc()函数:
void matchTemplate(InputArray image, InputArray temp, OutputArray result, int method)
- image – Image where the search is running. It must be 8-bit or 32-bit floating-point.
- templ – Searched template. It must be not greater than the source image and have the same data type.
- result – Map of comparison results. It must be single-channel 32-bit floating-point. If image is