Value range of grayscale image not being correct?

Hi, I used following script to convert a cmyk image into rgb and then convert it into grayscale, but after this I got a array with all values being either 35 or 37, not 0 or 1.
I think that grayscale image should generate array with values being either 0 or 1, right?
How can get final array with values in the range [0,1]?
clear all, close all clc I_cmyk=imread('jetflow.tiff'); C=makecform('cmyk2srgb'); I_rgb=applycform(I_cmyk,C); I_gray=rgb2gray(I_rgb);
Plus: after I use imread function to load the tiff image, it generated a 1280x800x4 uint8 array, which should be cmyk format, so I used the following 3 lines of commands.
Thank you.

 Accepted Answer

They're probably in the range 0-255. If it's a uint8 image, they they almost certainly are in that range.

2 Comments

Thank you for your help. If so, when should the values of the grayscale image be within the range of [0,1]?
Thanks.
When you want to deal with an image in that range, which I never do. It's just confusing to me so I don't. I always use the original range, even when it gets converted to double.

Sign in to comment.

More Answers (0)

Categories

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

Asked:

zy
on 30 May 2014

Commented:

on 30 May 2014

Community Treasure Hunt

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

Start Hunting!