Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
elphel-apps-camogm
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Elphel
elphel-apps-camogm
Commits
125b5ed8
Commit
125b5ed8
authored
Mar 18, 2019
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Project setup + exif-related
parent
7baf7627
Changes
2
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
66 additions
and
61 deletions
+66
-61
.cproject
eclipse_project_setup/.cproject
+47
-42
camogm_kml.c
src/camogm_kml.c
+19
-19
No files found.
eclipse_project_setup/.cproject
View file @
125b5ed8
This diff is collapsed.
Click to expand it.
src/camogm_kml.c
View file @
125b5ed8
...
@@ -84,7 +84,7 @@ int camogm_start_kml(camogm_state *state)
...
@@ -84,7 +84,7 @@ int camogm_start_kml(camogm_state *state)
(
int
)
dir_table_entry
.
ltag
,
\
(
int
)
dir_table_entry
.
ltag
,
\
(
int
)
dir_table_entry
.
len
,
\
(
int
)
dir_table_entry
.
len
,
\
(
int
)
dir_table_entry
.
src
,
\
(
int
)
dir_table_entry
.
src
,
\
(
int
)
dir_table_entry
.
dst
));
(
int
)
dir_table_entry
.
dst
_exif
));
}
}
}
}
close
(
fd_ExifDir
);
close
(
fd_ExifDir
);
...
@@ -159,11 +159,11 @@ int camogm_frame_kml(camogm_state *state)
...
@@ -159,11 +159,11 @@ int camogm_frame_kml(camogm_state *state)
// generating KML itself
// generating KML itself
// using GPS time - in the same structure
// using GPS time - in the same structure
if
(
state
->
kml_exif
[
Exif_GPSInfo_GPSDateStamp_Index
].
ltag
==
Exif_GPSInfo_GPSDateStamp
)
{
// Exif_GPSInfo_GPSDateStamp is present in template
if
(
state
->
kml_exif
[
Exif_GPSInfo_GPSDateStamp_Index
].
ltag
==
Exif_GPSInfo_GPSDateStamp
)
{
// Exif_GPSInfo_GPSDateStamp is present in template
memcpy
(
datestr
,
&
(
state
->
ed
[
port
][
state
->
kml_exif
[
Exif_GPSInfo_GPSDateStamp_Index
].
dst
]),
10
);
memcpy
(
datestr
,
&
(
state
->
ed
[
port
][
state
->
kml_exif
[
Exif_GPSInfo_GPSDateStamp_Index
].
dst
_exif
]),
10
);
datestr
[
4
]
=
'-'
;
datestr
[
7
]
=
'-'
;
datestr
[
10
]
=
'\0'
;
datestr
[
4
]
=
'-'
;
datestr
[
7
]
=
'-'
;
datestr
[
10
]
=
'\0'
;
}
}
if
(
state
->
kml_exif
[
Exif_GPSInfo_GPSTimeStamp_Index
].
ltag
==
Exif_GPSInfo_GPSTimeStamp
)
{
// Exif_GPSInfo_GPSTimeStamp is present in template
if
(
state
->
kml_exif
[
Exif_GPSInfo_GPSTimeStamp_Index
].
ltag
==
Exif_GPSInfo_GPSTimeStamp
)
{
// Exif_GPSInfo_GPSTimeStamp is present in template
ip
=
(
int
*
)
&
(
state
->
ed
[
state
->
kml_exif
[
Exif_GPSInfo_GPSTimeStamp_Index
].
dst
]);
ip
=
(
int
*
)
&
(
state
->
ed
[
state
->
kml_exif
[
Exif_GPSInfo_GPSTimeStamp_Index
].
dst
_exif
]);
hours
=
__cpu_to_be32
(
ip
[
0
]);
hours
=
__cpu_to_be32
(
ip
[
0
]);
minutes
=
__cpu_to_be32
(
ip
[
2
]);
minutes
=
__cpu_to_be32
(
ip
[
2
]);
seconds
=
(
1
.
0
*
(
__cpu_to_be32
(
ip
[
4
])
+
1
))
/
__cpu_to_be32
(
ip
[
5
]);
// GPS likes ".999", let's inc by one - anyway will round that out
seconds
=
(
1
.
0
*
(
__cpu_to_be32
(
ip
[
4
])
+
1
))
/
__cpu_to_be32
(
ip
[
5
]);
// GPS likes ".999", let's inc by one - anyway will round that out
...
@@ -179,52 +179,52 @@ int camogm_frame_kml(camogm_state *state)
...
@@ -179,52 +179,52 @@ int camogm_frame_kml(camogm_state *state)
// knowing format provided from GPS - degrees and minuts only, no seconds:
// knowing format provided from GPS - degrees and minuts only, no seconds:
if
(
state
->
kml_exif
[
Exif_GPSInfo_GPSLongitude_Index
].
ltag
==
Exif_GPSInfo_GPSLongitude
)
{
// Exif_GPSInfo_GPSLongitude is present in template
if
(
state
->
kml_exif
[
Exif_GPSInfo_GPSLongitude_Index
].
ltag
==
Exif_GPSInfo_GPSLongitude
)
{
// Exif_GPSInfo_GPSLongitude is present in template
ip
=
(
int
*
)
&
(
state
->
ed
[
state
->
kml_exif
[
Exif_GPSInfo_GPSLongitude_Index
].
dst
]);
ip
=
(
int
*
)
&
(
state
->
ed
[
state
->
kml_exif
[
Exif_GPSInfo_GPSLongitude_Index
].
dst
_exif
]);
longitude
=
__cpu_to_be32
(
ip
[
0
])
/
(
1
.
0
*
__cpu_to_be32
(
ip
[
1
]))
+
__cpu_to_be32
(
ip
[
2
])
/
(
60
.
0
*
__cpu_to_be32
(
ip
[
3
]));
longitude
=
__cpu_to_be32
(
ip
[
0
])
/
(
1
.
0
*
__cpu_to_be32
(
ip
[
1
]))
+
__cpu_to_be32
(
ip
[
2
])
/
(
60
.
0
*
__cpu_to_be32
(
ip
[
3
]));
if
((
state
->
kml_exif
[
Exif_GPSInfo_GPSLongitudeRef_Index
].
ltag
==
Exif_GPSInfo_GPSLongitudeRef
)
&&
if
((
state
->
kml_exif
[
Exif_GPSInfo_GPSLongitudeRef_Index
].
ltag
==
Exif_GPSInfo_GPSLongitudeRef
)
&&
(
state
->
ed
[
port
][
state
->
kml_exif
[
Exif_GPSInfo_GPSLongitudeRef_Index
].
dst
]
!=
'E'
))
longitude
=
-
longitude
;
(
state
->
ed
[
port
][
state
->
kml_exif
[
Exif_GPSInfo_GPSLongitudeRef_Index
].
dst
_exif
]
!=
'E'
))
longitude
=
-
longitude
;
D2
(
fprintf
(
debug_file
,
"(longitude) 0x%x 0x%x 0x%x 0x%x '%c'
\n
"
,
ip
[
0
],
ip
[
1
],
ip
[
2
],
ip
[
3
],
state
->
ed
[
port
][
state
->
kml_exif
[
Exif_GPSInfo_GPSLongitudeRef_Index
].
dst
]));
D2
(
fprintf
(
debug_file
,
"(longitude) 0x%x 0x%x 0x%x 0x%x '%c'
\n
"
,
ip
[
0
],
ip
[
1
],
ip
[
2
],
ip
[
3
],
state
->
ed
[
port
][
state
->
kml_exif
[
Exif_GPSInfo_GPSLongitudeRef_Index
].
dst
_exif
]));
}
}
if
(
state
->
kml_exif
[
Exif_GPSInfo_GPSLatitude_Index
].
ltag
==
Exif_GPSInfo_GPSLatitude
)
{
// Exif_GPSInfo_GPSLatitude is present in template
if
(
state
->
kml_exif
[
Exif_GPSInfo_GPSLatitude_Index
].
ltag
==
Exif_GPSInfo_GPSLatitude
)
{
// Exif_GPSInfo_GPSLatitude is present in template
ip
=
(
int
*
)
&
(
state
->
ed
[
port
][
state
->
kml_exif
[
Exif_GPSInfo_GPSLatitude_Index
].
dst
]);
ip
=
(
int
*
)
&
(
state
->
ed
[
port
][
state
->
kml_exif
[
Exif_GPSInfo_GPSLatitude_Index
].
dst
_exif
]);
latitude
=
__cpu_to_be32
(
ip
[
0
])
/
(
1
.
0
*
__cpu_to_be32
(
ip
[
1
]))
+
__cpu_to_be32
(
ip
[
2
])
/
(
60
.
0
*
__cpu_to_be32
(
ip
[
3
]));
latitude
=
__cpu_to_be32
(
ip
[
0
])
/
(
1
.
0
*
__cpu_to_be32
(
ip
[
1
]))
+
__cpu_to_be32
(
ip
[
2
])
/
(
60
.
0
*
__cpu_to_be32
(
ip
[
3
]));
if
((
state
->
kml_exif
[
Exif_GPSInfo_GPSLatitudeRef_Index
].
ltag
==
Exif_GPSInfo_GPSLatitudeRef
)
&&
if
((
state
->
kml_exif
[
Exif_GPSInfo_GPSLatitudeRef_Index
].
ltag
==
Exif_GPSInfo_GPSLatitudeRef
)
&&
(
state
->
ed
[
port
][
state
->
kml_exif
[
Exif_GPSInfo_GPSLatitudeRef_Index
].
dst
]
!=
'N'
))
latitude
=
-
latitude
;
(
state
->
ed
[
port
][
state
->
kml_exif
[
Exif_GPSInfo_GPSLatitudeRef_Index
].
dst
_exif
]
!=
'N'
))
latitude
=
-
latitude
;
D2
(
fprintf
(
debug_file
,
"(latitude) 0x%x 0x%x 0x%x 0x%x '%c'
\n
"
,
ip
[
0
],
ip
[
1
],
ip
[
2
],
ip
[
3
],
state
->
ed
[
port
][
state
->
kml_exif
[
Exif_GPSInfo_GPSLatitudeRef_Index
].
dst
]
?
'-'
:
'+'
));
D2
(
fprintf
(
debug_file
,
"(latitude) 0x%x 0x%x 0x%x 0x%x '%c'
\n
"
,
ip
[
0
],
ip
[
1
],
ip
[
2
],
ip
[
3
],
state
->
ed
[
port
][
state
->
kml_exif
[
Exif_GPSInfo_GPSLatitudeRef_Index
].
dst
_exif
]
?
'-'
:
'+'
));
}
}
// altitude - will be modified/replaced later
// altitude - will be modified/replaced later
if
(
state
->
kml_exif
[
Exif_GPSInfo_GPSAltitude_Index
].
ltag
==
Exif_GPSInfo_GPSAltitude
)
{
// Exif_GPSInfo_GPSAltitude is present in template
if
(
state
->
kml_exif
[
Exif_GPSInfo_GPSAltitude_Index
].
ltag
==
Exif_GPSInfo_GPSAltitude
)
{
// Exif_GPSInfo_GPSAltitude is present in template
ip
=
(
int
*
)
&
(
state
->
ed
[
port
][
state
->
kml_exif
[
Exif_GPSInfo_GPSAltitude_Index
].
dst
]);
ip
=
(
int
*
)
&
(
state
->
ed
[
port
][
state
->
kml_exif
[
Exif_GPSInfo_GPSAltitude_Index
].
dst
_exif
]);
altitude
=
(
1
.
0
*
__cpu_to_be32
(
ip
[
0
]))
/
__cpu_to_be32
(
ip
[
1
]);
altitude
=
(
1
.
0
*
__cpu_to_be32
(
ip
[
0
]))
/
__cpu_to_be32
(
ip
[
1
]);
if
((
state
->
kml_exif
[
Exif_GPSInfo_GPSAltitudeRef_Index
].
ltag
==
Exif_GPSInfo_GPSAltitudeRef
)
&&
if
((
state
->
kml_exif
[
Exif_GPSInfo_GPSAltitudeRef_Index
].
ltag
==
Exif_GPSInfo_GPSAltitudeRef
)
&&
(
state
->
ed
[
port
][
state
->
kml_exif
[
Exif_GPSInfo_GPSAltitudeRef_Index
].
dst
]
!=
'\0'
))
altitude
=
-
altitude
;
(
state
->
ed
[
port
][
state
->
kml_exif
[
Exif_GPSInfo_GPSAltitudeRef_Index
].
dst
_exif
]
!=
'\0'
))
altitude
=
-
altitude
;
D2
(
fprintf
(
debug_file
,
"(altitude) 0x%x 0x%x '%c'
\n
"
,
ip
[
0
],
ip
[
1
],
state
->
ed
[
port
][
state
->
kml_exif
[
Exif_GPSInfo_GPSAltitudeRef_Index
].
dst
]));
D2
(
fprintf
(
debug_file
,
"(altitude) 0x%x 0x%x '%c'
\n
"
,
ip
[
0
],
ip
[
1
],
state
->
ed
[
port
][
state
->
kml_exif
[
Exif_GPSInfo_GPSAltitudeRef_Index
].
dst
_exif
]));
}
}
D1
(
fprintf
(
debug_file
,
"longitude=%f, latitude=%f, altitude=%f
\n
"
,
longitude
,
latitude
,
altitude
));
D1
(
fprintf
(
debug_file
,
"longitude=%f, latitude=%f, altitude=%f
\n
"
,
longitude
,
latitude
,
altitude
));
// heading - no processing of "True/Magnetic" Exif_GPSInfo_CompassDirectionRef now (always M)
// heading - no processing of "True/Magnetic" Exif_GPSInfo_CompassDirectionRef now (always M)
if
(
state
->
kml_exif
[
Exif_GPSInfo_CompassDirection_Index
].
ltag
==
Exif_GPSInfo_CompassDirection
)
{
// Exif_GPSInfo_CompassDirection is present in template
if
(
state
->
kml_exif
[
Exif_GPSInfo_CompassDirection_Index
].
ltag
==
Exif_GPSInfo_CompassDirection
)
{
// Exif_GPSInfo_CompassDirection is present in template
ip
=
(
int
*
)
&
(
state
->
ed
[
port
][
state
->
kml_exif
[
Exif_GPSInfo_CompassDirection_Index
].
dst
]);
ip
=
(
int
*
)
&
(
state
->
ed
[
port
][
state
->
kml_exif
[
Exif_GPSInfo_CompassDirection_Index
].
dst
_exif
]);
heading
=
(
1
.
0
*
__cpu_to_be32
(
ip
[
0
]))
/
__cpu_to_be32
(
ip
[
1
]);
heading
=
(
1
.
0
*
__cpu_to_be32
(
ip
[
0
]))
/
__cpu_to_be32
(
ip
[
1
]);
D2
(
fprintf
(
debug_file
,
"(heading) 0x%x 0x%x
\n
"
,
ip
[
0
],
ip
[
1
]));
D2
(
fprintf
(
debug_file
,
"(heading) 0x%x 0x%x
\n
"
,
ip
[
0
],
ip
[
1
]));
}
}
// processing 'hacked' pitch and roll (made of Exif destination latitude/longitude)
// processing 'hacked' pitch and roll (made of Exif destination latitude/longitude)
if
(
state
->
kml_exif
[
Exif_GPSInfo_CompassRoll_Index
].
ltag
==
Exif_GPSInfo_CompassRoll
)
{
// Exif_GPSInfo_CompassRoll is present in template
if
(
state
->
kml_exif
[
Exif_GPSInfo_CompassRoll_Index
].
ltag
==
Exif_GPSInfo_CompassRoll
)
{
// Exif_GPSInfo_CompassRoll is present in template
ip
=
(
int
*
)
&
(
state
->
ed
[
state
->
kml_exif
[
Exif_GPSInfo_CompassRoll_Index
].
dst
]);
ip
=
(
int
*
)
&
(
state
->
ed
[
state
->
kml_exif
[
Exif_GPSInfo_CompassRoll_Index
].
dst
_exif
]);
roll
=
__cpu_to_be32
(
ip
[
0
])
/
(
1
.
0
*
__cpu_to_be32
(
ip
[
1
]))
+
__cpu_to_be32
(
ip
[
2
])
/
(
60
.
0
*
__cpu_to_be32
(
ip
[
3
]));
roll
=
__cpu_to_be32
(
ip
[
0
])
/
(
1
.
0
*
__cpu_to_be32
(
ip
[
1
]))
+
__cpu_to_be32
(
ip
[
2
])
/
(
60
.
0
*
__cpu_to_be32
(
ip
[
3
]));
if
((
state
->
kml_exif
[
Exif_GPSInfo_CompassRollRef_Index
].
ltag
==
Exif_GPSInfo_CompassRollRef
)
&&
if
((
state
->
kml_exif
[
Exif_GPSInfo_CompassRollRef_Index
].
ltag
==
Exif_GPSInfo_CompassRollRef
)
&&
(
state
->
ed
[
port
][
state
->
kml_exif
[
Exif_GPSInfo_CompassRollRef_Index
].
dst
]
!=
EXIF_COMPASS_ROLL_ASCII
[
0
]))
roll
=
-
roll
;
(
state
->
ed
[
port
][
state
->
kml_exif
[
Exif_GPSInfo_CompassRollRef_Index
].
dst
_exif
]
!=
EXIF_COMPASS_ROLL_ASCII
[
0
]))
roll
=
-
roll
;
D2
(
fprintf
(
debug_file
,
"(roll) 0x%x 0x%x '%c'
\n
"
,
ip
[
0
],
ip
[
1
],
state
->
ed
[
port
][
state
->
kml_exif
[
Exif_GPSInfo_CompassRollRef_Index
].
dst
]));
D2
(
fprintf
(
debug_file
,
"(roll) 0x%x 0x%x '%c'
\n
"
,
ip
[
0
],
ip
[
1
],
state
->
ed
[
port
][
state
->
kml_exif
[
Exif_GPSInfo_CompassRollRef_Index
].
dst
_exif
]));
}
}
if
(
state
->
kml_exif
[
Exif_GPSInfo_CompassPitch_Index
].
ltag
==
Exif_GPSInfo_CompassPitch
)
{
// Exif_GPSInfo_CompassPitch is present in template
if
(
state
->
kml_exif
[
Exif_GPSInfo_CompassPitch_Index
].
ltag
==
Exif_GPSInfo_CompassPitch
)
{
// Exif_GPSInfo_CompassPitch is present in template
ip
=
(
int
*
)
&
(
state
->
ed
[
port
][
state
->
kml_exif
[
Exif_GPSInfo_CompassPitch_Index
].
dst
]);
ip
=
(
int
*
)
&
(
state
->
ed
[
port
][
state
->
kml_exif
[
Exif_GPSInfo_CompassPitch_Index
].
dst
_exif
]);
pitch
=
__cpu_to_be32
(
ip
[
0
])
/
(
1
.
0
*
__cpu_to_be32
(
ip
[
1
]))
+
__cpu_to_be32
(
ip
[
2
])
/
(
60
.
0
*
__cpu_to_be32
(
ip
[
3
]));
pitch
=
__cpu_to_be32
(
ip
[
0
])
/
(
1
.
0
*
__cpu_to_be32
(
ip
[
1
]))
+
__cpu_to_be32
(
ip
[
2
])
/
(
60
.
0
*
__cpu_to_be32
(
ip
[
3
]));
if
((
state
->
kml_exif
[
Exif_GPSInfo_CompassPitchRef_Index
].
ltag
==
Exif_GPSInfo_CompassPitchRef
)
&&
if
((
state
->
kml_exif
[
Exif_GPSInfo_CompassPitchRef_Index
].
ltag
==
Exif_GPSInfo_CompassPitchRef
)
&&
(
state
->
ed
[
port
][
state
->
kml_exif
[
Exif_GPSInfo_CompassPitchRef_Index
].
dst
]
!=
EXIF_COMPASS_PITCH_ASCII
[
0
]))
pitch
=
-
pitch
;
(
state
->
ed
[
port
][
state
->
kml_exif
[
Exif_GPSInfo_CompassPitchRef_Index
].
dst
_exif
]
!=
EXIF_COMPASS_PITCH_ASCII
[
0
]))
pitch
=
-
pitch
;
D2
(
fprintf
(
debug_file
,
"(pitch) 0x%x 0x%x '%c'
\n
"
,
ip
[
0
],
ip
[
1
],
state
->
ed
[
port
][
state
->
kml_exif
[
Exif_GPSInfo_CompassPitchRef_Index
].
dst
]));
D2
(
fprintf
(
debug_file
,
"(pitch) 0x%x 0x%x '%c'
\n
"
,
ip
[
0
],
ip
[
1
],
state
->
ed
[
port
][
state
->
kml_exif
[
Exif_GPSInfo_CompassPitchRef_Index
].
dst
_exif
]));
}
}
// convert from GPS heading, pitch, roll to KML heading, tilt, roll
// convert from GPS heading, pitch, roll to KML heading, tilt, roll
tilt
=
pitch
+
90
.
0
;
tilt
=
pitch
+
90
.
0
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment