¿Cómo se almacena la información del GPS en un archivo RAW?

¿Cómo se almacena la información del GPS en un archivo RAW?

Estoy intentando analizar un archivo Nikon RAW usando la biblioteca LibRAW. La biblioteca me proporciona una matriz int de 32 bytes de datos GPS. No he podido encontrar ninguna documentación que explique cómo interpretar esta matriz de 32 x int.

Aquí hay un ejemplo de datos de GPS que extraje:

GPS:32
GPS:1
GPS:112393
GPS:10000
GPS:0
GPS:1
GPS:104
GPS:1
GPS:253126
GPS:10000
GPS:0
GPS:1
GPS:18
GPS:1
GPS:35
GPS:1
GPS:4800
GPS:100
GPS:1204
GPS:1
GPS:538976288
GPS:538976288
GPS:32
GPS:875638834
GPS:976302138
GPS:13361
GPS:0
GPS:0
GPS:0
GPS:78
GPS:87
GPS:0

Respuesta1

Bueno... no pude encontrar ninguna documentación sobre unsigned int [32]for gpsdata.

Encontré un fragmento de código.aquíde la fuente LibRAW.
Mira el parse_gps. Este código analiza la información Exif en la gpsdata[32]matriz.

#define FORC(cnt) for (c=0; c < cnt; c++)
...
void CLASS parse_gps (int base)
{
  unsigned entries, tag, type, len, save, c;

  entries = get2();
  while (entries--) {
    tiff_get (base, &tag, &type, &len, &save);
    switch (tag) {
      case 1: case 3: case 5:
        gpsdata[29+tag/2] = getc(ifp);            break;
      case 2: case 4: case 7:
        FORC(6) gpsdata[tag/3*6+c] = get4();      break;
      case 6:
        FORC(2) gpsdata[18+c] = get4();           break;
      case 18: case 29:
        fgets ((char *) (gpsdata+14+tag/3), MIN(len,12), ifp);
    }
    fseek (ifp, save, SEEK_SET);
  }
}

Perdón por mi falta de conocimiento de C++... pero con la ayuda deesta fuenteencontre eso

GPSLatitudeRef  = gpsdata[29+1/2]  (Exif tag 0x0001) = [29]  1 char
GPSLongitudeRef = gpsdata[29+3/2]  (Exif tag 0x0003) = [30]  1 char
GPSAltitudeRef  = gpsdata[29+5/2]  (Exif tag 0x0005) = [31]  1 char

GPSLatitude     = gpsdata[2/3*6+c] (Exif tag 0x0002) = [ 0]  6 int
GPSLongitude    = gpsdata[4/3*6+c] (Exif tag 0x0004) = [ 6]  6 int
GPSTimeStamp    = gpsdata[7/3*6+c] (Exif tag 0x0007) = [12]  6 int

GPSAltitude     = gpsdata[18+c]    (Exif tag 0x0006) = [18]  2 int
GPSMapDatum     = gpsdata+14+18/3  (Exif tag 0x0012) = [20]  3 int
GPSDateStamp    = gpsdata+14+29/3  (Exif tag 0x001d) = [23]  3 int

En tu caso esto se traduciría en:

00 GPS:32           GPSLatitude  #1
01 GPS:1                         #2
02 GPS:112393                    #3
03 GPS:10000                     #4
04 GPS:0                         #5
05 GPS:1                         #6
06 GPS:104          GPSLongitude #1
07 GPS:1                         #2
08 GPS:253126                    #3
09 GPS:10000                     #4
10 GPS:0                         #5
11 GPS:1                         #6
12 GPS:18           GPSTimeStamp #1
13 GPS:1                         #2
14 GPS:35                        #3
15 GPS:1                         #4
16 GPS:4800                      #5
17 GPS:100                       #6
18 GPS:1204         GPSAltitude  #1
19 GPS:1                         #2
20 GPS:538976288    GPSMapDatum  #1
21 GPS:538976288                 #2
22 GPS:32                        #3
23 GPS:875638834    GPSDateStamp #1
24 GPS:976302138                 #2
25 GPS:13361                     #3
26 GPS:0
27 GPS:0
28 GPS:0
29 GPS:78    N      GPSLatitudeRef
30 GPS:87    W      GPSLongitudeRef
31 GPS:0     ?      GPSAltitudeRef

Esto simplemente se hace investigando un poco el código fuente, así que perdone cualquier error...

Espero que esto te lleve un poco más lejos.

información relacionada