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!

 采纳的回答

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 个评论

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

请先登录,再进行评论。

更多回答(0 个)

产品

版本

R2014a

Community Treasure Hunt

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

Start Hunting!

Translated by