Histogram from masked area of grayscale picture
Show older comments
Hello!
I want to make a histogram from masked area of a grayscale picture. I've tried this:
maskedImage = bsxfun(@times, grayImage, cast(mask, 'like', grayImage));
histogram(maskedImage(mask), 256, 'EdgeColor', 'none')
But it keeps saying: "Array indices must be positive integers or logical values". There are no negative integers and the mask only contains 0 and 1.
Hope you can help! :-)
Accepted Answer
More Answers (2)
Image Analyst
on 18 Jun 2019
Attach a .mat file containing your grayImage and mask.
Alternatively, just do
histogram(grayImage(mask), 256, 'EdgeColor', 'none')
Anders Jensen
on 18 Jun 2019
0 votes
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!