从图像到网格
版本 11 引入了 ImageMesh 函数来把二维和三维图像转换为网格.
获取大盐湖的图像及通过区域生长所得的分割.
In[1]:=
orig = EntityValue[Entity["Lake", "GreatSaltLake::yw8cf"], "Image"];
img = RegionBinarize[orig, \!\(\*
GraphicsBox[
TagBox[RasterBox[CompressedData["
1:eJzt1jEKwkAQQNFdK0uv4C1sLW0VD6AYxSZCFMRzCJ7XiF3SzFb7lf8ggUCK
D8MmM99f1sdJSuk67W/r3X3ZdbvHZtY/bNvr+dQ2h1V7a05Nt9h/Xnv21ytJ
kiRJkiRJkn5H7tVuGLMqzqo4q+KsiuNW8bKsimNWfbNwXVbF5Yzuqp0xZFUB
dBaui5kF/T5AsxJ1jNAsq0qgs3BlOSPDMrMLmvUBDcNnsbqov2x4FrWrdscA
NIu6SjCzoEOEZlGniF5Ta0eMmVXCqjjmCJlV5KzaDWNWxXGreFnMKvAIazeM
MUfIXEmtKsCs8hSWsCrOqjhmlSRJkiRJkvS/3tRrD1M=
"], {{0, 147}, {150,
0}}, {0, 1},
ColorFunction->GrayLevel],
BoxForm`ImageTag["Bit", ColorSpace -> Automatic, Interleaving -> None],
Selectable->False],
DefaultBaseStyle->"ImageGraphics",
ImageSizeRaw->{150, 147},
PlotRange->{{0, 150}, {0, 147}}]\), 1/5];
GraphicsRow[{orig, img}]
Out[1]=
创建图像的二维网格.
In[2]:=
ImageMesh[img]
Out[2]=
获取一个发动机的三维图像.
In[3]:=
img = Import["ExampleData/CTengine.tiff", "Image3D"]
Out[3]=
创建该发动机的三维网格.
In[4]:=
ImageMesh[img]
Out[4]=