检测图像opencv中的对象 [英] Detect objects in an image opencv

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

问题描述

我附加了一个由对象组成的图像。问题是找到图像中存在的对象的计数。我已经尝试过opencv模板匹配,但它不是不变的缩放,旋转和变形意味着如果我从这个图像中取一个对象的补丁并尝试进行模板匹配,那么会有一些与juts不匹配的对象,因为它们很少有点变形或不同的方向。模板匹配的问题首先是我必须从查询图像本身获取模板。因此,如果图像不同,则不会有匹配。

I have attached an image which consists of objects. The problem is to find the count of the objects present in the image. I have tried opencv template matching but it is not invariant to scale, rotation and deformation means if I take a patch of object from this image and try to do template matching then there will some of the object which will not match juts because they are little bit deformed or differently oriented. The problem with template matching is first I have to take the template from the query image itself. So if the image is at different there will not be matches.

有没有更好的方法来解决这类问题。

Is there any better way to tackle this kind of problem.

P.S。每次对象不必相同。

P.S. The objects need not to be same every time.

推荐答案

如果你使用闪亮的杆边,这很简单。无需模板匹配。请查看以下输出图像

That's pretty simple if you make use of the shiny rod edges. No need for template matching. Look at the below output image

< img src =https://i.stack.imgur.com/dY8Tv.jpgalt =在此输入图像说明>

我是什么确实:


  1. 阈值并扩大图像

  2. 计算区域内大约区域内的轮廓圈子。

您可以使用多种方法。如果正确传递参数,直接hough圈可能会起作用。但这是我认为最安全的。
这对你的计数是一个很好的估计,如果我的阈值正确可以变得更好(3杆在这里没有计算)。通过说对象可能不一样,如果你的意思是完全不同的对象,那么你需要做那个图像需要的东西

There are many methods you can use. Direct hough circles might work if you pass the parameters properly. But this is the safest i think. That's a good estimate for your count, can get better if i threshold properly( 3 rods weren't accounted for in this). By saying the objects might not be the same always if you mean completely different objects, then you need to do what requires with that image

这篇关于检测图像opencv中的对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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