Wolfram言語

計算写真学

美術館を推薦

旅行写真のメタデータの地理情報を分析することで,同じ地域にある,例えば美術館のような観光スポットを推薦する.

In[1]:=
Click for copyable input
files = Map[img \[Function] ExampleData[img, "FilePath"], ExampleData[{"TestImageSet", "Oxford2011"}]]; geopos = Map[file \[Function] Import[file, "GeoPosition"], files];

写真を撮ったすべての場所の重心を計算する.

In[2]:=
Click for copyable input
geodata = GeoPosition[{Mean@geopos[[ All, 1, 1]], Mean@geopos[[All, 1, 2]], Mean@Cases[geopos, GeoPosition[{_, _, h_}] :> h]}]
Out[2]=

最も近い美術館を求める.

In[3]:=
Click for copyable input
entMus = Quiet[First@GeoNearest["Museum", geodata]];
In[4]:=
Click for copyable input
geoMus = Quiet[FindGeoLocation@entMus];

美術館についての情報を取得し,タイプセットする.

In[5]:=
Click for copyable input
mus = EntityValue[entMus, EntityProperty["Museum", "Name"]]; type = EntityValue[entMus, EntityProperty["Museum", "MuseumTypes"]]; about = WikipediaData[mus, "SummaryPlaintext"]; description = TextGrid[{ {Style["MUSEUM TO VISIT", 15], SpanFromLeft}, {Style["Name:", Bold], mus}, {Style["Types:", Bold], StringTake[ToString[type], {2, -2}]}, {Style["About:", Bold], about} }, ItemSize -> {{4, 30}, Automatic}]
Out[5]=

この美術館の情報を周辺の地図上にツールチップとして可視化する.

In[6]:=
Click for copyable input
tooltip = Tooltip[GeoMarker[geoMus, Entity["Icon", "Museum"]], description];
In[7]:=
Click for copyable input
GeoGraphics[{Thick, Red, GeoDisk[geodata, Quantity[1000, "Meters"]], tooltip}, "GeoRange" -> 1500, ImageSize -> Medium]
Out[7]=

関連する例

de en es fr ko pt-br ru zh