Converting an image with size of [X, Y, 3, double] to another image with size of [X, Y, 3, uint8]

1 view (last 30 days)
I have an image with size [X, Y, 3, double] and I need to convert this image to another image with same size but uint8 type data i.e the size will be [X, Y, 3, uint8]. I Can anyone help me?

Answers (1)

Matt Tearle
Matt Tearle on 18 Mar 2011
Assuming the double image has values between 0 and 1,
A2 = uint8(255*A1);
  4 Comments
Walter Roberson
Walter Roberson on 28 Mar 2011
If you read in an image and it is two dimensional, then unless it is a gray-scale image, it has an associated color map. To convert gray-scale images to equivalent RGB, easiest probably what Sean de showed; to convert pseudocolor images to rgb images, you use ind2rgb() specifying the image and the colormap to lock in.

Sign in to comment.

Categories

Find more on Convert Image Type in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!