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:
Contourf + imshow

Subject: Contourf + imshow

From: K. P.

Date: 17 Nov, 2009 08:17:05

Message: 1 of 5

Welcome ...

I have a small problem with using the functions imshow (or image) and contourf. I would like to view the image (img) and put down on it the chart contourf matrix (M x N). However, the function Contourf is one color and I can't get the effect heatmaps

figure
image (img);
hold on;
contourf (I);

What can I do? Any hint?

Subject: Contourf + imshow

From: ImageAnalyst

Date: 17 Nov, 2009 11:17:03

Message: 2 of 5

On Nov 17, 3:17 am, "K. P." <kapie...@gmail.com> wrote:
> Welcome ...
>
> I have a small problem with using the functions imshow (or image) and contourf. I would like to view the image (img) and put down on it the chart contourf matrix (M x N). However, the function Contourf is one color and I can't get the effect heatmaps
>
> figure
> image (img);
> hold on;
> contourf (I);
>
> What can I do? Any hint?

--------------------------------
Are img and I the same size?
Are you sure img is not an rgb image? If so, can't have a colormap on
the image, but I'm not sure if you can have a colormap for contour
lines over an rgb image - I'd have to look it up and try it.
Did you look into the colormap() function?
Maybe image() take a colormap as an argument.

Subject: Contourf + imshow

From: K. P.

Date: 17 Nov, 2009 14:54:03

Message: 3 of 5

> Are img and I the same size?
> Are you sure img is not an rgb image? If so, can't have a colormap on
> the image, but I'm not sure if you can have a colormap for contour
> lines over an rgb image - I'd have to look it up and try it.
> Did you look into the colormap() function?
> Maybe image() take a colormap as an argument.

Yes, img ang matrix I are the same size.
I tried image RGB and image BW - without effects
And yes, I used colormap function:

image(img);
hold on;
contourf(I);
colormap(hot);

Also without effects :/

Subject: Contourf + imshow

From: Thomas Clark

Date: 17 Nov, 2009 17:08:20

Message: 4 of 5

Is the image normalised in the same way as I?

Often you have an image varying between 0 and 255 (say, for an 8 bit grayscale) and actual data varying between 0 and 1. If that were the case, all your contours could show up the same colour when the colormap is applied.

Just a guess!

Tom

"K. P." <kapieren@gmail.com> wrote in message <hdudeb$rnu$1@fred.mathworks.com>...
> > Are img and I the same size?
> > Are you sure img is not an rgb image? If so, can't have a colormap on
> > the image, but I'm not sure if you can have a colormap for contour
> > lines over an rgb image - I'd have to look it up and try it.
> > Did you look into the colormap() function?
> > Maybe image() take a colormap as an argument.
>
> Yes, img ang matrix I are the same size.
> I tried image RGB and image BW - without effects
> And yes, I used colormap function:
>
> image(img);
> hold on;
> contourf(I);
> colormap(hot);
>
> Also without effects :/

Subject: Contourf + imshow

From: K. P.

Date: 17 Nov, 2009 19:47:20

Message: 5 of 5

"Thomas Clark" <t.clark@remove.spamcantab.net> wrote in message <hdula3$k15$1@fred.mathworks.com>...
> Is the image normalised in the same way as I?

YES! You're right! :) I forgot normalised variables. Now it's ok!

Thanks a lot! :)

Tags for 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