Thread Subject: image import struct

Subject: image import struct

From: Jeroen

Date: 5 Nov, 2009 11:55:03

Message: 1 of 5

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

Subject: image import struct

From: ImageAnalyst

Date: 5 Nov, 2009 13:14:54

Message: 2 of 5

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.

Subject: image import struct

From: Jeroen

Date: 5 Nov, 2009 13:55:22

Message: 3 of 5

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

Subject: image import struct

From: Ashish Uthama

Date: 5 Nov, 2009 14:11:25

Message: 4 of 5

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.

Subject: image import struct

From: Jeroen

Date: 5 Nov, 2009 15:17:03

Message: 5 of 5

"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

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com