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!

 採用された回答

Ameer Hamza
Ameer Hamza 2018 年 6 月 1 日

3 投票

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 件のコメント

Ayushi Solanki
Ayushi Solanki 2018 年 6 月 4 日
Yes! It worked for me. Thank you so much!
Ameer Hamza
Ameer Hamza 2018 年 6 月 4 日
You are welcome.
Stephen23
Stephen23 2018 年 6 月 4 日
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