检测自定义形状的OpenCV [英] Detect custom shape OpenCV

查看:89
本文介绍了检测自定义形状的OpenCV的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在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附带一个功能为此使用cv2.matchTemplate().它只是滑动模板图像覆盖输入图像(如2D卷积),并比较模板和模板图像下的输入图像补丁.

Template Matching is a method for searching and finding the location of a template image in a larger image. OpenCV comes with a function cv2.matchTemplate() for this purpose. It simply slides the template image over the input image (as in 2D convolution) and compares the template and patch of input image under the template image.

我从此处,这是有关如何在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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆