Thread Subject: Display an image in a 3d plot

Subject: Display an image in a 3d plot

From: David Doria

Date: 15 Oct, 2008 18:13:02

Message: 1 of 5

I was looking to make a demo of perspective projection, so I would like to move an image along the principal axis of a camera and resize it based on the focal length, and show how a 3d point gets projected along a ray. I saw this thread:

http://www.mathworks.com/matlabcentral/newsreader/view_thread/155794

But it uses pcolor - so it would have to be a data set like 'clown', not an actual image. Is there no way to show something that you might show with imshow() but on a specific plane in 3d?

Thanks,
Dave

Subject: Display an image in a 3d plot

From: Walter Roberson

Date: 15 Oct, 2008 19:34:20

Message: 2 of 5

David Doria wrote:

> Is there no way to show something that you might show with imshow() but on a specific plane in 3d?

No. image objects cannot have Z components.

Try this instead:

surf(Z*ones(size(TheImage)),TheImage,'EdgeColor','none')

where Z is the constant Z that you want for the image.

Subject: Display an image in a 3d plot

From: Kenneth Eaton

Date: 15 Oct, 2008 19:48:02

Message: 3 of 5

You can also make a surface with a texture-mapped image:

surface('XData',[0 1; 0 1],'YData',[0 0; 1 1],...
        'ZData',[1 1; 1 1],'CData',flipdim(imageData,1),...
        'FaceColor','texturemap','EdgeColor','none');

where imageData is the image you want to display. You would just adjust the 'ZData' property of the surface to move it.

Ken

Subject: Display an image in a 3d plot

From: David Doria

Date: 15 Oct, 2008 20:03:02

Message: 4 of 5

-------------
With the first method:

Z=5;
I = imread('ImagePlane.jpg');
surf(Z*ones(size(I)), I,'EdgeColor','none')

I get
Warning: Matrix dimensions must agree, not rendering mesh

-----------

Ken, perfect - that looks exactly like what I was looking for - I'll mess with it more and report back.

Dave

Subject: Display an image in a 3d plot

From: Alexandro McQuillan

Date: 28 Apr, 2011 23:30:08

Message: 5 of 5

"David Doria" <daviddoria@gmail.com> wrote in message <gd5i9m$5j3$1@fred.mathworks.com>...
> -------------
> With the first method:
>
> Z=5;
> I = imread('ImagePlane.jpg');
> surf(Z*ones(size(I)), I,'EdgeColor','none')
>
> I get
> Warning: Matrix dimensions must agree, not rendering mesh
>
> -----------
>
> Ken, perfect - that looks exactly like what I was looking for - I'll mess with it more and report back.
>
> Dave


Dave,

I'm also trying to import a tif image plane in 3D space. How did you resolve the matrix dimension mismatch issue?

Thanks,
Alex

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

Contact us at files@mathworks.com