gkv311 / sview

Stereoscopic media player
GNU General Public License v3.0
96 stars 34 forks source link

Read GPano:ProjectionType "equirectangular" tag within JPEG's XMP metadata #69

Closed gkv311 closed 4 years ago

gkv311 commented 4 years ago

It is desired reading Photo Sphere XMP Metadata encoded into JPEG photos to automatically enable panorama mode: https://developers.google.com/streetview/spherical-metadata

Note, that there is also an extension packaging stereoscopic pair in form of base64 blob within XMP, but this is another story: https://developers.google.com/vr/reference/cardboard-camera-vr-photo-format

WitnessSquare-v1

XMP samples:

<?xml version="1.0" encoding="UTF-8"?>
<?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Ansel">
  <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
    <rdf:Description xmlns:GPano="http://ns.google.com/photos/1.0/panorama/" xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
      <GPano:UsePanoramaViewer>True</GPano:UsePanoramaViewer>
      <GPano:ProjectionType>equirectangular</GPano:ProjectionType>
      <GPano:CroppedAreaLeftPixels>0</GPano:CroppedAreaLeftPixels>
      <GPano:CroppedAreaTopPixels>0</GPano:CroppedAreaTopPixels>
      <GPano:CroppedAreaImageWidthPixels>8192</GPano:CroppedAreaImageWidthPixels>
      <GPano:CroppedAreaImageHeightPixels>4096</GPano:CroppedAreaImageHeightPixels>
      <GPano:FullPanoWidthPixels>8192</GPano:FullPanoWidthPixels>
      <GPano:FullPanoHeightPixels>4096</GPano:FullPanoHeightPixels>
    </rdf:Description>
  </rdf:RDF>
</x:xmpmeta>
<?xpacket end="w"?>

Another one:

<?xml version="1.0" encoding="UTF-8"?>
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 5.6-c138 79.159824, 2016/09/14-01:09:01        ">
  <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
    <rdf:Description xmlns:GPano="http://ns.google.com/photos/1.0/panorama/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:photoshop="http://ns.adobe.com/photoshop/1.0/" xmlns:stEvt="http://ns.adobe.com/xap/1.0/sType/ResourceEvent#" xmlns:xmp="http://ns.adobe.com/xap/1.0/" xmlns:xmpMM="http://ns.adobe.com/xap/1.0/mm/" rdf:about="" GPano:UsePanoramaViewer="True" GPano:ProjectionType="equirectangular" GPano:CroppedAreaLeftPixels="0" GPano:CroppedAreaTopPixels="0" GPano:CroppedAreaImageWidthPixels="8192" GPano:CroppedAreaImageHeightPixels="4096" GPano:FullPanoWidthPixels="8192" GPano:FullPanoHeightPixels="4096" xmp:CreatorTool="Unreal Engine Demo" xmp:CreateDate="2017-02-02T14:48:12-05:00" xmp:ModifyDate="2017-02-02T18:00:36-05:00" xmp:MetadataDate="2017-02-02T18:00:36-05:00" xmpMM:DocumentID="3928D3182528B7981355EF2FA96DEE36" xmpMM:InstanceID="xmp.iid:7658693f-1b3d-4543-aee7-73372e766d16" xmpMM:OriginalDocumentID="3928D3182528B7981355EF2FA96DEE36" dc:format="image/jpeg" photoshop:ColorMode="3" photoshop:ICCProfile="">
      <xmpMM:History>
        <rdf:Seq>
          <rdf:li stEvt:action="saved" stEvt:instanceID="xmp.iid:7658693f-1b3d-4543-aee7-73372e766d16" stEvt:when="2017-02-02T18:00:36-05:00" stEvt:softwareAgent="Adobe Photoshop CC 2017 (Windows)" stEvt:changed="/" />
        </rdf:Seq>
      </xmpMM:History>
    </rdf:Description>
  </rdf:RDF>
</x:xmpmeta>
<?xpacket end="w"?>
gkv311 commented 4 years ago

Feature has been pushed to master.