word segmentation using horizontal projection
2 views (last 30 days)
Show older comments
i followed word segmentation algorithm, according on histogram as steps: 1-construct the vertical histogram for the image. 2-count white pixel in each column. 3- use histogram to find the columns containing number of white pixel . i tried in this code , but i don't have any idea about how count white pixel in each histogram column, could you please help me.
x=imread('doc4.jpg');
xg=rgb2gray(x);
xbw=im2bw(xg);
imshow(xbw);
numWhitePixels = sum(xbw(:));
numBlackPixels = numel(xbw) - numWhitePixels;
sum(xbw,1);
sum(xbw,2);
px=sum(xbw,1); py=sum(xbw,2);
figure(1),plot(px); figure(2),plot(py);
imhist(px);
imhist(py);
0 Comments
Answers (0)
See Also
Categories
Find more on Histograms in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!