Proper contour break

I want to analyse object geometry in images with the help of contours. This way parameters like angle and distance can be determined:

enter image description here

But some images look like this:

enter image description here enter image description here enter image description here enter image description here

I am trying to make a contour break in between both objects, problem is that the objects have not a fixed size. They can change their length and shape. As a result the contour break is done at wrong positions, so that no proper analysis is possible. Right now the contour break is coupled with the size of the lower object. This is how a correct break should look like:

enter image description here

Any idea how to solve this?

Edit:

Folder with Input Images: https://ufile.io/v6fqs

Example:

enter image description here enter image description here enter image description here

Upvotes: 4

Views: 294

Answers (1)

Guilherme Vogt
Guilherme Vogt

Reputation: 315

Thanks for the examples and the well framed question.

That's a big issue indeed, even more considering medical imaging. Seems to me that the answer lies in a blob detection and separation method.

A good method for that would be to do some binarization, morphological transforms and search for convexity defects (https://docs.opencv.org/master/d3/dc0/group__imgproc__shape.html#gada4437098113fd8683c932e0567f47ba).

convexityDefects =  cv.convexityDefects(contour, convexhull[, convexityDefects] )

And I also think this thread can help you as well:

http://answers.opencv.org/question/71691/single-blob-multiple-objects-ideas-on-how-to-separate-objects/

Upvotes: 4

Related Questions