Wolfram 언어

이미지 처리 및 신호 처리

국가의 형태 비교

CanonicalWarpingDistance를 사용하여 여러 국가의 형태 유사도를 구합니다.

In[1]:=
Click for copyable input
names = {"USA", "Poland", "Portugal", "Vietnam", "Brazil", "Finland"}; borders = <|# -> ArrayResample[CountryData[#, "Polygon"][[1, 1, 1]], 200] & /@ names|>;
In[2]:=
Click for copyable input
shapes = Graphics[CountryData[#, "Shape"][[1]], ImageSize -> {50, 50}] & /@ Keys[borders]
Out[2]=

표준 타임 랩핑을 사용하여 형상의 거리를 계산합니다.

In[3]:=
Click for copyable input
dm = DistanceMatrix[Values[borders], DistanceFunction -> (Chop[ CanonicalWarpingDistance[##, MaxIterations -> 6]] &)];

거리 행렬을 표시합니다.

In[4]:=
Click for copyable input
MatrixPlot[dm, FrameTicks -> {{MapIndexed[{#2[[1]], #1} &, shapes], None}, {MapIndexed[{#2[[1]], Rotate[#1, \[Pi]/4]} &, names], None}}, Mesh -> True, ColorFunction -> "BlueGreenYellow", PlotLegends -> Automatic, PlotLabel -> "Distance based on country shape", ImageSize -> Medium]
Out[4]=

관련 예제

de en es fr ja pt-br ru zh