Merge pull request #1142 from samsalway/ssa-sequoia-tifs

Sequoia script changes

Former-commit-id: 46ab06f91c
pull/1161/head
Stephen Mather 2020-08-09 14:10:21 -04:00 zatwierdzone przez GitHub
commit 5aa3ffa4ca
3 zmienionych plików z 31 dodań i 19 usunięć

Wyświetl plik

@ -2,12 +2,25 @@
The Sequoia captures five images per shot, an RGB JPG and four single band TIFs, but only the JPG contains GPS Exif tags. To use the single-band TIFs for multispectral mapping/analysis its useful (not technically required) to have them also contain GPS Exif tags.
This script will copy the GPS Exif tags from the RGB JPG file to the four TIFs of the same shot.
## prepare-tifs.sh
## Requirements
This script will copy the GPS Exif tags from the RGB JPG file to the four TIFs of the same shot. It will process all images in the working directory and use the sequence number in the filename to match JPG to TIFs. Therefore it *must* only be applied to one folder from the Sequoia per run.
### Requirements
* [exiv2](https://www.exiv2.org/)
* bash (tested in git-bash on Windows, other shells probably work too)
## Usage
### Usage
Run the script from a directory of images captured by Sequoia.
```
./prepare-tifs.sh
```
## subfolder-per-band.sh
This script will move images into a subfolder per band.
### Usage
Run the script from a directory of images captured by Sequoia.
```
./prepare-tifs.sh

24
contrib/sequoia/prepare-tifs.sh 100644 → 100755
Wyświetl plik

@ -1,23 +1,15 @@
#!/bin/sh
# Rename - remove timestamp
for img in IMG_*.*; do
newname=`echo $img | sed -r "s/IMG_[0-9]+_[0-9]+_//"`
mv $img $newname
done
# Copy GPS Exif tags from IMG_*_RGB.JPG to .TIF images
for rgb in IMG_*_RGB.JPG; do
seqnum=`echo $rgb | sed -r "s/IMG_[0-9]+_[0-9]+_([0-9]+).*/\1/"`
echo $seqnum
exiv2 -PEVk --grep GPS $rgb > $rgb.tags
# Copy GPS Exif tags from *RGB.JPG to .TIF images
for rgb in *_RGB.JPG; do
for band in GRE NIR RED REG; do
tif=`echo $rgb | sed s/_RGB.JPG/_$band.TIF/`
exiv2 -PEVk --grep GPS $rgb > $rgb.tags
exiv2 -m $rgb.tags $tif
rm $rgb.tags
exiv2 -m $rgb.tags IMG_*_$seqnum\_$band.TIF
done
done
# Move into subfolder per band
for band in RGB GRE NIR RED REG; do
mkdir $band
mv *_$band.* $band/
rm $rgb.tags
done

Wyświetl plik

@ -0,0 +1,7 @@
#!/bin/sh
# Move into subfolder per band
for band in RGB GRE NIR RED REG; do
mkdir $band
mv IMG_*_$band.* $band/
done