PNG image created in Matlab shows up as all black in imshow
25 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Megan
el 9 de Dic. de 2013
Comentada: Oliver Woodford
el 10 de Dic. de 2013
Hello,
I wrote some Matlab code that deBayers an image and writes the new RGB image out as a 3 x 16-bit png file:
imwrite(deBayeredImage, outputFileName, 'png', 'Bitdepth', 16);
Although the values are encoded as 16-bit, the actual range of values is 12-bit (ie, 0-4095).
If I load the image using A = imread('image.png'), the values appear reasonable. However, if I try to display the file using imshow (imshow(A) or imshow('image.png'), the display is all black, even though clicking on pixels in the figure shows the RGB values.
I thought that maybe I needed to reset the scale, but imshow(A, [0 4095]) does not change the all-black display.
Any idea what is going on?
0 comentarios
Respuesta aceptada
Oliver Woodford
el 9 de Dic. de 2013
If you read the imshow help text, you'll see that the range only applies to grayscale images. Try:
imshow(double(A)/4095);
or
imdisp(A, [0 4095]);
2 comentarios
Oliver Woodford
el 10 de Dic. de 2013
Yes. Because a png is an image file. The image array is not a png.
Más respuestas (0)
Ver también
Categorías
Más información sobre Image Processing Toolbox en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!