How do I cut individual letters in the image bar code?
조회 수: 1 (최근 30일)
이전 댓글 표시
I have a code 39 barcode image.
Because each character is encoded by a Code 39 total of 9 elements. In which five black bars and 4 spaces, 3 of 9 elements with large width (2 large black bars and a big blank) 6 remaining elements have small widths (narrow (except 4 characters $, /, +% have three large white lines). I want to extract characters from the original bar code of the individual characters.
My images was taken on the binary image, 0 is black bars, 1 is white bars
I use the following command to cut the first letter
for j=1:n,
if (I(:,j)==0)&(I(:,j+1)==1)
s=s+1;
if s==5
C0 =I(:,1:j+2);
C0a=imresize(C0,[49 50]);
imwrite(C0a,'Tapanh\1.bmp');
s=0;
t=j+2;
break;
end
end
end
I want to use the loop to cut each letter next to the end. Please help me. This is my sample image and images need to be cut http://s1213.photobucket.com/albums/cc477/bluesrose/barcode/ please help me
답변 (1개)
Sean de Wolski
2011년 5월 18일
Use bwconncomp to group objects and then use regionprops with the 'image' option. Each image in the output from regionprops will be a an image of that object (letters & bars).
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Image Segmentation and Analysis에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!