Filter löschen
Filter löschen

intersection the red edges of the mask to a grayscale image

2 Ansichten (letzte 30 Tage)
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

Akzeptierte Antwort

Matt J
Matt J am 1 Okt. 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

Weitere Antworten (0)

Produkte


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by