Why does 'implay' or 'imshow' display a blank image for my matrix image data?
11 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
MathWorks Support Team
el 22 de Mayo de 2019
Comentada: Walter Roberson
el 22 de En. de 2021
I have black and white image data that is stored in a matrix, 'img'. When I execute the following commands, I can see the image in black and white:
imagesc(img);
colormap(gray);
However, when I try to display the image using 'imshow' or view a sequence of similar images using 'implay', all I see is a white image. Why can't I see the image data?
Respuesta aceptada
MathWorks Support Team
el 13 de Jun. de 2019
Try checking the range of your image data. 'imshow' and 'implay' will use a default display range for the data based on the data type. For example, if 'img' is an single or double type, then the display range is [0,1], where 0 maps to black and 1 maps to white. If 'img' is an integer type, the default display range will be the minimum and maximum representable values for that integer class. As an example, a uint16 array would have the range [0,65535].
If your data falls outside of the default range, you need to convert it. If you are using 'imshow', you can do so by specifying the 'DisplayRange' parameter. However, 'implay' does not have a parameter to adjust the display range so you will need to convert the matrix to a grayscale image. You can do so using 'mat2gray' and specifying the 'amin' and 'amax' parameters.
0 comentarios
Más respuestas (1)
michael scheinfeild
el 22 de En. de 2021
frame = video(:,:,:,1);
mx = max(frame(:))
implay(video/mx)
1 comentario
Walter Roberson
el 22 de En. de 2021
mx = max(video, [], 'all')
would be better.
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!