Displaying 3d matrix as image

30 views
Skip to first unread message

Arun Mallya

unread,
Sep 19, 2012, 7:57:55 PM9/19/12
to cs498-...@googlegroups.com
Hi,

I have a 3d matrix (the output texture) which I want to interpret as RGB channels and display it as an image.

imshow(image) displays a white image
imagesc() gives out of range error
imshow(mat2gray()) gives the proper image but with colors distorted as compared to original sample texture image.

I checked the values in the output texture image and they correspond to those in the input texture image. Still, it cannot be displayed.

What do I do !?

Xing Li

unread,
Sep 19, 2012, 8:02:00 PM9/19/12
to cs498-...@googlegroups.com
try abs(cat(3, im(:,:,1), im(:,:,2), im(:,:,3)));
then, use imshow again?
Not sure, you can have a try
> --
>
>



--
Xing Li
University of Illinois - Urbana Champaign
College of Electrical and Computer Engineering

Arun Mallya

unread,
Sep 19, 2012, 8:03:12 PM9/19/12
to cs498-...@googlegroups.com
Nope, I found the reason.

You have to typecast the matrix to uint8, uint16, or the like.

out = uint8(out);

Ut now works.
Reply all
Reply to author
Forward
0 new messages