Jigsaw puzzle: isolating the pieces (separating "stuck" blobs) I'm new to image processing, and I'm trying to get my feet wet. I have taken a picture of some jigsaw puzzle pieces and I want to isolate the pieces.



I am using the Python SimpleCV library to do this, and so far I've managed to get pretty decent results using findBlobs(), hueDistance(), and drawMinRect(). Here's what I've got so far



Pretty good, honestly. The only place it's wrong is with those two pieces touching slightly to the right of center.

I tried dilating the image, but that seems to exacerbate the problem. How can I "shrink" these blobs to eliminate the overlap?
I agree with Abid Rahman K, however eroding only would result in shape shrinkage.  To only get rid of the gap, Abid Rahman suggests a watershed based approach, but for a faster and easier method you might try:


Erode the regions
Apply connected component labeling.
Dilate the regions back.


This way you will have almost the same shape (with some artifacts arising due to morphology) but you will surely end up with single connected components. 

Watersheds and distance transform are also powerful and might be good choices if you have a lot of overlap.