mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-31 03:57:45 +08:00
[exif] negative lat/lon/alt
This commit is contained in:
@@ -27,9 +27,9 @@
|
|||||||
//////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////
|
||||||
// Multithreaded part
|
// Multithreaded part
|
||||||
|
|
||||||
volatile uint32_t lat_em7deg = 0;
|
volatile int32_t lat_em7deg = 0;
|
||||||
volatile uint32_t lon_em7deg = 0;
|
volatile int32_t lon_em7deg = 0;
|
||||||
volatile uint32_t alt_mm = 0;
|
volatile int32_t alt_mm = 0;
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////
|
||||||
// Paparazzi part
|
// Paparazzi part
|
||||||
@@ -203,8 +203,8 @@ int write_exif_jpeg(char *filename, const unsigned char *image_jpg, const unsign
|
|||||||
entry->format = EXIF_FORMAT_RATIONAL;
|
entry->format = EXIF_FORMAT_RATIONAL;
|
||||||
entry->components = 3;
|
entry->components = 3;
|
||||||
// Degrees
|
// Degrees
|
||||||
uint32_t lat = lat_em7deg;
|
int32_t lat = lat_em7deg;
|
||||||
uint32_t lati = lat / 1e7;
|
int32_t lati = lat / 1e7;
|
||||||
ExifRational loc;
|
ExifRational loc;
|
||||||
loc.numerator = lati;
|
loc.numerator = lati;
|
||||||
loc.denominator = 1;
|
loc.denominator = 1;
|
||||||
@@ -227,8 +227,8 @@ int write_exif_jpeg(char *filename, const unsigned char *image_jpg, const unsign
|
|||||||
entry->components = 3;
|
entry->components = 3;
|
||||||
// Degrees
|
// Degrees
|
||||||
// Degrees
|
// Degrees
|
||||||
uint32_t lon = lon_em7deg;
|
int32_t lon = lon_em7deg;
|
||||||
uint32_t loni = lon / 1e7;
|
int32_t loni = lon / 1e7;
|
||||||
loc.numerator = loni;
|
loc.numerator = loni;
|
||||||
loc.denominator = 1;
|
loc.denominator = 1;
|
||||||
exif_set_rational(entry->data, EXIF_BYTE_ORDER_INTEL, loc);
|
exif_set_rational(entry->data, EXIF_BYTE_ORDER_INTEL, loc);
|
||||||
@@ -251,8 +251,13 @@ int write_exif_jpeg(char *filename, const unsigned char *image_jpg, const unsign
|
|||||||
entry->components = 1;
|
entry->components = 1;
|
||||||
// Height
|
// Height
|
||||||
ExifRational alt;
|
ExifRational alt;
|
||||||
alt.numerator = alt_mm;
|
if (alt_mm > 0) {
|
||||||
alt.denominator = 1000;
|
alt.numerator = alt_mm;
|
||||||
|
alt.denominator = 1000;
|
||||||
|
} else {
|
||||||
|
alt.numerator = 0;
|
||||||
|
alt.denominator = 1000;
|
||||||
|
}
|
||||||
exif_set_rational(entry->data, EXIF_BYTE_ORDER_INTEL, alt);
|
exif_set_rational(entry->data, EXIF_BYTE_ORDER_INTEL, alt);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user