图像处理基础问题,求解答。

조회 수: 19 (최근 30일)
ungytpx
ungytpx 2023년 5월 25일
답변: uqtdsmcn 2023년 5월 25일
代码如下:只是简单的图像灰度化及显示
x=imread('秋之柱号.jpg');
I=rgb2gray(x);
set(0,'defaultFigurePosition',[200,200,1000,500]);
set(0,'defaultFigureColor',[1 1 1]);
set(gcf, 'InvertHardCopy', 'off');
BW1=im2bw(I,0.45);
BW2=im2bw(I,0.6);
subplot(221),imshow(BW1);
subplot(222),image(BW2);
subplot(223),image([80,100],[90,170],x);
subplot(224),imagesc(I,[10,150]);
但是显示出来的灰度图像为什么会带颜色?
谢谢

채택된 답변

uqtdsmcn
uqtdsmcn 2023년 5월 25일
浅析image,imagesc,imshow的用法https://blog.csdn.net/zhupananhui/article/details/16340345
这个很正常,一些函数默认是有彩色或者伪彩色的,如果想要变成灰度,可以更换colormap,在语句后加上
subplot(222),image(BW2);
colormap(gray)
subplot(223),image([80,100],[90,170],x);
subplot(224),imagesc(I,[10,150]);
colormap(gray)

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Detection에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!