I'm currently trying to paint part of my image (a river) yellow but the end result is not only the river being yellow but a large yellow square right next to the image. Orginally the image is in grayscale so I've used cat() to concatenate my grayscale image (and apparently "turn" it into an RGB image?) but I'm still not sure what is actually going wrong.
originalIM_River = imread('fig_lista4_2.bmp');figure,title('Original image'),imshow(originalIM_River)imRGB_River = cat(3, originalIM_River, originalIM_River, originalIM_River);[nLine, nColum] = size(originalIM_River); % Correct
%[nLine, nColumn] = size(imRGB_River); %Incorrect
for i = 1 : nLine for j = 1 : nColumn if imRGB_River(i,j) <= 48 imRGB_River(i,j,:) = [255,255,0]; % (255,255,0) is yellow
end endendfigure, title('New imagem - River painted with yellow'),imshow(imRGB_River)
I've tried to get each of the channels, and tried to change the colors of it to concatenate but still didn't work.
Best Answer