how to find number of foreground pixel and background pixel of an english alphabet
3 views (last 30 days)
Show older comments
I have to find number of foreground pixel and background pixel within in the boundingbox. For example the letter B ,If we draw the straight line 4-side of the letter B then it will create a rectangle box ,inside rectangle box letter B is there. Within in the bounding box I have to find number of foreground and background Pixel. This is my code:
E = imread('1.jpg');
label=graythresh(E);
BW = im2bw(E,label);
imshow(BW)
L=bwlabel(E);
z=regionprops(L,'BoundingBox');
nBlackpixel = sum(z(:))
nWhitepixel = numel(z) - nBlack
0 Comments
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!