I take images using a GoPro Max, on top of a pole, attached a backpack, while riding a bicycle.
As recommended, the GoPro is rotated 90 degrees to my right side. This is: the main lens points towards my right side, and the back lens (and the GoPro screen) points towards my left side.
Then, I upload the images using the command line:
panoramax_cli upload --api-url URL FOLDER
Every time that I upload images, I have to go to the sequence via the web and rotate it manually 90 degrees. It is not difficult, but it is repetitive. I am wondering if there is a way to do this automatically. Something like adding an argument to the command (I know it does not exist ):
I answer myself. I did not know that it was easy to edit Exif tags in JPG files.
I wrote a shell script that searches all JPG files in a folder, and add 90 degrees to their GPSImgDirection tag. To avoid any possible misbehavior, when the value is larger than 360 degrees, I subtract 360 degrees.
The script is called add_90deg_to_GPSImgDirection.sh
#!/bin/sh
# The directory that contains the JPG files to be edited is the first argument of the script
directory=$1
# Loop to all JPG files in directory
for file in "$directory"/*.jpg; do
# Read the original "GPSImgDirection" tag
# First, get the full line
GPSImgDirection_line=`exiftool -GPSImgDirection $file`
# Extract the value from the line
GPSImgDirectionOLD=`echo "$GPSImgDirection_line" | cut --delimiter=":" --field=2`
# Calculate the new direction in degrees
# For most cases, just add 90 degrees
# When the value in degrees will be larger than 360 deg, subtract 360 deg
if [ "$(echo "$GPSImgDirectionOLD < 270.0" | bc)" -eq 1 ]; then
GPSImgDirectionNEW=$(echo "$GPSImgDirectionOLD + 90.0" | bc)
else
GPSImgDirectionNEW=$(echo "$GPSImgDirectionOLD + 90.0 - 360.0" | bc)
fi
# Describe the change that is going to perform
echo "$file / GPSImgDirection : $GPSImgDirectionOLD -> $GPSImgDirectionNEW"
# Update the value in the original JPG file
exiftool -GPSImgDirection="$GPSImgDirectionNEW" $file
done
This will work only if there is already some orientation in the EXIF tags, which is not the case on JPEG saved by Gopro Max or Qoocam cameras (they have no magnetometer).
The orientation is computed by the server based on the location of the next picture in the sequence, and some offset could be passed when uploading the sequence to deal with side irnetation (or bad alignment with the track).
So far, it does not exist at upload and it does not change the picture itself where we expect more to have the front in the center.
In my Qoocam script, I compute the orientation and apply an offset if passed in the parameters, and also modify the picture itself to have the front part in the center of the picture.
I’m planning to extend this script to support JPEG from other cameras (like the Gopro Max) which will also provide:
nadir logo addition
better orientation computation taking into account the next and previous pictures in a sequence
apply time offset and realign the GPS locations
Currently, you can change the orientation using the web interface, sequence by sequence, and also do that thru API calls.