How do I cut individual letters in the image bar code?
Afficher commentaires plus anciens
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
Réponses (1)
Sean de Wolski
le 18 Mai 2011
0 votes
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).
Catégories
En savoir plus sur Convert Image Type dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!