问题描述
我想在OpenCV中找到自定义形状.形状是预先定义的.我想使用WebCam实时检测此形状是否等于当前形状.
I want to find custom shape in OpenCV.Shape is previously defined. I want to detect if this shape is equal or not equal to the current shape using WebCam in real time.
我该怎么做?如何比较预定义的自定义形状和当前形状?
How can I do that? How to compare pre-defined custom shape and current shape?
推荐答案
随着评论者的流逝,您可以使用模板匹配来检测自定义形状.
As the commenters have eluded, you can use template matching to detect custom shapes.
那么什么是模板匹配?
模板匹配是数字图像处理中的一种技术,用于查找匹配的图像小部分模板图像.它可以在制造业中用作质量控制的一部分,导航移动机器人的方法或检测图像边缘的方法.
Template matching is a technique in digital image processing for finding small parts of an image which match a template image. It can be used in manufacturing as a part of quality control, a way to navigate a mobile robot, or as a way to detect edges in images.
OpenCV/Python中的模板匹配
我从此处,这是有关如何在OpenCV中执行模板匹配的教程.您可以搜索定义的任何自定义形状".它包括python的代码示例.
I have taken this text from here which is a tutorial on how to perform template matching in OpenCV. You can search for any "custom shape" that you define. It includes code samples for python.
这篇关于检测自定义形状的OpenCV的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!