how to find the least pixel intensity value for each connected component?
7 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Krishna Chaitanya
el 8 de En. de 2020
Respondida: Image Analyst
el 8 de En. de 2020
Binary image:
Green image:
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.
0 comentarios
Respuesta aceptada
Image Analyst
el 8 de En. de 2020
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 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Image Processing Toolbox en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!