フィルターのクリア

how to find the least pixel intensity value for each connected component?

2 ビュー (過去 30 日間)
Krishna Chaitanya
Krishna Chaitanya 2020 年 1 月 8 日
回答済み: Image Analyst 2020 年 1 月 8 日
Binary image:
finalcandidates.png
Green image:
Ig.jpg
I have a binary image with some pixels as 1 and some as 0 forming a image of group of connected components(white spots within the black image).I need to find the intensities of the pixels of these white spots in other image(green image) and find the pixel with lowest intensity and its value in the green image.I need to find the lowest intensity pixel and its value in the green image for all the white clusters in the binary image.
Can somebody please help me how to find it?
Thank you.
I am enclosing the binary image as finalcandidates,png and the green image as Ig.png.

採用された回答

Image Analyst
Image Analyst 2020 年 1 月 8 日
See demo below. Adapt as needed:
grayImage = imread('coins.png');
subplot(2, 2, 1);
imshow(grayImage);
subplot(2, 2, 2);
histogram(grayImage)
binaryImage = imfill(grayImage > 90, 'holes');
binaryImage = bwareafilt(binaryImage, 10);
subplot(2, 2, 3);
imshow(binaryImage);
subplot(2, 2, 4);
[labeledImage, numBlobs] = bwlabel(binaryImage);
props = regionprops(labeledImage, grayImage, 'PixelValues', 'PixelList')
for k = 1 : numBlobs
% Fin the min value of this blob's pixel values.
thisBlobsMin = min(props(k).PixelValues);
% Get locations in this blob
mask = ismember(labeledImage, k);
maskedImage = grayImage .* uint8(mask);
% Find all the rows and columns where it appears
[rows, columns] = find(maskedImage == thisBlobsMin);
imshow(maskedImage);
axis('on', 'image');
hold on;
plot(columns, rows, 'r+', 'LineWidth', 2, 'MarkerSize', 15);
hold off
caption = sprintf('Showing cross at %d mins for blob #%d of %d.\n', ...
length(rows), k, numBlobs);
title(caption, 'FontSize', 12);
fprintf('%s\n', caption);
end
fprintf('Done!\n');

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImage Processing Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by