the color on image segmented
3 次查看(过去 30 天)
显示 更早的评论
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
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/248948/image.jpeg)
回答(1 个)
Image Analyst
2019-11-19
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.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Red 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!