0

I want to plot a round png picture with alpha-channel in 3D plot. I'm searching for three days without success... I need help!

THANKS! - dwn

dwn
  • 21
  • 1
  • 1
  • 1
    Could you elaborate on what exactly you want to do? You have a png image, presumably with the alpha channel defining the 'roundness', then you want to plot it in 3D... What do you mean by this? – Bill Cheatham Aug 26 '11 at 12:57
  • 1
    Related/Possible duplicate: [How can I plot an image (.jpg) in MATLAB in both 2-D and 3-D?](http://stackoverflow.com/q/3719502/52738) – gnovice Aug 26 '11 at 16:17

1 Answers1

3

The simplest way is to create a surface with a texture map. You'd do something like this:

surface(1:2, 1:2, zeros(2), img, ...
        'FaceColor','texturemap','EdgeColor','none');

What's going on here is that those 1:2 arguments are the X & Y coordinates of the corners of your 3D image. The zeros(2) argument is the Z coordinates of your 3D image. You can put different values in there to move the image around in 3D, but you want to create a surface with 4 vertices.

The img argument is your color data. Setting the FaceColor property to texturemap tells the surface to paste the texture onto the surface you created. The last bit just turns off the border.

MPG
  • 835
  • 4
  • 10