Edited.
Previously this question was named "Segmentation of overlapping pulses in a binary spectrogram" and it was stated in slightly different way. I'm apologise to those users, who were affected by reformulation of the question.
Problem.
There are a set of binary images, that contain arbitrary set of noisy parallelograms. The height and width of objects can vary in a wide range. Some parallelograms can overlap. Set of typical images is listed bellow.
I need an algorithm to segment objects on those images in order to prepare them to extraction of connected components. There is one restriction on the segmentation algorithm - shape of the objects should be preserved during segmentation.
Attempted solutions.
Morphological erosion.
Morphological erosion don't work well in this case. In order to separate three overlapping rectangles in the last image from typical set, I needed structuring element so big, that it erases some small objects from other images.
Boundary extraction and Hit-or-miss transform with corner-like structuring elements.
I have tried detect corners of parallelograms, in order to find regions of intersection. But pattern matching of boundary with corner-like structuring elements turned out to be a bad idea (boundary doesn't have the shape of a corner in regions of intersection).
Some other morphological transformations.
I have tried playing with combinations of original and shifted images.
$A - [A - [(A)_{(-x, 0)}\cap(A)_{(+x, 0)}]]$, where $A$ is an original image and $x$ is a shift along $x$-axis. This transformation can be applied for separation of objects on the last image.
But it messes up second image.
Question.
Is there good general approach to such problem?
Any ideas, hints, links, articles will be much appreciated.
Thank you.