Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
saving images

Subject: saving images

From: Jessica

Date: 19 Jun, 2008 02:53:01

Message: 1 of 6

I am displaying images (.bmp) with the imshow command. I
then am trying to save the images with the saveas command.
However, when I open up the saved images, their color is
altered and not as it is in the origianl image. For
example, an image showing a Caucasian person's face has a
somwhat pinkish blotched tint to the saved image. Is it
possible to save the images as they appeared originally?

Thanks!!

Subject: saving images

From: Devdatt Lad

Date: 19 Jun, 2008 13:22:59

Message: 2 of 6

Jessica wrote:
> I am displaying images (.bmp) with the imshow command. I
> then am trying to save the images with the saveas command.
> However, when I open up the saved images, their color is
> altered and not as it is in the origianl image. For
> example, an image showing a Caucasian person's face has a
> somwhat pinkish blotched tint to the saved image. Is it
> possible to save the images as they appeared originally?
>
> Thanks!!

Try using the function IMWRITE.

--
Devdatt Lad
The MathWorks, Inc.

Subject: saving images

From: Jessica

Date: 19 Jun, 2008 15:50:20

Message: 3 of 6

Devdatt Lad <Devdatt.Lad@mathworks.com> wrote in message
<g3dmjj$66j$1@fred.mathworks.com>...
> Jessica wrote:
> > I am displaying images (.bmp) with the imshow command. I
> > then am trying to save the images with the saveas command.
> > However, when I open up the saved images, their color is
> > altered and not as it is in the origianl image. For
> > example, an image showing a Caucasian person's face has a
> > somwhat pinkish blotched tint to the saved image. Is it
> > possible to save the images as they appeared originally?
> >
> > Thanks!!
>
> Try using the function IMWRITE.
>
> --
> Devdatt Lad
> The MathWorks, Inc.


Thanks for the suggestion.

IMWRITE doesn't actually work for me because I am first
displaying an image, overlaying points atop of it, and
saving the final product. Unless I use imshow, I only end up
saving an image with the points. This is my code:

a=imshow('F_01.bmp'); %Show the original image
hold on
h=scatter(x,y,'.k'),a; %X and Y are a list of coordinates

saveas(h,'F_01_HeatMap.bmp') %Saves image with coordinates
           
                             atop of it

Subject: saving images

From: Devdatt Lad

Date: 19 Jun, 2008 20:24:00

Message: 4 of 6

Jessica wrote:
> IMWRITE doesn't actually work for me because I am first
> displaying an image, overlaying points atop of it, and
> saving the final product. Unless I use imshow, I only end up
> saving an image with the points. This is my code:
>
> a=imshow('F_01.bmp'); %Show the original image
> hold on
> h=scatter(x,y,'.k'),a; %X and Y are a list of coordinates
>
> saveas(h,'F_01_HeatMap.bmp') %Saves image with coordinates
>
> atop of it

I see. Then try,

print -dbmp F_01_HeatMap.bmp

instead of your SAVEAS command. Does it give better results?

Devdatt

--
Devdatt Lad
The MathWorks, Inc.

Subject: saving images

From: Jessica

Date: 19 Jun, 2008 22:37:01

Message: 5 of 6

Devdatt Lad <Devdatt.Lad@mathworks.com> wrote in message
<g3ef90$2uq$1@fred.mathworks.com>...
> Jessica wrote:
> > IMWRITE doesn't actually work for me because I am first
> > displaying an image, overlaying points atop of it, and
> > saving the final product. Unless I use imshow, I only end up
> > saving an image with the points. This is my code:
> >
> > a=imshow('F_01.bmp'); %Show the original image
> > hold on
> > h=scatter(x,y,'.k'),a; %X and Y are a list of coordinates
> >
> > saveas(h,'F_01_HeatMap.bmp') %Saves image with coordinates
> >
> > atop of it
>
> I see. Then try,
>
> print -dbmp F_01_HeatMap.bmp
>
> instead of your SAVEAS command. Does it give better results?
>
> Devdatt
>
> --
> Devdatt Lad
> The MathWorks, Inc.


Yes, the colors are now true to the original image.
However,the resolution of the new image is less than the
original one. Maybe this can't be helped.

Also, would you have any ideas about making the x-y
coordinates displayed as a heat map atop the image rather
than as single points?

Subject: saving images

From: Devdatt Lad

Date: 20 Jun, 2008 14:16:35

Message: 6 of 6

Jessica wrote:
> Yes, the colors are now true to the original image.
> However,the resolution of the new image is less than the
> original one. Maybe this can't be helped.
>
> Also, would you have any ideas about making the x-y
> coordinates displayed as a heat map atop the image rather
> than as single points?

A heat map is a 3D data set that contains a position (x, y) and a heat
value (z) which can be used to color the map accordingly. A high z can
be colored more red and a low z can be blue/green etc. You only have 2D
data so I don't know how you can create a heat map out of it.

Once you get the 3D data, check out the function COLORMAP. The "jet"
colormap looks like it could be used to color a heat map.

--
Devdatt Lad
The MathWorks, Inc.

Tags for this Thread

No tags are associated with this thread.

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.

Contact us