从Unity中的图像EXIF纬度/经度 [英] EXIF lat/long from image in Unity
问题描述
我需要一个c#脚本以便可以从照片中读取EXIF纬度/经度数据.我想在该位置放置posTransform.不知道在Unity中是否可行.我想将我的图像加载成一个整体,并让脚本读取EXIF:从照片中获取1-GPS纬度/经度,2-旋转,3-时间戳.我还没有找到任何可以在统一内完成此操作的信息,但是,我已经了解了exiflib github项目以及统一以外的其他方式.
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.
预先感谢您的帮助
推荐答案
我维护了一个用于从图像中提取元数据的项目,该项目将为您提供所需的内容.
I maintain a project for extracting metadata from images that will give you what you need.
https://github.com/drewnoakes/metadata-extractor-dotnet
该库支持.NET 3.5,因此应该可以在Unity下工作,尽管我之前没有对其进行测试.
The library supports .NET 3.5 so should work under Unity, though I haven't tested it before.
有了它,你会写:
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}");
}
这篇关于从Unity中的图像EXIF纬度/经度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!