4

Anyone know about, programmatically how to add Google photo sphere XMP meta data to an equirectangular(360) image? or how to remove and add new photo sphere XMP meta data to an equirectangular(360) image?

Here's the example:

<rdf:Description rdf:about="" xmlns:GPano="http://ns.google.com/photos/1.0/panorama/">
    <GPano:UsePanoramaViewer>True</GPano:UsePanoramaViewer>
    <GPano:CaptureSoftware>Photo Sphere</GPano:CaptureSoftware>
    <GPano:StitchingSoftware>Photo Sphere</GPano:StitchingSoftware>
    <GPano:ProjectionType>equirectangular</GPano:ProjectionType>
    <GPano:PoseHeadingDegrees>350.0</GPano:PoseHeadingDegrees>
    <GPano:InitialViewHeadingDegrees>90.0</GPano:InitialViewHeadingDegrees>
    <GPano:InitialViewPitchDegrees>0.0</GPano:InitialViewPitchDegrees>
    <GPano:InitialViewRollDegrees>0.0</GPano:InitialViewRollDegrees>
    <GPano:InitialHorizontalFOVDegrees>75.0</GPano:InitialHorizontalFOVDegrees>
    <GPano:CroppedAreaLeftPixels>0</GPano:CroppedAreaLeftPixels>
    <GPano:CroppedAreaTopPixels>0</GPano:CroppedAreaTopPixels>
    <GPano:CroppedAreaImageWidthPixels>4000</GPano:CroppedAreaImageWidthPixels>
    <GPano:CroppedAreaImageHeightPixels>2000</GPano:CroppedAreaImageHeightPixels>
    <GPano:FullPanoWidthPixels>4000</GPano:FullPanoWidthPixels>
    <GPano:FullPanoHeightPixels>2000</GPano:FullPanoHeightPixels>
    <GPano:FirstPhotoDate>2012-11-07T21:03:13.465Z</GPano:FirstPhotoDate>
    <GPano:LastPhotoDate>2012-11-07T21:04:10.897Z</GPano:LastPhotoDate>
    <GPano:SourcePhotosCount>50</GPano:SourcePhotosCount>
    <GPano:ExposureLockUsed>False</GPano:ExposureLockUsed>
</rdf:Description>
Menu
  • 677
  • 1
  • 12
  • 30

2 Answers2

1

use ExifTool https://www.sno.phy.queensu.ca/~phil/exiftool/ after installing it on cpanel using Perl you can add metadata by entering commands like

exiftool -XMP-GPano:ProjectionType='equirectangular' /public_html/panos/image_name.jpg

  • ProjectionType tag is not enough, a dozen of further tags are needed; and anyway exiftool does not work, it erroneously add "description" tags for each namespace. – jumpjack Aug 27 '21 at 17:53
1

Exiftool is known as NOT working in injecting Google Photosphere XMP metadata into JPG files, probably because it erroneously create a "description" tag per each namespace.

Possibly Exiv2 can do the trick, but I didn't test it yet.

Alternatively you can programmatically call program equiToVr180Photo.exe from VR180PhotoTools suite to properly create a cardboard-compatible image.

This command takes a top-bottom equirectangular image and converts it into cardboard format:

equiToVr180Photo.exe -f tb -i immagine-top-bottom.jpg -o cardboard.vr.jpg  

Here you can find the C# source code: https://github.com/Vargol/VR180PhotoTools

Look at line 99 of file equiToVR180Photo.cs :

 string xmpMetadata = jpegFile.GetXmpMetadata(jpegs.GetRightEye.Width, jpegs.GetRightEye.Height, widthDegrees, heightDegrees, extendedMd5Hash);

 // insert the xmp in the jpeg..
 jpegFile.WriteVr180Jpeg(jpegs, xmpMetadata, extendedMd5Hash, extendedXmpXml, outJpeg);

GetXmpMetadata() actually does not "get", it "creates" all the needed XMP metadata which are then written to jpg file by jpegFile.WriteVr180Jpeg()

jumpjack
  • 841
  • 1
  • 11
  • 17