Author Topic: Write to EXIF from external sensor.  (Read 253 times)

Shane

  • Jr. Member
  • **
  • Posts: 11
Write to EXIF from external sensor.
« on: April 13, 2020, 10:20:48 PM »
Hi.

I'm not sure if this can be answered here, but I thought I would try. I have used ExifTool to read/write metadata after an image has been taken. I am wanting to write EXIF data during image capture from an external sensor. More specifically I would like to write the yaw and pitch of the camera, based on readings from the external sensor that will be attached to the camera, as the photo is taken instead of having to add it later. Does anyone know if this has been done or is possible?

Thanks,
Shane

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16510
    • ExifTool Home Page
Re: Write to EXIF from external sensor.
« Reply #1 on: April 14, 2020, 06:35:41 AM »
Hi Shane,

This is possible if you have control of the software that actually writes the image file.

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

Shane

  • Jr. Member
  • **
  • Posts: 11
Re: Write to EXIF from external sensor.
« Reply #2 on: April 14, 2020, 07:56:28 AM »
Hi Phil,

Thanks for the quick response. In order to do that I would have to use a camera with an open API/SDK or something similar to Magic Lantern? I don't have a Cannon (Sony, Nikon) so Magic Lantern might be out for me as an option.


Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16510
    • ExifTool Home Page
Re: Write to EXIF from external sensor.
« Reply #3 on: April 14, 2020, 08:21:48 AM »
Yes.  This would be difficult.

It would be easier to log the external sensor data with timestamps and tag the images as they are downloaded from the camera.

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

Shane

  • Jr. Member
  • **
  • Posts: 11
Re: Write to EXIF from external sensor.
« Reply #4 on: April 14, 2020, 09:25:08 AM »
Ok. Thanks Phil.

Shane

  • Jr. Member
  • **
  • Posts: 11
Re: Write to EXIF from external sensor.
« Reply #5 on: April 14, 2020, 11:06:00 AM »
Phil,

One follow-up question.

Let's say I sync the log with the timestamps for tagging the images like you suggested, as far as I can see there is no standard tags in EXIF to store the tilt/rotation of the camera. I ran across XMP tags camera.yaw and camera.pitch. Am I correct about no EXIF tags for storing the data?

Shane

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16510
    • ExifTool Home Page
Re: Write to EXIF from external sensor.
« Reply #6 on: April 14, 2020, 11:14:48 AM »
Hi Shane,

This is a long-time deficiency in EXIF, although EXIF version 2.31 added the CameraElevationAngle tag, the other angle is still neglected (you can use the existing GPSImgDirection for the third angle).  The example ExifTool config file shows how to create user-defined EXIF GPSPitch and GPSRoll tags, but these are non-standard, and as such will only be readable by ExifTool.

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

Shane

  • Jr. Member
  • **
  • Posts: 11
Re: Write to EXIF from external sensor.
« Reply #7 on: April 14, 2020, 11:30:40 AM »
So the CameraElevationAngle for pitch/tilt and GPSImgDirection for yaw/rotate? Otherwise use XMP tags?

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16510
    • ExifTool Home Page
Re: Write to EXIF from external sensor.
« Reply #8 on: April 14, 2020, 11:32:17 AM »
Yup.

I was thinking that you meant camera roll when you mentioned rotation.  But if you meant yaw, then all is good.

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

Shane

  • Jr. Member
  • **
  • Posts: 11
Re: Write to EXIF from external sensor.
« Reply #9 on: April 14, 2020, 11:39:14 AM »
Yes, I need Pitch and Yaw. I want to record the relative offsets of the yaw rotations starting at 0 and then every 30 degree taking a photo and recording that to EXIF and then tilt the camera up and 45 degrees and repeat yaw rotation then down 45 degree and repeat yaw rotations. So I want to record the yaw rotations, and the pitch of the camera at those rotations. I don't need true compass directions just the offsets starting from 0.

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16510
    • ExifTool Home Page
Re: Write to EXIF from external sensor.
« Reply #10 on: April 14, 2020, 01:32:37 PM »
OK then.  GPSImgDirection will do for relative yaw.  You could just write some unknown value to GPSImgDirectionRef to indicate a non-standard reference direction.  For example:

exiftool -CameraElevationAngle=45 -GPSImgDirection=30 -GPSImgDirectionRef#=R FILE

(the '#' bypasses the print conversion, allowing you to write a nonstandard value.  Here I chose 'R' to indicate Relative.)

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

Shane

  • Jr. Member
  • **
  • Posts: 11
Re: Write to EXIF from external sensor.
« Reply #11 on: April 14, 2020, 02:41:29 PM »
Hi Phil,

Thanks. That looks like it might work for what I need. I appreciate the help. I will give it a try.

Shane