フィルターのクリア

intersection the red edges of the mask to a grayscale image

4 ビュー (過去 30 日間)
Meriem YOUss
Meriem YOUss 2021 年 10 月 1 日
コメント済み: Meriem YOUss 2021 年 10 月 1 日
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

採用された回答

Matt J
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
  1 件のコメント
Meriem YOUss
Meriem YOUss 2021 年 10 月 1 日
Yes, this is what I needed. Thank you so much

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImage Segmentation and Analysis についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by