Thread Subject: convert imagesc/contour to surf

Subject: convert imagesc/contour to surf

From: Rajesh Acharya

Date: 17 Jun, 2009 12:07:01

Message: 1 of 3

hey..

I want to get a surface and/or mesh plot from an existing imagesc or contour plot of a variable.

I tried this...
 While in a matlab figure window i am having an image or a contour. Now, i check the 'Figure Pallete' box where i can add additional 2D or 3D plots/subplots. here i am not able to convert the current variable into a surf plot or a mesh plot. When i add a 3D plot and 'Add data' by right clicking the newly formed empty axes box it asks for 'z axis'. This requires a 'valid expression'. I guess it is asking for the 'variable' to plot but i am not sure how to give it what it wants. what expression would be correct in that window.
Am i right in my approach??

It sounds so simple yet very annoying...

Subject: convert imagesc/contour to surf

From: Adeel

Date: 21 Jul, 2009 04:01:19

Message: 2 of 3

"Rajesh Acharya" <rv_acharya@yahoo.com> wrote in message <h1am95$i8m$1@fred.mathworks.com>...
> hey..
>
> I want to get a surface and/or mesh plot from an existing imagesc or contour plot of a variable.
>
> I tried this...
> While in a matlab figure window i am having an image or a contour. Now, i check the 'Figure Pallete' box where i can add additional 2D or 3D plots/subplots. here i am not able to convert the current variable into a surf plot or a mesh plot. When i add a 3D plot and 'Add data' by right clicking the newly formed empty axes box it asks for 'z axis'. This requires a 'valid expression'. I guess it is asking for the 'variable' to plot but i am not sure how to give it what it wants. what expression would be correct in that window.
> Am i right in my approach??
>
> It sounds so simple yet very annoying...

you can think of an image as an table of values. the rows are the x values, coloums are y values and the values are the z axis values (if the iame is in gray scale, if it is colour image convert it to gray scale by rgb2gray.

Subject: convert imagesc/contour to surf

From: Adeel

Date: 21 Jul, 2009 04:25:03

Message: 3 of 3

"Adeel " <neoresearcher@gmail.com> wrote in message <h43eif$88o$1@fred.mathworks.com>...
> "Rajesh Acharya" <rv_acharya@yahoo.com> wrote in message <h1am95$i8m$1@fred.mathworks.com>...
> > hey..
> >
> > I want to get a surface and/or mesh plot from an existing imagesc or contour plot of a variable.
> >
> > I tried this...
> > While in a matlab figure window i am having an image or a contour. Now, i check the 'Figure Pallete' box where i can add additional 2D or 3D plots/subplots. here i am not able to convert the current variable into a surf plot or a mesh plot. When i add a 3D plot and 'Add data' by right clicking the newly formed empty axes box it asks for 'z axis'. This requires a 'valid expression'. I guess it is asking for the 'variable' to plot but i am not sure how to give it what it wants. what expression would be correct in that window.
> > Am i right in my approach??
> >
> > It sounds so simple yet very annoying...
>
> you can think of an image as an table of values. the rows are the x values, coloums are y values and the values are the z axis values (if the iame is in gray scale, if it is colour image convert it to gray scale by rgb2gray.

the most easy solution to yours problem is

img = imread('10.jpg'); imshow(img)
img2 = rgb2gray(img); img2 = im2double(img2);
surf(img2); figure(gcf)

Tags for this Thread

Everyone's Tags:

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.

Tag Activity for This Thread
Tag Applied By Date/Time
figure Rajesh Acharya 17 Jun, 2009 08:09:02
imagesc Rajesh Acharya 17 Jun, 2009 08:09:02
surf Rajesh Acharya 17 Jun, 2009 08:09:02
contour Rajesh Acharya 17 Jun, 2009 08:09:02
rssFeed for this Thread

Contact us at files@mathworks.com