intersection the red edges of the mask to a grayscale image

2 visualizaciones (últimos 30 días)
Hi; I have two images of lungs first in grayscale and the second with a mask, I want to make the edges of the mask intersect with the grayscale image, so that the resulting image remains in grayscale and the edges are red, I have a problem where I can not keep the image in grayscale because the code does not work without "label2rgb"
I = imread('001.png');
[B,L] = bwboundaries(I,'noholes');
I = imread('002.png');
img2(:,:,1)=I;
img2(:,:,2)=I;
img2(:,:,3)=I;
imshow(label2rgb(I, @jet, [.0 .0 .0]))
hold on
for k = 1:length(B)
boundary = B{k};
plot(boundary(:,2), boundary(:,1), 'r', 'LineWidth', 1)
end

Respuesta aceptada

Matt J
Matt J el 1 de Oct. de 2021
Is this what you want?
I = imread('https://www.mathworks.com/matlabcentral/answers/uploaded_files/755699/001.png');
[B,L] = bwboundaries(I,'noholes');
I = imread('https://www.mathworks.com/matlabcentral/answers/uploaded_files/755704/002.png');
img2(:,:,1)=I;
img2(:,:,2)=I;
img2(:,:,3)=I;
imshow(I)
hold on
for k = 1:length(B)
boundary = B{k};
plot(boundary(:,2), boundary(:,1), 'r', 'LineWidth', 1)
end

Más respuestas (0)

Categorías

Más información sobre Image Segmentation and Analysis en Help Center y File Exchange.

Productos


Versión

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by