Obtain the mean all pixels above & below a threshold.
6 views (last 30 days)
Show older comments
I want to find all pixels above a threshold in a gray scale image, I therefore use:
[ii,jj]=find(IM>(thresh));
Is there a way to find the mean value of all those pizels above the threshold (i.e. at locations ii,jj) without using for loop?
0 Comments
Accepted Answer
Image Analyst
on 25 Oct 2015
Try it this way:
mask = grayImage > someThresholdValue;
theMean = mean(grayImage(mask))
mask is a 2D binary (logical) image.
grayImage(mask) is a vector (list of values.)
More Answers (0)
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!