HI so im changing the color of the image to green and blue but its not working one of them gives an error and the other gives a red color
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Respuesta aceptada
DGM
el 12 de Dic. de 2022
Editada: DGM
el 12 de Dic. de 2022
What is the size of app.Image? If it's not MxNx3, then you'll have to find out why it's not.
For example, it's possible that app.Image started out as MxNx1. If you then tried to operate on it with the blueButton CBF, then it would be implicitly expanded to MxNx2.
My guess is that you're working with single channel (MxNx1) images and that this is your problem. If so, you'll have to provide all the missing channels when you expand it to a color image.
% a single-channel image
Agray = imread('cameraman.tif'); % mxnx1
% generate simple colorized copies by concatenation
zerochan = zeros(size(Agray),class(Agray)); % blank channel
Ared = cat(3,Agray,zerochan,zerochan);
Agreen = cat(3,zerochan,Agray,zerochan);
Ablue = cat(3,zerochan,zerochan,Agray);
montage({Ared Agreen Ablue},'size',[1 3])
Alternatively, you could do the same thing by channel insertion.
% generate simple colorized copies by channel insertion
Ared = zeros([size(Agray,1) size(Agray,2) 3],class(Agray)); % blank image
Ared(:,:,1) = Agray;
% ... and so on
See also:
Más respuestas (1)
Image Analyst
el 12 de Dic. de 2022
See attached demos for changing one color into another.
0 comentarios
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!