EXIF lat/long from image in Unity

匿名 (未验证) 提交于 2019-12-03 09:14:57

问题:

I need a c# script for unity that can read the EXIF lat/long data from a photo. i would like to place a posTransform at that location. not sure if this is possible within Unity. i would like to load my images into unity and have a script read the EXIF: 1-GPS lat/long, 2-rotation, 3-timestamp from photographs. i haven't found any info that says this can be done within unity, however, i've read about exiflib github project and other ways outside of unity.

THANKS in advance for help

回答1:

I maintain a project for extracting metadata from images that will give you what you need.

https://github.com/drewnoakes/metadata-extractor-dotnet

The library supports .NET 3.5 so should work under Unity, though I haven't tested it before.

With it, you would write:

var directories = ImageMetadataReader.ReadMetadata(filePath); var gpsDirectory = directories.OfType<GpsDirectory>().FirstOrDefault(); if (gpsDirectory != null) {     var location = gpsDirectory.GetGeoLocation();      Console.WriteLine($"Photo was taken at {location.Latitude},{location.Longitude}"); } 


标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!