I work on toolkit that automatically classifies data from a bunch of aerial cameras. Each camera uses geotagging to store position and time metadata in EXIF tags.
When I use GDAL (I use version 2.0.2 on a device running debian 8) to equalize the images all additional tags are lost. How can I copy these tags into the new file with gdal, to give the process queue the self contained infos.
Example:
Phil Harveys exiftool gives me a clue whats in the box. For example fom this camera:
$ exiftool flir_cam2_20180528172334.524_1051.tif
ExifTool Version Number : 10.20
File Name : flir_cam2_20180528172334.524_1051.tif
Directory : .
File Size : 274 kB
File Modification Date/Time : 2018:05:28 18:33:13+02:00
File Access Date/Time : 2018:08:01 17:59:54+02:00
File Inode Change Date/Time : 2018:08:01 17:15:10+02:00
File Permissions : rw-------
File Type : TIFF
File Type Extension : tif
MIME Type : image/tiff
Exif Byte Order : Little-endian (Intel, II)
Image Width : 640
Image Height : 512
Bits Per Sample : 16
Compression : LZW
Photometric Interpretation : BlackIsZero
Strip Offsets : (Binary data 564 bytes, use -b option to extract)
Samples Per Pixel : 1
Rows Per Strip : 6
Strip Byte Counts : (Binary data 429 bytes, use -b option to extract)
Planar Configuration : Chunky
Predictor : Horizontal differencing
GPS Latitude Ref : North
GPS Longitude Ref : East
GPS Altitude Ref : Above Sea Level
GPS Time Stamp : 15:23:34
GPS Map Datum : WGS-84
GPS Date Stamp : 2018:05:28
GPS Altitude : 309.7 m Above Sea Level
GPS Date/Time : 2018:05:28 15:23:34Z
GPS Latitude : 48 deg 19' 36.46" N
GPS Longitude : 15 deg 53' 26.60" E
GPS Position : 48 deg 19' 36.46" N, 15 deg 53' 26.60" E
Image Size : 640x512
Megapixels : 0.328
gdalinfo -listmdd $file is blind on this eye.
gdal -listmdd
$ gdalinfo -listmdd flir_cam2_20180528172334.524_1051.tif
Driver: GTiff/GeoTIFF
Files: cam2_20180528172334.524_1051.tiff
Size is 640, 512
Coordinate System is `'
Metadata domains:
IMAGE_STRUCTURE
EXIF
Image Structure Metadata:
COMPRESSION=LZW
INTERLEAVE=BAND
Corner Coordinates:
Upper Left ( 0.0, 0.0)
Lower Left ( 0.0, 512.0)
Upper Right ( 640.0, 0.0)
Lower Right ( 640.0, 512.0)
Center ( 320.0, 256.0)
Band 1 Block=640x6 Type=UInt16, ColorInterp=Gray
The resulting image from the processing was created with the GDAL command stack (pseudo code):
newHandle = GDALCreateCopy(gdalGeoTiffDriver, 'equal-16bit.tif', origFileHandle, strict, optionForCompress, NULL, NULL)
...do some image processing stuff
GDALFlushCache(newHandle);
GDALClose(newHandle);
After the process the info is gone:
$ exiftool equal-16bit.tif
ExifTool Version Number : 10.20
File Name : equal-16bit.tif
Directory : .
File Size : 362 kB
File Modification Date/Time : 2018:08:02 17:51:10+02:00
File Access Date/Time : 2018:08:02 17:51:36+02:00
File Inode Change Date/Time : 2018:08:02 17:51:10+02:00
File Permissions : rw-r--r--
File Type : TIFF
File Type Extension : tif
MIME Type : image/tiff
Exif Byte Order : Little-endian (Intel, II)
Image Width : 640
Image Height : 512
Bits Per Sample : 16
Compression : LZW
Photometric Interpretation : BlackIsZero
Samples Per Pixel : 1
Planar Configuration : Chunky
Predictor : None
Tile Width : 256
Tile Length : 256
Tile Offsets : (Binary data 37 bytes, use -b option to extract)
Tile Byte Counts : (Binary data 35 bytes, use -b option to extract)
Sample Format : Unsigned
Image Size : 640x512
Megapixels : 0.328
Is there a possibility to use the routines:
oldMetadata = GDALGetMetadata( oldDatasetHandle, domain );
GDALSetMetadata(newDatasetHandle, oldMetadata, domain);
to copy the infos and which domain I have to use?
exiftool −overwrite_original_in_place -r -tagsFromFile source.tif -gps:all dest.tif