MATLAB: How to add labels in an image

image analysisimage processingMATLABMATLAB and Simulink Student Suite

Hello
I want to add labels that represents the color blue is water the color green is the tree and the color red is rock
here is the code as well as the attached images "
And thank you in advance
imgs(2) = load('C1fig.mat');
imgs(1) = load('C2fig.mat');
imgs(3) = load('C3fig.mat');
img = cat(3, imgs.ans);
imshow(img)

Best Answer

hh(1) = line(nan, nan, 'color', 'b')
same for the other two colors into hh 2 and hh 3
legend(hh,{'water','tree','rock'})