I have multiple images stored in a 4D array (width*height*RGB*number of images). Now I want to access each image and display them viz,
imshow(image(:,:,:,1))
should show the first image. But it is not happening as expected and a complete white image is displayed, however, the matrix (image(:,:,:,1)) has different color values. Any suggestion to display the images or to represent the images in some different format so as to display them is highly appreciated. Thank You!

 Akzeptierte Antwort

Ameer Hamza
Ameer Hamza am 1 Jun. 2018

3 Stimmen

It appears that your matrix has double class. imshow gives assumes 1 to the maximum intensity if the matrix type is double. To properly display using imshow() try
imshow(uint8(image(:,:,:,1)))
or
imshow(image(:,:,:,1)/255)

3 Kommentare

Ayushi Solanki
Ayushi Solanki am 4 Jun. 2018
Yes! It worked for me. Thank you so much!
Ameer Hamza
Ameer Hamza am 4 Jun. 2018
You are welcome.
Rather then changing the input data you can simply tell imshow what the data range is:
imshow(image(:,:,:,1),[0,255])

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Produkte

Version

R2014a

Community Treasure Hunt

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

Start Hunting!

Translated by