Modifying a non-standard XMP tag

Started by SimonK, December 04, 2024, 04:55:10 AM

Previous topic - Next topic

SimonK

Hi,

I have a special problem that I am sure can be solved using exiftool but my IT/programming skills end before I got it working.
A scaled down image with all metadata intact is attached.

Summary
I have drone images with a camera pitch value that needs to be corrected by adding 90 (degrees) to it. The XMP-tag that stores this information seems non-standard and I did not manage to manipulate it.

Longer story
One of our drones (Autel EVO MAX 4T) records the camera angles as -90° (nadir/stright down) to 0° (horizontal) but the software we use (Pix4D) expects 0° to +90°.
I can read the pitch value by using
exiftool -G1 -pitch C:\[...]\klein_MAX_1000.jpg
[XMP-Camera]    Pitch                           : -2.600000
Writing to the tag results in an error
exiftool -G1 -pitch=90 C:\...\klein_MAX_1000.jpg
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - C:/TEMP-InspecDrone/exif/klein_MAX_1000.jpg
    0 image files updated
    1 image files unchanged

After digging through the exiftool documentation and forum, I think I know that the tag label (?) is "XMP-Camera" on level 1 and "unknown" on level 2.
Probably I need to add a custom tag to the .ExifTool_config file

What I tried so far
* Simply editing the tag (not working)
* creating a new tag in the config file from the example given
  # special Geotag tags for XMP-exif:
    'Image::ExifTool::XMP::Camera' => {
        # Example 6.  XMP-Camera:Pitch
        Pitch => { Writable => 'rational', Groups => {2 => '' } },
pretty sure this is not correct but this is also where my very limited programming skills end.

I managed to write to a custom tag when using (I hope this was the correct code)
  # special Geotag tags for XMP-exif:
    'Image::ExifTool::XMP::xmp' => {
        # Example 6.  XMP:Pitch
        Pitch => { Writable => 'rational', Groups => {2 => 'xmp' } },
But it did not write over the existing pitch value and instead created a second one in a different "category"

What I hope to get out
A command that lets me read out all pitch values, add 90 to these values and write them back to the file
If operations like adding 90 are not possible in exiftool directly, then either storing the values to  a csv file and after editing restoring them to the images or simply being able to write to the "Pitch" tag would surely work as well going through a custom script.

I apologize in advance for any noob errors made and hope you can help me out here.

Thanks!
Simon

Edit: I work on Windows 11, using exiftool 13.04_64 in the standard windows command line

StarGeek

Download the pix4d.config file and save it into the same directory as exiftool. You would then start your commands with
exiftool -config pix4d.config ...
and you can then edit the XMP-Camera tags.

I believe this problem has come up before and I'll see if can find the post that shows how to adjust it.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

StarGeek

Re-reading your post, I think this would be what you want, after you downloaded the config file
exiftool -config pix4d.config -XMP-Camera:Pitch+=90 /path/to/files/

The situation I was thinking about (which I couldn't find :( ) was about dealing with adjusting a pitch or yaw but having to deal with going over 360°, which would need to be adjusted into the proper range.

But yours seems much simpler and shouldn't have to deal with that.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

stoffball

Quote from: StarGeek on December 04, 2024, 10:50:59 AMThe situation I was thinking about (which I couldn't find :( ) was about dealing with adjusting a pitch or yaw but having to deal with going over 360°, which would need to be adjusted into the proper range.

I think you are refer to this post https://exiftool.org/forum/index.php?topic=12832.msg69397#msg69397

StarGeek

Quote from: stoffball on December 04, 2024, 01:47:25 PMI think you are refer to this post https://exiftool.org/forum/index.php?topic=12832.msg69397#msg69397

I had found that, but I'm pretty sure there was a better post from Phil and that was what the one I was looking for.

But upon re-reading, I don't think it was applicable. The simple number shift is probably correct here.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

SimonK

Quote from: StarGeek on December 04, 2024, 10:50:59 AMRe-reading your post, I think this would be what you want, after you downloaded the config file
exiftool -config pix4d.config -XMP-Camera:Pitch+=90 /path/to/files/

The situation I was thinking about (which I couldn't find :( ) was about dealing with adjusting a pitch or yaw but having to deal with going over 360°, which would need to be adjusted into the proper range.

But yours seems much simpler and shouldn't have to deal with that.

This was it! Thanks so much, you really saved my week! The orientation appears correct in Pix4D, now the software has to do the rest.