intersection the red edges of the mask to a grayscale image
2 ビュー (過去 30 日間)
古いコメントを表示
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
0 件のコメント
採用された回答
Matt J
2021 年 10 月 1 日
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
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Image Segmentation and Analysis についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!