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 4

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 4

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 4

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 4

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

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
 

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