How to apply thresholding at different parts of an image?

12 vues (au cours des 30 derniers jours)
Krishna Chaitanya
Krishna Chaitanya le 9 Jan 2020
I have a grayscale image and location of some pixels from where i have to check whether the pixels connected to it have intensity greater than the given threshold .
There is a seperate threshold for every given starting pixel.
For example,
for a given pixel location p[i j] wih a threshold value 't' , I have to start at the pixel location [i j] in the grayscale image and check if the pixels connected to it (in 8 directions) have intensity greater than threshold 't'.If yes,then the process needs to be continued with that pixels too until no more pixels with intensity greater than threshold are found.
The process should start simultaneously from all given pixel locations in the image.
I need a logical array of 0s and 1s as result,the ones whose intensity are greater than t will be marked as 1 and the process will be continued till connected pixels don't have intensity greater than 't'.
Can somebody help me how to do this?

Réponse acceptée

Image Analyst
Image Analyst le 18 Jan 2020
I think this is simply a labeling problem so you can use the built-in function bwlabel().
You said you have a threshold for every single pixel in the image. OK that means you have another image where the values are the thresholds. You said you then want to threshold (binarize) all the pixels according to the threshold you have for each pixel location, so you're seeing if your image values are more than your threshold image values. And then you simply want to find all pixels above the threshold that are connected to the one at row i, column j. So you can just do
binaryImage = grayImage >= thresholdImage; % Binarize the image.
% Now identify connected components
[labeledImage, numberOfRegions] = bwlabel(binaryImage);
subplot(1, 2, 1);
imshow(labeledImage, []);
% Now determine the label at row i, column j, where i and j are known, specifed coordinate values.
ijLabel = labeledImage(i, j);
% Extract only the region with that label and display it.
ijBlob = ismember(labeledImage, ijLabel);
subplot(1, 2, 2);
imshow(ijBlob);

Plus de réponses (1)

Rik
Rik le 9 Jan 2020
What you describe is a region growing algorithm, of which you can find an implementation here.
  6 commentaires
Rik
Rik le 18 Jan 2020
Did you already attempt to implement my suggestions?
Krishna Chaitanya
Krishna Chaitanya le 18 Jan 2020
I haven't yet.I will try now and keep you posted.
Thank you.

Connectez-vous pour commenter.

Community Treasure Hunt

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

Start Hunting!

Translated by