필터 지우기
필터 지우기

Connecting isolated objects in an image

조회 수: 1 (최근 30일)
Soumyadip
Soumyadip 2013년 7월 1일
Hi,
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 ??

답변 (1개)

Image Analyst
Image Analyst 2013년 7월 1일
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.
  댓글 수: 2
Soumyadip
Soumyadip 2013년 7월 2일
As you suggested earlier, I had already done the horizontal profile to crop digits and it is working quite well. However, while thresholding from the original image, some noise is often getting introduced between the digits and then the results are erroneous. So I thought of exploring this bounding box technique. Is it possible to connect the segments of an individual digit as I asked earlier?
Image Analyst
Image Analyst 2013년 7월 3일
Once you have cropped out a digit, if your digit is comprised of an arbitrary number and arrangement of blobs, you'd be best off having a template of "pixels" to look in for each digit 0 - 9 plus the decimal point and underline symbols. No matter if a digit is "broken" it will most likely have more pixels inside the template than any other digit. So you can test the cropped image against each template and the digit that has the highest number of "hits" inside your template shape will be the digit that it is. For example, have a binary image of a 5 that is composed of a bunch of broken, disconnected blobs. You test that image against templates for 0, 1, 2, etc. up to 0 and you'll find that the 5 will have the most number of "hits" in it, whereas a 1, say, won't have as many hits.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Read, Write, and Modify Image에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by