how can i create a black image, not a gray one?

 채택된 답변

Cris LaPierre
Cris LaPierre 2018년 12월 8일
편집: Cris LaPierre 2018년 12월 8일

0 개 추천

Can you use imshow?
If you have to use imagesc, keep in mind that an image has to have values for R, G and B for each pixel. That means you matrix needs to be 256x64x3.
Try using imagesc with this
img=zeros(256,64,3,'uint8');

댓글 수: 3

Jia Yu
Jia Yu 2018년 12월 8일
thank you so much!
You can also create a gray scale image, rather than an RGB color image if you do
img = zeros(256, 64, 'uint8');
Also note that imagesc() does not require a color image. You can pass it a grayscale image. However it, for some weird reason, pseudocolors it. To turn off the colormap, you can apply a colormap of all grays:
grayImage = imread('cameraman.tif'); % Read in a gray scale image.
imagesc(grayImage); % Display it with a funky colormap
colormap(gray(256)); % Turn the colormap off by making it normal gray.
Jia Yu
Jia Yu 2018년 12월 11일
thanks!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 White에 대해 자세히 알아보기

태그

질문:

2018년 12월 8일

댓글:

2018년 12월 11일

Community Treasure Hunt

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

Start Hunting!

Translated by