1 | #------------------------------------------------------------------------------
|
---|
2 | # File: DJI.pm
|
---|
3 | #
|
---|
4 | # Description: DJI Phantom maker notes tags
|
---|
5 | #
|
---|
6 | # Revisions: 2016-07-25 - P. Harvey Created
|
---|
7 | # 2017-06-23 - PH Added XMP tags
|
---|
8 | #------------------------------------------------------------------------------
|
---|
9 |
|
---|
10 | package Image::ExifTool::DJI;
|
---|
11 |
|
---|
12 | use strict;
|
---|
13 | use vars qw($VERSION);
|
---|
14 | use Image::ExifTool::Exif;
|
---|
15 | use Image::ExifTool::XMP;
|
---|
16 | use Image::ExifTool::GPS;
|
---|
17 |
|
---|
18 | $VERSION = '1.03';
|
---|
19 |
|
---|
20 | my %convFloat2 = (
|
---|
21 | PrintConv => 'sprintf("%+.2f", $val)',
|
---|
22 | PrintConvInv => '$val',
|
---|
23 | );
|
---|
24 |
|
---|
25 | # DJI maker notes (ref PH, mostly educated guesses based on DJI QuickTime::UserData tags)
|
---|
26 | %Image::ExifTool::DJI::Main = (
|
---|
27 | WRITE_PROC => \&Image::ExifTool::Exif::WriteExif,
|
---|
28 | CHECK_PROC => \&Image::ExifTool::Exif::CheckExif,
|
---|
29 | GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
|
---|
30 | NOTES => q{
|
---|
31 | This table lists tags found in the maker notes of images from some DJI
|
---|
32 | Phantom drones.
|
---|
33 | },
|
---|
34 | 0x01 => { Name => 'Make', Writable => 'string' },
|
---|
35 | # 0x02 - int8u[4]: "1 0 0 0", "1 1 0 0"
|
---|
36 | 0x03 => { Name => 'SpeedX', Writable => 'float', %convFloat2 }, # (guess)
|
---|
37 | 0x04 => { Name => 'SpeedY', Writable => 'float', %convFloat2 }, # (guess)
|
---|
38 | 0x05 => { Name => 'SpeedZ', Writable => 'float', %convFloat2 }, # (guess)
|
---|
39 | 0x06 => { Name => 'Pitch', Writable => 'float', %convFloat2 },
|
---|
40 | 0x07 => { Name => 'Yaw', Writable => 'float', %convFloat2 },
|
---|
41 | 0x08 => { Name => 'Roll', Writable => 'float', %convFloat2 },
|
---|
42 | 0x09 => { Name => 'CameraPitch',Writable => 'float', %convFloat2 },
|
---|
43 | 0x0a => { Name => 'CameraYaw', Writable => 'float', %convFloat2 },
|
---|
44 | 0x0b => { Name => 'CameraRoll', Writable => 'float', %convFloat2 },
|
---|
45 | );
|
---|
46 |
|
---|
47 | # thermal parameters in APP4 of DJI ZH20T images (ref forum11401)
|
---|
48 | %Image::ExifTool::DJI::ThermalParams = (
|
---|
49 | PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
|
---|
50 | GROUPS => { 0 => 'APP4', 2 => 'Image' },
|
---|
51 | NOTES => 'Thermal parameters extracted from APP4 of DJI RJPEG files from the ZH20T.',
|
---|
52 | # 0x00 - 0xaa551206 - temperature header magic number
|
---|
53 | 0x24 => { Name => 'K1', Format => 'float' },
|
---|
54 | 0x28 => { Name => 'K2', Format => 'float' },
|
---|
55 | 0x2c => { Name => 'K3', Format => 'float' },
|
---|
56 | 0x30 => { Name => 'K4', Format => 'float' },
|
---|
57 | 0x34 => { Name => 'KF', Format => 'float' },
|
---|
58 | 0x38 => { Name => 'B1', Format => 'float' },
|
---|
59 | 0x3c => { Name => 'B2', Format => 'float' },
|
---|
60 | 0x44 => { Name => 'ObjectDistance', Format => 'int16u' },
|
---|
61 | 0x46 => { Name => 'RelativeHumidity', Format => 'int16u' },
|
---|
62 | 0x48 => { Name => 'Emissivity', Format => 'int16u' },
|
---|
63 | 0x4a => { Name => 'Reflection', Format => 'int16u', },
|
---|
64 | 0x4c => { Name => 'AmbientTemperature', Format => 'int16u' }, # (aka D1)
|
---|
65 | 0x50 => { Name => 'D2', Format => 'int32s' },
|
---|
66 | 0x54 => { Name => 'KJ', Format => 'int16u' },
|
---|
67 | 0x56 => { Name => 'DB', Format => 'int16u' },
|
---|
68 | 0x58 => { Name => 'KK', Format => 'int16u' },
|
---|
69 | # 0x500 - 0x55aa1206 - device header magic number
|
---|
70 | # (nothing yet decoded from device header)
|
---|
71 | );
|
---|
72 |
|
---|
73 | %Image::ExifTool::DJI::XMP = (
|
---|
74 | %Image::ExifTool::XMP::xmpTableDefaults,
|
---|
75 | GROUPS => { 0 => 'XMP', 1 => 'XMP-drone-dji', 2 => 'Location' },
|
---|
76 | NAMESPACE => 'drone-dji',
|
---|
77 | TABLE_DESC => 'XMP DJI',
|
---|
78 | VARS => { NO_ID => 1 },
|
---|
79 | NOTES => 'XMP tags used by DJI for images from drones.',
|
---|
80 | AbsoluteAltitude => { Writable => 'real' },
|
---|
81 | RelativeAltitude => { Writable => 'real' },
|
---|
82 | GimbalRollDegree => { Writable => 'real' },
|
---|
83 | GimbalYawDegree => { Writable => 'real' },
|
---|
84 | GimbalPitchDegree => { Writable => 'real' },
|
---|
85 | FlightRollDegree => { Writable => 'real' },
|
---|
86 | FlightYawDegree => { Writable => 'real' },
|
---|
87 | FlightPitchDegree => { Writable => 'real' },
|
---|
88 | GpsLatitude => {
|
---|
89 | Name => 'GPSLatitude',
|
---|
90 | Writable => 'real',
|
---|
91 | Avoid => 1,
|
---|
92 | PrintConv => 'Image::ExifTool::GPS::ToDMS($self, $val, 1, "N")',
|
---|
93 | PrintConvInv => 'Image::ExifTool::GPS::ToDegrees($val, 1)',
|
---|
94 | },
|
---|
95 | GpsLongtitude => { # (sic)
|
---|
96 | Name => 'GPSLongtitude',
|
---|
97 | Writable => 'real',
|
---|
98 | PrintConv => 'Image::ExifTool::GPS::ToDMS($self, $val, 1, "E")',
|
---|
99 | PrintConvInv => 'Image::ExifTool::GPS::ToDegrees($val, 1)',
|
---|
100 | },
|
---|
101 | GpsLongitude => { #PH (NC)
|
---|
102 | Name => 'GPSLongitude',
|
---|
103 | Writable => 'real',
|
---|
104 | Avoid => 1,
|
---|
105 | PrintConv => 'Image::ExifTool::GPS::ToDMS($self, $val, 1, "E")',
|
---|
106 | PrintConvInv => 'Image::ExifTool::GPS::ToDegrees($val, 1)',
|
---|
107 | },
|
---|
108 | FlightXSpeed => { Writable => 'real' },
|
---|
109 | FlightYSpeed => { Writable => 'real' },
|
---|
110 | FlightZSpeed => { Writable => 'real' },
|
---|
111 | CamReverse => { }, # integer?
|
---|
112 | GimbalReverse => { }, # integer?
|
---|
113 | SelfData => { Groups => { 2 => 'Image' } },
|
---|
114 | CalibratedFocalLength => { Writable => 'real', Groups => { 2 => 'Image' } },
|
---|
115 | CalibratedOpticalCenterX => { Writable => 'real', Groups => { 2 => 'Image' } },
|
---|
116 | CalibratedOpticalCenterY => { Writable => 'real', Groups => { 2 => 'Image' } },
|
---|
117 | RtkFlag => { }, # integer?
|
---|
118 | RtkStdLon => { Writable => 'real' },
|
---|
119 | RtkStdLat => { Writable => 'real' },
|
---|
120 | RtkStdHgt => { Writable => 'real' },
|
---|
121 | DewarpData => { Groups => { 2 => 'Image' } },
|
---|
122 | DewarpFlag => { Groups => { 2 => 'Image' } }, # integer?
|
---|
123 | Latitude => {
|
---|
124 | Name => 'Latitude',
|
---|
125 | Writable => 'real',
|
---|
126 | PrintConv => 'Image::ExifTool::GPS::ToDMS($self, $val, 1, "N")',
|
---|
127 | PrintConvInv => 'Image::ExifTool::GPS::ToDegrees($val, 1)',
|
---|
128 | },
|
---|
129 | Longitude => {
|
---|
130 | Name => 'Longitude',
|
---|
131 | Writable => 'real',
|
---|
132 | PrintConv => 'Image::ExifTool::GPS::ToDMS($self, $val, 1, "E")',
|
---|
133 | PrintConvInv => 'Image::ExifTool::GPS::ToDegrees($val, 1)',
|
---|
134 | },
|
---|
135 | );
|
---|
136 |
|
---|
137 | __END__
|
---|
138 |
|
---|
139 | =head1 NAME
|
---|
140 |
|
---|
141 | Image::ExifTool::DJI - DJI Phantom maker notes tags
|
---|
142 |
|
---|
143 | =head1 SYNOPSIS
|
---|
144 |
|
---|
145 | This module is loaded automatically by Image::ExifTool when required.
|
---|
146 |
|
---|
147 | =head1 DESCRIPTION
|
---|
148 |
|
---|
149 | This module contains definitions required by Image::ExifTool to interpret
|
---|
150 | the maker notes in images from some DJI Phantom drones.
|
---|
151 |
|
---|
152 | =head1 AUTHOR
|
---|
153 |
|
---|
154 | Copyright 2003-2021, Phil Harvey (philharvey66 at gmail.com)
|
---|
155 |
|
---|
156 | This library is free software; you can redistribute it and/or modify it
|
---|
157 | under the same terms as Perl itself.
|
---|
158 |
|
---|
159 | =head1 SEE ALSO
|
---|
160 |
|
---|
161 | L<Image::ExifTool::TagNames/DJI Tags>,
|
---|
162 | L<Image::ExifTool(3pm)|Image::ExifTool>
|
---|
163 |
|
---|
164 | =cut
|
---|