How to find maximum pixel intensity of the two regions obtained after finding the threshold of the image

6 views (last 30 days)
We are working on DIP project where we found out the threshold of the gray scale image. Now we have to * find the maximum intensity of the two regions that we got, one region whose pixels are less than the threshold and the other whose pixels are greater than it. * PS. We are not converting the image into binary image after finding the threshold. We just have to separate pixels in two regions and find the maximum intensity in each region bold

Accepted Answer

Image Analyst
Image Analyst on 22 Feb 2015
Edited: Image Analyst on 22 Feb 2015
Try something like this
% grayImage = imread('cameraman.tif');
someThreshold = 190;
binaryImage = grayImage < someThreshold;
labeledImage = bwlabel(binaryImage);
measurements = regionprops(labeledImage, grayImage, 'MaxIntensity');
maxIntensities = [measurements.MaxIntensity]
That gives a blob-by-blob accounting of the max. If you just want the max of the image above and below the threshold, you can simply do this
mask = grayImage < someThreshold;
maxAbove = max(grayImage(mask))
maxBelow = max(grayImage(~mask))
  1 Comment
SHRISHTI DEEP
SHRISHTI DEEP on 23 Feb 2015
Thanks...!!The code worked. I have to find the coordinates of the two maximum values that I got. But as I have more than one value at maxAbove and maxBelow, so instead of getting one particular coordinate, I'm getting a vector of coordinates. I just want one particular coordinate. How to do that?

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!