Distinguishing ROI within an image with a different color
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Warid Islam
el 3 de Mayo de 2021
Comentada: Warid Islam
el 3 de Mayo de 2021
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)
0 comentarios
Respuesta aceptada
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!