フィルターのクリア

How can I overlay my binary gray image red?

1 回表示 (過去 30 日間)
Vishal Puppala
Vishal Puppala 2020 年 11 月 25 日
コメント済み: Vishal Puppala 2020 年 12 月 2 日
So my current script allows me to turn a binary gray image into something that is green in the foreground (the bone) and blue in the background. However, I'd like to be able to make the bone (the foreground) red? How should I edit my code to change this color transformation from green to red?
function output = grayoverlay(img)
rgb = imread(img)
imshow(rgb);
I=rgb2gray(rgb);
figure
image(I);
hold on
image(rgb,'AlphaData', .5)
  1 件のコメント
KALYAN ACHARJYA
KALYAN ACHARJYA 2020 年 11 月 25 日
編集済み: KALYAN ACHARJYA 2020 年 11 月 25 日
Please insert the code (NOT screenshot) in the question. To insert the code, edit, afterwards Alt+ Enter, or You can see the same icon on the upper panel in the text pad. Note: Also attach the origibal gray image.

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

回答 (1 件)

KALYAN ACHARJYA
KALYAN ACHARJYA 2020 年 11 月 25 日
編集済み: KALYAN ACHARJYA 2020 年 11 月 25 日
Generally, I prefer to set this way. Before applying the color, please adjut the piels condition or area to be color
Here, just for example I choosed gray pixels greater than 120, you may odify as per your requirements.
rgb = imread(......);
imshow(rgb);
I=rgb2gray(rgb);
r_comp= I;
r_comp(I>120)=255;
%........^ Gray pixel values condition
g_comp= I;
g_comp(I>110)=0;
b_comp=I;
b_comp(I>110)=0;
result=cat(3,r_comp,g_comp,b_comp);
image(result);
  1 件のコメント
Vishal Puppala
Vishal Puppala 2020 年 12 月 2 日
Thanks for your answer. Could you explain your code?

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

Community Treasure Hunt

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

Start Hunting!

Translated by