Wolfram 언어

계산 사진학

이미지의 메타 데이터를 통한 여행 분석

사진과 메타 데이터를 사용하여 포르투갈 리스본의 도보 투어를 시각화하고 분석하는 지리 계산을 할 수 있습니다.

리스본 여행 중에 찍은 사진을 가져와 분석합니다.

In[1]:=
Click for copyable input
files = Map[ img \[Function] ExampleData[img, "FilePath"], ExampleData[{"TestImageSet", "Lisbon2016"}] ];

연상에 필요한 모든 정보를 모아봅니다.

In[2]:=
Click for copyable input
labels = {"Thumbnail", "DateTime", "GeoPosition"};
In[3]:=
Click for copyable input
dataSet = Dataset@Map[ file \[Function] AssociationThread[ labels -> Import[file, {labels}, IncludeMetaInformation -> False]], files ]
Out[3]=

사진을 찍은 장소를 시각화합니다.

In[4]:=
Click for copyable input
gps = dataSet[[All, "GeoPosition"]]; GeoGraphics[GeoMarker@gps, GeoRangePadding -> Quantity[100, "Meters"]]
Out[4]=

모든 사진을 찍고 돌아갈 때까지의 보행 거리를 계산합니다.

In[5]:=
Click for copyable input
closeLoop = path \[Function] Append[path, First[path]];
In[6]:=
Click for copyable input
sortedGPS = closeLoop@ Normal@dataSet[SortBy["DateTime"], Take[#GeoPosition, All, 2] &]; UnitConvert[ TravelDistance[sortedGPS, TravelMethod -> "Walking"], "Kilometers"]
Out[6]=

시간의 순서대로 모든 사진을 찍은 경로를 시각화합니다.

In[7]:=
Click for copyable input
travel = TravelDirections[sortedGPS, TravelMethod -> "Walking"]
Out[8]=
In[9]:=
Click for copyable input
Animate[ GeoGraphics[{ Style[Normal@travel["Dataset"][1 ;; n, "Path"], Thick, Red], dataSet[All, GeoMarker[Take[#GeoPosition, All, 2], #Thumbnail] &]}, GeoRangePadding -> Quantity[200, "Meters"] ], {n, 1, Length[travel["Dataset"]] + 1, 1} ]
동영상 작동
동영상 정지

대체할 수 있는 최단 경로를 계산하고 시각화합니다.

In[10]:=
Click for copyable input
optimalPath = FindShortestTour[Normal@sortedGPS, DistanceFunction -> (QuantityMagnitude[ TravelDistance[{#1, #2}, TravelMethod -> "Walking"], "Kilometer"] &)]
Out[10]=
In[11]:=
Click for copyable input
Quantity[First@optimalPath, "Kilometers"]
Out[11]=
In[12]:=
Click for copyable input
shortestGPS = sortedGPS[[Last@optimalPath]];
In[13]:=
Click for copyable input
shortestTravel = TravelDirections[shortestGPS, TravelMethod -> "Walking"]
Out[14]=
In[15]:=
Click for copyable input
Animate[ GeoGraphics[{ Style[Normal@shortestTravel["Dataset"][1 ;; n, "Path"], Thick, Blue], dataSet[All, GeoMarker[Take[#GeoPosition, All, 2], #Thumbnail] &]}, GeoRangePadding -> Quantity[200, "Meters"] ], {n, 1, Length[shortestTravel["Dataset"]] + 1, 1} ]
동영상 작동
동영상 정지

관련 예제

de en es fr ja pt-br ru zh