Hi , just started programming in MATLAB and I have a question.

Image files can be written as RGB/GRAYSCALE/INDEXED and more types,
from what I saw in MATLAB you can read an image by using imread() function
the only difference is what it returns.

[img,MAP] or img
how do I know which one I have to use for each image?

I do know about the imfinfo function and how to get the ColorType

so it's more of an Image question than MATLAB.

thanks,
Despairy

this is what i have so far

if (strcmp(type,'indexed'))
        [x,MAP]=imread(imgFile);
        img=ind2gray(x,MAP); 
    else
        img=imread(imgFile); %reads the image
        if (strcmp(type,'truecolor'))
            img=rgb2gray(imgGet); 
        end
end

its all inside a try/catch function
and it wont throw anything , so i guess its good, but is it enough?

another thing if i load a jpg image i get another image from the same folder
any explanation? O_o

thanks again

edit: the other thing thing... was my mistake for declaring a global variable , it mixed up things, so only the first question remains

EDIT : having a problem reading TIF images , [x,MAP] & img wont read it appropriately

Not so sure what you want to do. Anyway, have you read this Matlab page about reading image? It also talks about tiff image format as well.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.