How to change pixels to a different colour with a greyscale image?

1 回表示 (過去 30 日間)
Anon
Anon 2020 年 2 月 3 日
回答済み: Tom Holz 2020 年 2 月 3 日
Hi everyone,
I want to change all the pixels with the intensity less than 8000 to the colour red. However, I am struggling with this as the image is greyscale and not sure how to change this. As I want to clearly differentiate the metal clip from the tissue and to make sure that no pixels of the tissue are being identified with the metal clip. The metal clip in the image uploaded can be seen as the thick black line within the tube connected to the tissue.

採用された回答

Tom Holz
Tom Holz 2020 年 2 月 3 日
Here's a hacky approach that does the job:
I = imread('CTimagem.png');
mask = I < 8000;
Ired = I;
Igreen = I;
Iblue = I;
Ired(mask) = max(I, [], 'all');
Igreen(mask) = 0;
Iblue(mask) = 0;
img = cat(3, Ired, Igreen, Iblue);
figure
imagesc(img)

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImages についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by