Thread Subject: Plot an image and rotate it in 3d?

Subject: Plot an image and rotate it in 3d?

From: David Doria

Date: 27 Sep, 2007 13:42:40

Message: 1 of 5

I would like to have a surface in a 3d plot that is an
image, is this possible? For example I want to show a 3d
line passing through a 3d plane and intersecting at a
particular point in an image (like from a camera)

does that make sense?

Thanks,

David

Subject: Plot an image and rotate it in 3d?

From: Randy Poe

Date: 27 Sep, 2007 14:45:38

Message: 2 of 5

On Sep 27, 9:42 am, "David Doria" <daviddo...@gmail.com> wrote:
> I would like to have a surface in a 3d plot that is an
> image, is this possible? For example I want to show a 3d
> line passing through a 3d plane and intersecting at a
> particular point in an image (like from a camera)
>
> does that make sense?
>
> Thanks,
>
> David

Yes. Unfortunately, HELP IMAGE says this.

" The image object will not render at axes View angles other than
    [0 90]. To get a similar effect to rotating an image, use SURF
    with texture mapping or PCOLOR."

So I tried this little experiment:

   h=image;
   figure;g=surf(get(h,'Cdata'))

That turns the image data into Z-data. Rotate it and you'll
see the original image, but with the default color map.
Let's fix the colormap and get rid of the grid lines:

   colormap('gray')
   set(g, 'edgecolor', 'none')

and make the image a lot flatter:
   set(g, 'zdata', get(g, 'zdata') * .001)

Now a test line:
   hold on
   h1=line([0 30],[0 30],[50 -50]);
   set(h1, 'linewidth', 3)
   set(gca,'view',[-60 40])

Not perfect since the image isn't actually a flat
object, but hopefully approximates what you wanted.

             - Randy

Subject: Plot an image and rotate it in 3d?

From: Randy Poe

Date: 27 Sep, 2007 14:47:39

Message: 3 of 5

On Sep 27, 9:42 am, "David Doria" <daviddo...@gmail.com> wrote:
> I would like to have a surface in a 3d plot that is an
> image, is this possible? For example I want to show a 3d
> line passing through a 3d plane and intersecting at a
> particular point in an image (like from a camera)
>
> does that make sense?
>

By the way, I expect the real answer is to do exactly
what the HELP for IMAGE said, which was to use "SURF
with texture mapping or PCOLOR". However, I'm not familiar
with those, so I just did an ordinary surface with height-based
coloring, which I'm comfortable manipulating.

                - Randy

Subject: Plot an image and rotate it in 3d?

From: Michael Garrity

Date: 28 Sep, 2007 13:48:53

Message: 4 of 5


"Randy Poe" <poespam-trap@yahoo.com> wrote in message news:1190904459.761081.170430@19g2000hsx.googlegroups.com...
> On Sep 27, 9:42 am, "David Doria" <daviddo...@gmail.com> wrote:
>> I would like to have a surface in a 3d plot that is an
>> image, is this possible? For example I want to show a 3d
>> line passing through a 3d plane and intersecting at a
>> particular point in an image (like from a camera)
>>
>> does that make sense?
>>
>
> By the way, I expect the real answer is to do exactly
> what the HELP for IMAGE said, which was to use "SURF
> with texture mapping or PCOLOR". However, I'm not familiar
> with those, so I just did an ordinary surface with height-based
> coloring, which I'm comfortable manipulating.
>
> - Randy
>
It would look something like this:

surface('xdata',[0 1],'ydata',[0 1],'zdata',zeros(2),'cdata',img,'facecolor','texturemap','edgecolor','none')

You'll need to fiddle the X & Y data to match your aspect ratio.

    -MPG-


Subject: Plot an image and rotate it in 3d?

From: haidar master

Date: 4 Jul, 2009 07:58:01

Message: 5 of 5

Please, can you help me?

I want to plot any Image in 3-d like Lena.bmp... can you write to me the code in matlab for drow the image in 3-d?

with my best regards

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
plot image Sprinceana 4 Jul, 2009 08:01:06
rotate Sprinceana 4 Jul, 2009 08:01:06
rotate in 3d Sprinceana 4 Jul, 2009 08:01:06
image rotate Sprinceana 4 Jul, 2009 08:01:06
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