8

请考虑以下内容,来自以下内容

我们可以在 Mathematica 中生成“foveated Image”吗

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]

在此处输入图像描述

我怎样才能在 X & Y 平面上添加下面的照片。然后将表面绘制成透明的。是否可以 ?(通过上述问题的解决方案获得的图像)。

在此处输入图像描述

4

1 回答 1

10
i = Import["http://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]}
  ]}

在此处输入图像描述

编辑

根据您的评论要求处理 AspectRatio[]:

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

在此处输入图像描述

于 2011-10-07T23:17:35.543 回答