how to create a black image?

15 visualizaciones (últimos 30 días)
Jia Yu
Jia Yu el 8 de Dic. de 2018
Comentada: Jia Yu el 11 de Dic. de 2018
how can i create a black image, not a gray one?

Respuesta aceptada

Cris LaPierre
Cris LaPierre el 8 de Dic. de 2018
Editada: Cris LaPierre el 8 de Dic. de 2018
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 comentarios
Image Analyst
Image Analyst el 8 de Dic. de 2018
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 el 11 de Dic. de 2018
thanks!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre White en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by