在 Mathematica 的 3D 绘图中将图像放置在 XY 平面上

发布于 2024-12-08 15:28:17 字数 866 浏览 1 评论 0原文

请考虑以下内容,来自

我们可以在 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 平面。然后将表面绘制为透明。 是否可以 ? (通过上述问题的解决方案获得的图像)。

在此处输入图像描述

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

£噩梦荏苒 2024-12-15 15:28:17
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]}
  ]}

在此处输入图像描述

编辑

按照评论中的要求处理 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]}]}

在此处输入图像描述

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文