Ask Your Question
0

Remove defects from round object

asked 2017-11-20 03:39:46 -0600

Terreko gravatar image

updated 2017-11-20 03:57:32 -0600

Hello everyone, I want to extract the inner circle like structure from this preprocessed image:
image description This is my best result so far (Green = Fitted Ellipse):
For the result above i used:
dilate -> findContours -> only keeping the second largest minAreaRect -> fitEllipse
For my needs the fitted ellipse is not precise enough. What i tryed already:

  • approxPolyDP: Either way it fails to detect part of the inner "circle" or it includes a lot of the defects
  • HoughCircles: The structure Iam looking for is just round but not a real circle, so it's way to unprecise
  • convexHull: Deforms the "circle" way to much
  • contourArea: Tryed to remove some of the blobs due to their small size but since lines have a small area aswell it didn't work

The perfect result (created by hand) the green part: image description

Any ideas how to get closer to this result?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
2

answered 2017-11-20 04:23:29 -0600

VxW gravatar image

Hi,

I think a clever combination of morphological operations and connected components could enhance the inner ring.

I have tried the following:

1) Dilate the image

image description

2) find connected components and remove blobs with small area

image description

3) take the inner ring and erode the image

image description

4) again find connected components and remove small blobs

image description

5) based on this you can do the ellipse fitting

edit flag offensive delete link more

Comments

Thank you a lot, I was able to recreate your steps and got a much better resut now. My mistake was it to redraw the contours I wanted to keep onto a new Mat instead of deleting the ones I don't need from dilated image.

Terreko gravatar imageTerreko ( 2017-11-20 05:09:11 -0600 )edit

Question Tools

2 followers

Stats

Asked: 2017-11-20 03:39:46 -0600

Seen: 821 times

Last updated: Nov 20 '17