Path: news.mathworks.com!not-for-mail
From: "Jeroen " <bincky@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: image import struct
Date: Thu, 5 Nov 2009 15:17:03 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 92
Message-ID: <hcuq9f$m47$1@fred.mathworks.com>
References: <hcueen$12c$1@fred.mathworks.com> <op.u2xdpb06a5ziv5@uthamaa.dhcp.mathworks.com>
Reply-To: "Jeroen " <bincky@gmail.com>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1257434223 22663 172.30.248.38 (5 Nov 2009 15:17:03 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 5 Nov 2009 15:17:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1785667
Xref: news.mathworks.com comp.soft-sys.matlab:582760


"Ashish Uthama" <first.last@mathworks.com> wrote in message <op.u2xdpb06a5ziv5@uthamaa.dhcp.mathworks.com>...
> On Thu, 05 Nov 2009 08:55:22 -0500, Jeroen  <bincky@gmail.com> wrote:
> 
> > ImageAnalyst <imageanalyst@mailinator.com> wrote in message  
> > <93efcec9-17cc-48db-82ca-3e3ce9348b9c@a31g2000yqn.googlegroups.com>...
> >> On Nov 5, 6:55?am, "Jeroen " <bin...@gmail.com> wrote:
> >> > Hi!
> >> >
> >> > When i import an image with uiimport matlab gives the error:
> >> > 'MAP must be a m x 3 array.'
> >> >
> >> > But I am sure it is an RGB image. The code that I use is:
> >> > meting = uiimport;
> >> > meting_grayscale = rgb2gray(meting); %naar een grayscale
> >> > meting_double = im2double(meting_grayscale); %naar een index
> >> >
> >> > And when I load an image it says in has the size 1024x1024x3. That is  
> >> an a m x 3array.
> >> >
> >> > Do i have to convert the import image? Or do I have to change some  
> >> settings? Or add another codeline? Or is it another the type of image?
> >> >
> >> > Thank you anyway!
> >> >
> >> > gr jeroen
> >>
> >> ---------------------------------------------------------------------------------------------------------------------
> >> True color RGB images are M x N x 3 and do not have a color map.
> >> Monochrome images are M x N and may or may not have a color map
> >> applied to them.
> >> If they use a color map, they are called "indexed images" by MATLAB
> >> and have a GL x 3 color map array where GL is the number of gray
> >> levels for that data type, for example 256 for uint8 images.
> >> So as you can see, with your color image, it makes no sense for it to
> >> talk about a colormap
> >> Hopefully that explanation will allow you to complete your work.
> >
> > Hi!
> >
> > Thank you. But that isn't what i ment.
> > For my project I have to compare 2 images. A reference and a imported  
> > image.
> > That import image is not the same image everytime.
> > When I import an image by myself with imread there is nothing wrong, it  
> > is an unit8 type. But when I import the same image with uiimport it is  
> > an struct type.
> > What is going wrong? Is the struct type the default value? Is there  
> > another way to import images without uiimport?
> >
> > thank you.
> >
> > gr jeroen
> 
> First, are you sure its UIIMPORT thats throwing the error message?
> Please study the entire stack on the error message. It might help if you  
> posted the full stack here too.
> 
> Second, you can use IMFINFO on the 'failing' image file to study the file  
> format and ensure that your code is equipped to handle that time of images.

Hi!

I'm sorry if it looks stupid but this is my first week with MATLAB.
But when i typ IMFINFO it says:
 Unable to open file "meting_import" for reading.
The whole code is below:

meting_import = uiimport;
meting_grayscale = rgb2gray(meting_import);
meting_double = im2double(meting_grayscale);
meting_absoluut = abs(meting_double - 1);
meting_resize = imresize(meting_double,inhoud); 
meting_x = meting_resize(:,512);
figure;plot(meting_x);
hold on;
plot(ref_x,'r');grid;

The error what i get is:
??? Error using ==> rgb2gray>parse_inputs at 82
MAP must be a m x 3 array.

Error in ==> rgb2gray at 35
X = parse_inputs(varargin{:});

Error in ==> import2 at 17
meting_grayscale = rgb2gray(meting_import);

So I think the error is in the rgb2gray, but i can't figure it how i can fix the error.

thank you.

gr jeroen