sir,i need to draw the horizontal and vertical histogram of a binary image..plz help?
1 view (last 30 days)
Show older comments
sir,i need to draw the horizontal and vertical histogram of a binary image..plz help?
Answers (1)
Image Analyst
on 29 Mar 2015
I don't even know what that is . Do you mean that you want the bar chart of the counts to go vertically or horizontally across the screen??? Do you mean that you want the histogram of one or more specified rows or columns instead of the entire image? Please clarify. And, anyway, since a binary image has only two values, true and false, you can simply get the counts like this
numWhitePixels = sum(binaryImage(:));
numBlackPixels = numel(binaryImage) - numWhitePixels;
If you want a certain sub-image of the binary image, then use this instead of binaryImage
binaryImage(row1:row2, col1:col2);
5 Comments
Image Analyst
on 30 Mar 2015
[rows, columns] = size(grayImage);
for row = 1 : rows
rowMeans(row) = mean(grayImage(row,:));
end
bar(rowMeans); % Plot gray level means
See Also
Categories
Find more on Histograms in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!