word segmentation using horizontal projection
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Histograms 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!