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

Community
  • 1
  • 1
500
  • 6,509
  • 8
  • 46
  • 80
  • I saw that photo before ... it was taken by a famous photographer ... what was his name? – Dr. belisarius Oct 08 '11 at 04:53
  • 1
    Henri Cartier Bresson, "Seville" 1933 :-) – 500 Oct 08 '11 at 11:17
  • 1
    @belisarius : http://www.google.com/search?q=Cartier+bresson&hl=en&biw=1920&bih=1092&prmd=imvnsb&tbm=isch&tbo=u&source=univ&sa=X&ei=KXCQTub_O8bw0gGYvrxW&ved=0CEwQsAQ . To me only Alex Webb matched his talent for composition adding color ! : http://www.google.com/search?q=i+alex+webb&um=1&ie=UTF-8&hl=en&tbm=isch&source=og&sa=N&tab=wi&biw=1920&bih=1092 – 500 Oct 08 '11 at 15:47

1 Answers1

10
i = Import["https://i.stack.imgur.com/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

Dr. belisarius
  • 60,527
  • 15
  • 115
  • 190
  • 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 :-( – 500 Oct 08 '11 at 13:25
  • @500 I am not sure what do you mean by "plot over the picture ratio". Please rephrase. :) – Dr. belisarius Oct 08 '11 at 15:49
  • thank you. I can actually rephrase : What I want is the XY plane to have the ratio of the image, 3/2 for example. – 500 Oct 08 '11 at 15:55
  • @Perfect thank you. Let`s wait a little bit, but this is definitely solving my problem and will make my article rather very sweet :-) – 500 Oct 08 '11 at 16:30
  • @500 you can "avoid" the bumps changing the scale in the acuity function for the plot. Something like Plot3D[acuity[250.,x*a, y*a, ..] whith a>1. – Dr. belisarius Oct 08 '11 at 19:37
  • @500 I modified the code in the last example to fit your requirement – Dr. belisarius Oct 08 '11 at 19:48