0

Image in which object needs to be detected

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. The objects need not to be same every time.

1 Answer 1

2

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

enter image description here

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

Sign up to request clarification or add additional context in comments.

8 Comments

I don't know what language he is using. Moreover the explanation would do i guess.
the task looks simple but needs some tricky ways to get %100 correct answer
Ya, that's true. But my threshold values are also not so accurate..i randomly put the values. Same for the no.of dilations. If i correct those i may get better answer
Actually there are 4 unaccounted for, two at the bottom left, one bottom right, and one on the left 7 pegs up.
since the objects need not be same every time, so using thresholding won't work for the cases in which object itself is having low gray level values. What function have you used for finding the contours? P.S : I am using Opencv and python. and I tried doing this using opencv function template matching.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.