I have the following image extracted from a screen
Unfortunately, the individual digits are not wholly connected objects, e.g - the '5', '2', '8', etc are not continuous. I intend to extract the individual digits using a bounding box. But for that, each of the digits have to be 1 connected object. How to connect the different segments of each digit? I tried using the 'thicken' utility of bwmorph function but there though the thickening is happening, the segments are not getting connected since the Euler number is preserved in 'thicken'. I have been using the imdilate function but the structuring element for proper dilation keeps on varying from image to image. Please suggest a generalized solution how to connect the segments of an individual digit ??
Seems very similar to questions you have been asking for months now. But, assuming you have a relatively level, aligned image, I'd sum the digits vertically
horizontalProfile = sum(binaryImage, 1); plot(horizontalProfile, 'b-'); grid on;
and examine the profile to see where there are low value places - they'll be the spaces between the digits. Use those locations to crop your image.