Skip to content

Commit

Permalink
[exif] LatLon resolution and altitude update
Browse files Browse the repository at this point in the history
  • Loading branch information
dewagter committed Sep 24, 2015
1 parent 94091a1 commit 7152a43
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions sw/airborne/modules/computer_vision/lib/exif/exif_module.c
Expand Up @@ -216,9 +216,9 @@ int write_exif_jpeg(char *filename, const unsigned char *image_jpg, const unsign
exif_set_rational(entry->data + 8, EXIF_BYTE_ORDER_INTEL, loc);
lat -= lati * 1e7;
lat *= 60.0;
lati = lat / 1e5;
lati = lat / 1e4;
loc.numerator = lati;
loc.denominator = 100;
loc.denominator = 1000;
exif_set_rational(entry->data + 16, EXIF_BYTE_ORDER_INTEL, loc);

entry = create_tag(exif, EXIF_IFD_GPS, EXIF_TAG_GPS_LONGITUDE, 24);
Expand All @@ -240,11 +240,21 @@ int write_exif_jpeg(char *filename, const unsigned char *image_jpg, const unsign
exif_set_rational(entry->data + 8, EXIF_BYTE_ORDER_INTEL, loc);
lon -= loni * 1e7;
lon *= 60.0;
loni = lon / 1e7;
loni = lon / 1e4;
loc.numerator = loni;
loc.denominator = 1;
loc.denominator = 1000;
exif_set_rational(entry->data + 16, EXIF_BYTE_ORDER_INTEL, loc);

entry = create_tag(exif, EXIF_IFD_GPS, EXIF_TAG_GPS_ALTITUDE, 8);
// Set the field's format and number of components, this is very important!
entry->format = EXIF_FORMAT_RATIONAL;
entry->components = 1;
// Height
ExifRational alt;
alt.numerator = alt_mm;
alt.denominator = 1000;
exif_set_rational(entry->data, EXIF_BYTE_ORDER_INTEL, alt);


/* Get a pointer to the EXIF data block we just created */
exif_data_save_data(exif, &exif_data, &exif_data_len);
Expand Down

0 comments on commit 7152a43

Please sign in to comment.