Accessing Multiple images in 4D array

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!

 Accepted Answer

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 Comments

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

Sign in to comment.

More Answers (0)

Products

Release

R2014a

Community Treasure Hunt

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

Start Hunting!