Ask Your Question

Split connected blobs

asked 2014-06-16 05:32:27 -0600

vkcelik gravatar image

updated 2015-09-26 13:01:18 -0600


I am using contours to detect the balls by their area. The problem arises when the balls are next to each other. I have tried the erode function but I can't get it right.

This is a sample picture:

image description

This is the binary image I get after using inRange.

image description

How would you guys tackle this problem? Would you use erode? In that case, which parameters would you give to the function? Is there any other way than erode, which is not very complex?

EDIT: Adding eroded image by request. image description

Im using this code to get it:

Imgproc.erode(filtered, filtered, Imgproc.getStructuringElement(Imgproc.MORPH_ELLIPSE, new Size(8,8)));
edit retag flag offensive close merge delete


Can you upload the results you get with erode?

GilLevi gravatar imageGilLevi ( 2014-06-16 07:21:42 -0600 )edit

I have added it to the question

vkcelik gravatar imagevkcelik ( 2014-06-16 07:34:04 -0600 )edit

I think it would have worked if you didn't have text on the balls. Perhaps you can fill the holes and then apply erode. Not sure though.

GilLevi gravatar imageGilLevi ( 2014-06-16 07:47:01 -0600 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2014-06-17 07:45:47 -0600

Goosebumps gravatar image

Try watershed: watershed example

edit flag offensive delete link more

Question Tools


Asked: 2014-06-16 05:32:27 -0600

Seen: 1,431 times

Last updated: Jun 17 '14