我想使用元数据提取器从360张照片中读取GPano XMP数据。我正在使用Ricoh Theta S的照片作为我的测试图像,我在XmpDirectory中收到错误。
“处理XMP数据时出错:不支持的编码”
我的代码很基本,
var dirs = ImageMetadataReader.ReadMetadata(filePath);
var xmpDir = dirs.OfType<XmpDirectory>().FirstOrDefault();
if (xmpDir?.XmpMeta != null)
{
foreach (var property in xmpDir.XmpMeta.Properties)
Console.WriteLine($"Path={property.Path} Namespace={property.Namespace} Value={property.Value}");
}
但是XmpMeta总是为空。如果我在XmpDirectory中使用调试器查看,则错误在_errorsList中。
我知道图像有我要访问的XMP数据,如果我在记事本++中打开图像字节,我可以用明文定位数据。
<x:xmpmeta xmlns:x="adobe:ns:meta/" xmptk="RICOH THETA S Ver1.62">
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about="" xmlns:GPano="http://ns.google.com/photos/1.0/panorama/">
<GPano:ProjectionType>equirectangular</GPano:ProjectionType>
<GPano:UsePanoramaViewer>True</GPano:UsePanoramaViewer>
<GPano:CroppedAreaImageWidthPixels>5376</GPano:CroppedAreaImageWidthPixels>
<GPano:CroppedAreaImageHeightPixels>2688</GPano:CroppedAreaImageHeightPixels>
<GPano:FullPanoWidthPixels>5376</GPano:FullPanoWidthPixels>
<GPano:FullPanoHeightPixels>2688</GPano:FullPanoHeightPixels>
<GPano:CroppedAreaLeftPixels>0</GPano:CroppedAreaLeftPixels>
<GPano:CroppedAreaTopPixels>0</GPano:CroppedAreaTopPixels>
<GPano:PoseHeadingDegrees>157.5</GPano:PoseHeadingDegrees>
<GPano:PosePitchDegrees>3.9</GPano:PosePitchDegrees>
<GPano:PoseRollDegrees>-11.5</GPano:PoseRollDegrees>
</rdf:Description>
</rdf:RDF>
</x:xmpmeta>
我正在使用nuget的Metadata-Extractor 2.0.0。