the color on image segmented

3 visualizzazioni (ultimi 30 giorni)
nur hanani
nur hanani il 19 Nov 2019
Risposto: Image Analyst il 19 Nov 2019
below is a part of my coding, i had try insert gray scale image and for figure 2 it produce the image below,
i want to ask where it state about the color produce in figure 2
%Show the results
ifsize(im, 3)==1 % Gray-level image
img=zeros(sz(1),sz(2));
j=1;
imagesc(im); axis off; hold on; colormap gray;
fori=0:k_max-1
LL=(L_global_min==i);
is_zero=sum(sum(LL));
if is_zero
img(:,:,1)=img(:,:,1)+LL*c(j,1);
j=j+1;
end
if i~=i_ground
color=[rand rand rand];
contour(LL,[1 1],'LineWidth',2.5,'Color',color); hold on;
end
end
figure(2);
imagesc(img); axis off;
end

Risposte (1)

Image Analyst
Image Analyst il 19 Nov 2019
imagesc() applies it's own crazy idea of how it thinks you want the image pseudocolored, and it's almost always wrong. I suggest you don't use it -- I never do. Use imshow() instead. If you want a colormap, pick one of your own choosing with the colormap() function.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by