Distinguishing ROI within an image with a different color

9 ビュー (過去 30 日間)
Warid Islam
Warid Islam 2021 年 5 月 3 日
コメント済み: Warid Islam 2021 年 5 月 3 日
I have a image named as TM10.jpg. After segmentation, the result is displayed as i2.jpg. I am trying to fuse those images together where I would like to highlight the result in the fused image with a separate color. The fused image is displayed in i1.jpg. I want to display the brightest region in the center by a green color. I came up with a solution shown in i3.jpg. Here, the background is completely black. I want the center to be green and the background color as similar as in i1.jpg Any suggestion would be very much appreciated.
I=imread('TM10.jpg');
J=imread('i2.jpg');
figure,imshow(J)
I=RemoveWhiteSpace(I);
figure,imshow(I)
J=RemoveWhiteSpace(J);
figure,imshow(J)
[rowsI colsI numberOfColorChannelsI]=size(I);
[rowsJ colsJ numberOfColorChannelsJ]=size(J);
if rowsJ ~= rowsI || colsI ~= colsJ
J = imresize(J, [rowsI colsI]);
end
% If it's grayscale, convert to color
if numberOfColorChannelsI < 3
I = cat(3, I, I, I);
else
% It's really an RGB image already.
I = I;
end
% If it's grayscale, convert to color
if numberOfColorChannelsJ < 3
J = cat(3, J, J, J);
else
% It's really an RGB image already.
J = J;
end
J = uint8(J * 256);
% Specify the color we want to make this area.
redChannel = J(:, :, 1);
greenChannel = J(:, :, 2);
blueChannel = J(:, :, 3);
allBlack = zeros(size(J, 1), size(J, 2), 'uint8');
just_red = cat(3, redChannel, allBlack, allBlack);
figure,imshow(just_red)
C = imfuse(I,just_red,'falsecolor','Scaling','joint','ColorChannels',[1 2 0]);
imshow(C)

採用された回答

Image Analyst
Image Analyst 2021 年 5 月 3 日
  1 件のコメント
Warid Islam
Warid Islam 2021 年 5 月 3 日
It worked. I have another issue. The result is shown in s.jpg. It can be seen that there is a blue border on the right and left side of the image. Is there any way to remove those?

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

その他の回答 (0 件)

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by