简体   繁体   中英

Detect objects in an image opencv

需要检测物体的图像

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.

PS 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

在此处输入图片说明

What i did:

  1. Threshold and dilate the image
  2. Count contours in the region within approximately the area of the circles.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM