Distinguishing ROI within an image with a different color

조회 수: 3 (최근 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