Place an image on the XY plane in a 3D Plot in Mathematica
Asked Answered
Z

1

8

Please consider the following, from the followings from

Can we generate "foveated Image" in Mathematica

Clear[acuity];

acuity[distance_, x_, y_, blindspotradius_] :=

 With[{\[Theta] = ArcTan[distance, Sqrt[x^2 + y^2]]},
      Clip[(Chop@Exp[-Abs[\[Theta]]/(15. Degree)] - .05)/.95, 
                     {0,1}] (1.-Boole[(x + 100.)^2 + y^2 <= blindspotradius^2])]

Plot3D[acuity[250., x, y, 9], {x, -256, 256}, {y, -256, 256}, 
PlotRange -> All, Axes -> False, PlotPoints -> 40, 
ExclusionsStyle -> Automatic, Boxed -> False, Mesh -> None]

enter image description here

How could I add the photo below on the X & Y plane. Then have the surface plotted transparent. Is it possible ? (image obtained with a solution in the question mentioned above).

enter image description here

Zootomy answered 7/10, 2011 at 21:57 Comment(3)
I saw that photo before ... it was taken by a famous photographer ... what was his name?Apparently
Henri Cartier Bresson, "Seville" 1933 :-)Zootomy
@belisarius : google.com/… . To me only Alex Webb matched his talent for composition adding color ! : google.com/…Zootomy
A
10
i = Import["https://i.sstatic.net/0EizO.png"];
p = {{0, 0}, {1, 0}, {1, 1}, {0, 1}};
Show@{
  Plot3D[
   acuity[250., x, y, 9], {x, -256, 256}, {y, -256, 256},
   PlotRange -> All, PlotPoints -> 40,ExclusionsStyle -> Automatic,Axes -> False,
   Boxed -> False,   Mesh -> None,    PlotStyle -> Directive[Opacity[0.5]]],
  Graphics3D[{Texture[i],
    Polygon[Join[#, {0}] & /@ (2 p - 1) 256,   VertexTextureCoordinates -> p]}
  ]}

enter image description here

Edit

Dealing with AspectRatio[], as requested in your comments:

p = {{0, 0}, {1, 0}, {1, 1}, {0, 1}};
r = First@#/Last@# &@Dimensions@ImageData@i;
a = 1.4;
Show@{Plot3D[
         acuity[250., a x, a y, 9], {x, -256  , 256 }, {y, -256 r , 256 r }, 
          PlotRange -> All, PlotPoints -> 40, ExclusionsStyle -> Automatic, 
          Axes -> False, Boxed -> False, Mesh -> None, 
          PlotStyle -> Directive[Opacity[0.5]], AspectRatio -> r], 
  Graphics3D[{Texture[i], 
             Polygon[{{-256 , -256 r, 0}, { 256 , -256 r , 0}, 
                      { 256 ,  256 r, 0}, {-256 ,  256 r, 0}}, 
             VertexTextureCoordinates -> p]}]}

enter image description here

Apparently answered 7/10, 2011 at 23:17 Comment(6)
thank you again. in you first version, is there anyway to plot over the picture ratio ? I can`t figure out the PlotRange in 3D Plot :-(Zootomy
@Zootomy I am not sure what do you mean by "plot over the picture ratio". Please rephrase. :)Apparently
thank you. I can actually rephrase : What I want is the XY plane to have the ratio of the image, 3/2 for example.Zootomy
@Perfect thank you. Let`s wait a little bit, but this is definitely solving my problem and will make my article rather very sweet :-)Zootomy
@Zootomy you can "avoid" the bumps changing the scale in the acuity function for the plot. Something like Plot3D[acuity[250.,xa, ya, ..] whith a>1.Apparently
@Zootomy I modified the code in the last example to fit your requirementApparently

© 2022 - 2024 — McMap. All rights reserved.