I used bwlabel for detecting connected components but i got error output i.e 3 objects are detected instead of 8. I am attaching input image. Expecting your suggestion.

 채택된 답변

Walter Roberson
Walter Roberson 2018년 1월 29일

0 개 추천

bwlabel assumes that the white pixels are where the data is and that the black pixels are holes. When you have black text on a white background you need to invert the image.

댓글 수: 4

Thanks Walter. After using imcomplement it detects all the objects. but the output seems blurred one. How can i make exact detection of objects i am using the below code.
ImgPlate=imread('ImgPlate.jpg');
ImgPlate=im2bw(ImgPlate);
% ImgPlate=bwareaopen(ImgPlate,4);
ImgPlate=imcomplement(ImgPlate);
figure,imshow(ImgPlate);
[L,Ne]=bwlabel(ImgPlate);
for n=1:Ne
[r,c] = find(L==n);
n1=picture(min(r):max(r),min(c):max(c)); %picture command crops nth object from L
n1=imresize(n1,[42,24]); %in database size is 42,24 so it is resized so that we can match it with the database
figure,imshow(n1);
end
Walter Roberson
Walter Roberson 2018년 1월 29일
편집: Walter Roberson 2018년 1월 29일
I would suggest that you do a bwclose() before doing the labeling, in order to join together sections that are close together such as the two parts of the accessibility symbol.
You are starting with a JPEG image, so you have to live with blurring. JPEG in the default lossless mode always blurs straight edges.
Thanks Walter. I will try with your inputs.
Or you could sum the image vertically to find the gaps between the symbols.

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

추가 답변 (0개)

질문:

2018년 1월 29일

댓글:

2018년 1월 30일

Community Treasure Hunt

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

Start Hunting!

Translated by