Main Menu

Adding pitch and roll

Started by dtapia, December 21, 2018, 08:43:16 AM

Previous topic - Next topic

dtapia

Hello,

I am trying to add roll and pitch tags. I saw a sampe config file (https://www.exiftool.org/config.html) which defines those tags I need. I renamed it to ".ExifTool_config" and I added  "exiftool -config .ExifTool_config" to the .bat file, but when I try to define those tags to photos, they doesn't appear...

I know I am doing something bad, but I dont know what,

Thanks a lot.
Regards.

Phil Harvey

You only need to rename the config file to ".ExifTool_config" if you want it to load automatically.  It can have any name if you load it with the -config option.

What command are you using to write these tags?  And what messages does exiftool give in response?

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

dtapia

Quote from: Phil Harvey on December 21, 2018, 08:46:23 AM
You only need to rename the config file to ".ExifTool_config" if you want it to load automatically.  It can have any name if you load it with the -config option.

What command are you using to write these tags?  And what messages does exiftool give in response?

- Phil

I am importing from a csv file. I got longitude, latitude and altitude but I cant display pitch and roll.

this is my command line:
exiftool -csv="GPS.csv" *.jpg

and this my csv:
SourceFile,GPSLatitude,GPSLongitude,GPSAltitude,GPSPitch,GPSRoll
ladybug_panoramic_000000.jpg,36.70900498,-4.413488588,5.2,179,5
ladybug_panoramic_000001.jpg,36.70897114,-4.413526776,2.1,5,12
ladybug_panoramic_000002.jpg,36.70892795,-4.413555432,7,7,15

Phil Harvey

Using your CSV file with the first file name changed to "a.jpg", and using the "example.config" file from the full distribution, this works for me:

> exiftool -config config_files/example.config -csv=a.csv a.jpg -v2
Reading CSV file a.csv
Imported entry for 'ladybug_panoramic_000001.jpg' (full path: '/Users/phil/source/exiftool_cvs/ladybug_panoramic_000001.jpg')
Imported entry for 'ladybug_panoramic_000002.jpg' (full path: '/Users/phil/source/exiftool_cvs/ladybug_panoramic_000002.jpg')
Imported entry for 'a.jpg' (full path: '/Users/phil/source/exiftool_cvs/a.jpg')
======== a.jpg
Setting new values from CSV database
Writing MIE-GPS:GPSAltitude
Writing XMP-exif:GPSAltitude if tag exists
Writing GPS:GPSAltitude
Writing MIE-GPS:GPSLatitude
Writing XMP-exif:GPSLatitude if tag exists
Writing GPS:GPSLatitude
Writing MIE-GPS:GPSLongitude
Writing XMP-exif:GPSLongitude if tag exists
Writing GPS:GPSLongitude
Writing XMP-exif:GPSPitch if tag exists
Writing GPS:GPSPitch
Writing XMP-exif:GPSRoll if tag exists
Writing GPS:GPSRoll
Rewriting a.jpg...
  Editing tags in: APP0 APP1 GPS IFD0 JFIF MIE-GPS XMP
  Creating tags in: APP1 GPS IFD0 MIE-GPS
Creating APP1:
  Creating IFD0
    + IFD0:XResolution = '72' (mandatory)
    + IFD0:YResolution = '72' (mandatory)
    + IFD0:ResolutionUnit = '2' (mandatory)
    + IFD0:YCbCrPositioning = '1' (mandatory)
  Creating GPS
    + GPS:GPSVersionID = '2 3 0 0' (mandatory)
    + GPS:GPSLatitude = '36 42 32.4179280000114'
    + GPS:GPSLongitude = '4 24 48.5589167999995'
    + GPS:GPSAltitude = '5.2'
    + GPS:GPSPitch = '179'
    + GPS:GPSRoll = '5'
JPEG DQT (130 bytes):
JPEG SOF0:
JPEG DHT (73 bytes):
JPEG SOS
    1 image files updated


and reading it back...

> exiftool -config config_files/example.config a.jpg "-gps*"
GPS Version ID                  : 2.3.0.0
GPS Latitude                    : 36.709005
GPS Longitude                   : 4.413489
GPS Altitude                    : 5.2 m
GPS Pitch                       : 179
GPS Roll                        : 5
GPS Position                    : 36.709005, 4.413489


- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

dtapia

Quote from: Phil Harvey on December 21, 2018, 09:35:20 AM
Using your CSV file with the first file name changed to "a.jpg", and using the "example.config" file from the full distribution, this works for me:

> exiftool -config config_files/example.config -csv=a.csv a.jpg -v2
Reading CSV file a.csv
Imported entry for 'ladybug_panoramic_000001.jpg' (full path: '/Users/phil/source/exiftool_cvs/ladybug_panoramic_000001.jpg')
Imported entry for 'ladybug_panoramic_000002.jpg' (full path: '/Users/phil/source/exiftool_cvs/ladybug_panoramic_000002.jpg')
Imported entry for 'a.jpg' (full path: '/Users/phil/source/exiftool_cvs/a.jpg')
======== a.jpg
Setting new values from CSV database
Writing MIE-GPS:GPSAltitude
Writing XMP-exif:GPSAltitude if tag exists
Writing GPS:GPSAltitude
Writing MIE-GPS:GPSLatitude
Writing XMP-exif:GPSLatitude if tag exists
Writing GPS:GPSLatitude
Writing MIE-GPS:GPSLongitude
Writing XMP-exif:GPSLongitude if tag exists
Writing GPS:GPSLongitude
Writing XMP-exif:GPSPitch if tag exists
Writing GPS:GPSPitch
Writing XMP-exif:GPSRoll if tag exists
Writing GPS:GPSRoll
Rewriting a.jpg...
  Editing tags in: APP0 APP1 GPS IFD0 JFIF MIE-GPS XMP
  Creating tags in: APP1 GPS IFD0 MIE-GPS
Creating APP1:
  Creating IFD0
    + IFD0:XResolution = '72' (mandatory)
    + IFD0:YResolution = '72' (mandatory)
    + IFD0:ResolutionUnit = '2' (mandatory)
    + IFD0:YCbCrPositioning = '1' (mandatory)
  Creating GPS
    + GPS:GPSVersionID = '2 3 0 0' (mandatory)
    + GPS:GPSLatitude = '36 42 32.4179280000114'
    + GPS:GPSLongitude = '4 24 48.5589167999995'
    + GPS:GPSAltitude = '5.2'
    + GPS:GPSPitch = '179'
    + GPS:GPSRoll = '5'
JPEG DQT (130 bytes):
JPEG SOF0:
JPEG DHT (73 bytes):
JPEG SOS
    1 image files updated


and reading it back...

> exiftool -config config_files/example.config a.jpg "-gps*"
GPS Version ID                  : 2.3.0.0
GPS Latitude                    : 36.709005
GPS Longitude                   : 4.413489
GPS Altitude                    : 5.2 m
GPS Pitch                       : 179
GPS Roll                        : 5
GPS Position                    : 36.709005, 4.413489


- Phil

Hello Phil,

I tried it and it worked like you did. Just one thing: i go to the properties of the photo-->details and I only see longitude, latitude and altitude. Roll and pitch cant be displayed in that menu? and could I set Yaw with exiftool?

Thanks.

StarGeek

Quote from: dtapia on December 22, 2018, 02:35:36 PMi go to the properties of the photo-->details and I only see longitude, latitude and altitude. Roll and pitch cant be displayed in that menu?

You don't say what you're using to view the properties of the file, but it's quite possible that it just doesn't read that data.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

Phil Harvey

This is non-standard EXIF, so other apps will only read it if you can configure custom tags.

You can use the standard GPSImgDirection for Yaw.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

dtapia

Quote from: StarGeek on December 22, 2018, 03:09:45 PM
Quote from: dtapia on December 22, 2018, 02:35:36 PMi go to the properties of the photo-->details and I only see longitude, latitude and altitude. Roll and pitch cant be displayed in that menu?

You don't say what you're using to view the properties of the file, but it's quite possible that it just doesn't read that data.

Hello

I am training this software, and I am using windows properties to see them at this moment, hehe

dtapia

Quote from: Phil Harvey on December 22, 2018, 09:11:19 PM
This is non-standard EXIF, so other apps will only read it if you can configure custom tags.

You can use the standard GPSImgDirection for Yaw.

- Phil

Thanks a lot Phil!

dtapia

Quote from: Phil Harvey on December 22, 2018, 09:11:19 PM
This is non-standard EXIF, so other apps will only read it if you can configure custom tags.

You can use the standard GPSImgDirection for Yaw.

- Phil

Hello phill,

I am trying to use GPSImgDirection for yaw, but I have a problem. Negative numbers for yaw aren't displayed at their respective photo. I tried to use GPSImgDirectionRef T and M but the problem is still there. How can I assign those negative numbers to the photos?.

For example:
SourceFile,GPSLatitude,GPSLongitude,GPSAltitude,GPSRoll,GPSPitch,GPSImgDirection,GPSLatitudeRef,GPSLongitudeRef,GPSImgDirectionRef

ladybug_panoramic_000000.jpg,36.70900498,-4.413488588,5.942606865,179.1635888,0.179976437,42.17153229,N,W,M
ladybug_panoramic_000001.jpg,36.70897114,-4.413526776,5.834002511,178.1573564,0.390092805,38.51711711,N,W,M
ladybug_panoramic_000002.jpg,36.70892795,-4.413555432,5.737311878,177.2469652,0.280327485,6.642170491,N,W,M
ladybug_panoramic_000003.jpg,36.70888011,-4.413534567,5.71169086,178.1952329,-2.747015889,-62.4382638,N,W,M

photo number 000003 doesnt show the GPSImgDirection in other programs, but the other photos yes.

Thanks.

Phil Harvey

GPSImgDirection must be between 0 and 360 according to the EXIF spec.  So -1 should be written as 359.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

dtapia

Quote from: Phil Harvey on January 08, 2019, 07:03:08 AM
GPSImgDirection must be between 0 and 360 according to the EXIF spec.  So -1 should be written as 359.

- Phil

Hello Phil,

So, in my case, I have to change one by one each negative data, haven't I?

Phil Harvey

No.  You can use the following config file and change the column heading to GPSYaw to do what you want.

%Image::ExifTool::UserDefined = (
    'Image::ExifTool::Composite' => {
        GPSYaw => {
            Require => 'GPSImgDirection',
            ValueConv => '$val[0] - ($val[0] > 180 ? 360 : 0)',
            Writable => 1,
            WriteAlso => {
                GPSImgDirection => 'defined $val ? $val + ($val < 0 ? 360 : 0) : undef',
            },
        },
    },
);

1; #end


Assuming the config file is named "gpsyaw.config", the command would look like this:

exiftool -config gpsyaw.config -csv="GPS.csv" -ext jpg .

This will accept GPSYaw values from -180 to 180, and write the corresponding value for GPSImgDirection in the range 0 to 360.  It can also be used when reading to do the reverse.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).