<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/156823</link>
    <title>MATLAB Central Newsreader - Plot an image and rotate it in 3d?</title>
    <description>Feed for thread: Plot an image and rotate it in 3d?</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Thu, 27 Sep 2007 13:42:40 -0400</pubDate>
      <title>Plot an image and rotate it in 3d?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/156823#394200</link>
      <author>David Doria</author>
      <description>I would like to have a surface in a 3d plot that is an&lt;br&gt;
image, is this possible?  For example I want to show a 3d&lt;br&gt;
line passing through a 3d plane and intersecting at a&lt;br&gt;
particular point in an image (like from a camera)&lt;br&gt;
&lt;br&gt;
does that make sense?&lt;br&gt;
&lt;br&gt;
Thanks,&lt;br&gt;
&lt;br&gt;
David</description>
    </item>
    <item>
      <pubDate>Thu, 27 Sep 2007 14:45:38 -0400</pubDate>
      <title>Re: Plot an image and rotate it in 3d?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/156823#394223</link>
      <author> Randy Poe</author>
      <description>On Sep 27, 9:42 am, &quot;David Doria&quot; &amp;lt;daviddo...@gmail.com&amp;gt; wrote:&lt;br&gt;
&amp;gt; I would like to have a surface in a 3d plot that is an&lt;br&gt;
&amp;gt; image, is this possible?  For example I want to show a 3d&lt;br&gt;
&amp;gt; line passing through a 3d plane and intersecting at a&lt;br&gt;
&amp;gt; particular point in an image (like from a camera)&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; does that make sense?&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Thanks,&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; David&lt;br&gt;
&lt;br&gt;
Yes. Unfortunately, HELP IMAGE says this.&lt;br&gt;
&lt;br&gt;
&quot;    The image object will not render at axes View angles other than&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;[0 90].  To get a similar effect to rotating an image, use SURF&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;with texture mapping or PCOLOR.&quot;&lt;br&gt;
&lt;br&gt;
So I tried this little experiment:&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;h=image;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;figure;g=surf(get(h,'Cdata'))&lt;br&gt;
&lt;br&gt;
That turns the image data into Z-data. Rotate it and you'll&lt;br&gt;
see the original image, but with the default color map.&lt;br&gt;
Let's fix the colormap and get rid of the grid lines:&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;colormap('gray')&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;set(g, 'edgecolor', 'none')&lt;br&gt;
&lt;br&gt;
and make the image a lot flatter:&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;set(g, 'zdata', get(g, 'zdata') * .001)&lt;br&gt;
&lt;br&gt;
Now a test line:&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;hold on&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;h1=line([0 30],[0 30],[50 -50]);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;set(h1, 'linewidth', 3)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;set(gca,'view',[-60 40])&lt;br&gt;
&lt;br&gt;
Not perfect since the image isn't actually a flat&lt;br&gt;
object, but hopefully approximates what you wanted.&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;- Randy</description>
    </item>
    <item>
      <pubDate>Thu, 27 Sep 2007 14:47:39 -0400</pubDate>
      <title>Re: Plot an image and rotate it in 3d?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/156823#394224</link>
      <author> Randy Poe</author>
      <description>On Sep 27, 9:42 am, &quot;David Doria&quot; &amp;lt;daviddo...@gmail.com&amp;gt; wrote:&lt;br&gt;
&amp;gt; I would like to have a surface in a 3d plot that is an&lt;br&gt;
&amp;gt; image, is this possible?  For example I want to show a 3d&lt;br&gt;
&amp;gt; line passing through a 3d plane and intersecting at a&lt;br&gt;
&amp;gt; particular point in an image (like from a camera)&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; does that make sense?&lt;br&gt;
&amp;gt;&lt;br&gt;
&lt;br&gt;
By the way, I expect the real answer is to do exactly&lt;br&gt;
what the HELP for IMAGE said, which was to use &quot;SURF&lt;br&gt;
with texture mapping or PCOLOR&quot;. However, I'm not familiar&lt;br&gt;
with those, so I just did an ordinary surface with height-based&lt;br&gt;
coloring, which I'm comfortable manipulating.&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;- Randy</description>
    </item>
    <item>
      <pubDate>Fri, 28 Sep 2007 13:48:53 -0400</pubDate>
      <title>Re: Plot an image and rotate it in 3d?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/156823#394374</link>
      <author>Michael Garrity</author>
      <description>&lt;br&gt;
&quot;Randy Poe&quot; &amp;lt;poespam-trap@yahoo.com&amp;gt; wrote in message news:1190904459.761081.170430@19g2000hsx.googlegroups.com...&lt;br&gt;
&amp;gt; On Sep 27, 9:42 am, &quot;David Doria&quot; &amp;lt;daviddo...@gmail.com&amp;gt; wrote:&lt;br&gt;
&amp;gt;&amp;gt; I would like to have a surface in a 3d plot that is an&lt;br&gt;
&amp;gt;&amp;gt; image, is this possible?  For example I want to show a 3d&lt;br&gt;
&amp;gt;&amp;gt; line passing through a 3d plane and intersecting at a&lt;br&gt;
&amp;gt;&amp;gt; particular point in an image (like from a camera)&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; does that make sense?&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; By the way, I expect the real answer is to do exactly&lt;br&gt;
&amp;gt; what the HELP for IMAGE said, which was to use &quot;SURF&lt;br&gt;
&amp;gt; with texture mapping or PCOLOR&quot;. However, I'm not familiar&lt;br&gt;
&amp;gt; with those, so I just did an ordinary surface with height-based&lt;br&gt;
&amp;gt; coloring, which I'm comfortable manipulating.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;                - Randy&lt;br&gt;
&amp;gt;&lt;br&gt;
It would look something like this:&lt;br&gt;
&lt;br&gt;
surface('xdata',[0 1],'ydata',[0 1],'zdata',zeros(2),'cdata',img,'facecolor','texturemap','edgecolor','none')&lt;br&gt;
&lt;br&gt;
You'll need to fiddle the X &amp; Y data to match your aspect ratio.&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;-MPG-</description>
    </item>
    <item>
      <pubDate>Sat, 04 Jul 2009 07:58:01 -0400</pubDate>
      <title>Re: Plot an image and rotate it in 3d?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/156823#662574</link>
      <author>haidar master</author>
      <description>Please, can you help me?&lt;br&gt;
&lt;br&gt;
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?&lt;br&gt;
&lt;br&gt;
with my best regards</description>
    </item>
  </channel>
</rss>

