Row by Row character extraction
2 views (last 30 days)
Show older comments
I am working on handwritten character recognition from input image. Here is the code which extracts characters from input image
%%Label connected components
[L Ne]=bwlabel(Ifill);
disp(Ne);
%%Measure properties of image regions
propied=regionprops(L,'BoundingBox');
hold on
%%Plot Bounding Box
for n=1:size(propied,1)
rectangle('Position',propied(n).BoundingBox,'EdgeColor','g','LineWidth',2)
end
hold off
%%Characters being Extracted
figure
for n=1:Ne
[r,c] = find(L==n);
n1=imagen(min(r):max(r),min(c):max(c));
imshow(~n1);
end
But this code is extracting characters randomly from the input image. Can anyone please tell me how to extract the characters row by row?
1 Comment
moahaimen talib
on 7 May 2017
could you please provide the full code? specially the type of input images thank you
Answers (1)
Image Analyst
on 7 Apr 2014
It's not random. It extracts in column major order like most things in MATLAB. So it goes down column 1, looking for parts of a letter. If it finds one, then it labels it (which may make an incursion into other columns of course) and continues down the column. Then it moves to the next column and goes down looking for letters that have not yet been assigned a label. If it finds one, it labels it. And so on. If you want to go from left to right (or vice versa), then you're going to have to extract a line at a time. Otherwise, it could get the 10th line of handwriting first if that happens to stick out farther to the left than above lines of text. Like line 1 doesn't appear until column 200 but line 10 shows up in column 50, so it would "find" left-most character on the 10th line first.
2 Comments
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!