I wish to add the colors to the legends as per the rgb values of the corresponding color in the image. The image can be displayed using the code written below:
x1=ones(30); x2=2*ones(30); x3=3*ones(30);x=[x1,x2,x3];y1=zeros(30,90); y2=zeros(30,90); y3=zeros(30,90); y=zeros(30,90,3);y1(x==1)=0; y2(x==1)=77; y3(x==1)=26;y1(x==2)=102; y2(x==2)=255; y3(x==2)=102;y1(x==3)=204; y2(x==3)=102; y3(x==3)=0;y(:,:,1)=y1; y(:,:,2)=y2; y(:,:,3)=y3;imshow(uint8(y))
Best Answer