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.
Rather then changing the input data you can simply tell imshow what the data range is:
imshow(image(:,:,:,1),[0,255])

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

제품

릴리스

R2014a

질문:

2018년 6월 1일

댓글:

2018년 6월 4일

Community Treasure Hunt

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

Start Hunting!

Translated by