source: main/trunk/greenstone2/perllib/cpan/Image/ExifTool/DJI.pm@ 34921

Last change on this file since 34921 was 34921, checked in by anupama, 3 years ago

Committing the improvements to EmbeddedMetaPlugin's processing of Keywords vs other metadata fields. Keywords were literally stored as arrays of words rather than phrases in PDFs (at least in Diego's sample PDF), whereas other meta fields like Subjects and Creators stored them as arrays of phrases. To get both to work, Kathy updated EXIF to a newer version, to retrieve the actual EXIF values stored in the PDF. And Kathy and Dr Bainbridge came up with a new option that I added called apply_join_before_split_to_metafields that's a regex which can list the metadata fields to apply the join_before_split to and whcih previously always got applied to all metadata fields. Now it's applied to any *Keywords metafields by default, as that's the metafield we have experience of that behaves differently to the others, as it stores by word instead of phrases. Tested on Diego's sample PDF. Diego has double-checked it to works on his sample PDF too, setting the split char to ; and turning on the join_before_split and leaving apply_join_before_split_to_metafields at its default of .*Keywords. File changes are strings.properties for the tooltip, the plugin introducing the option and working with it and Kathy's EXIF updates affecting cpan/File and cpan/Image.

File size: 6.3 KB
Line 
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
10package Image::ExifTool::DJI;
11
12use strict;
13use vars qw($VERSION);
14use Image::ExifTool::Exif;
15use Image::ExifTool::XMP;
16use Image::ExifTool::GPS;
17
18$VERSION = '1.03';
19
20my %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
141Image::ExifTool::DJI - DJI Phantom maker notes tags
142
143=head1 SYNOPSIS
144
145This module is loaded automatically by Image::ExifTool when required.
146
147=head1 DESCRIPTION
148
149This module contains definitions required by Image::ExifTool to interpret
150the maker notes in images from some DJI Phantom drones.
151
152=head1 AUTHOR
153
154Copyright 2003-2021, Phil Harvey (philharvey66 at gmail.com)
155
156This library is free software; you can redistribute it and/or modify it
157under the same terms as Perl itself.
158
159=head1 SEE ALSO
160
161L<Image::ExifTool::TagNames/DJI Tags>,
162L<Image::ExifTool(3pm)|Image::ExifTool>
163
164=cut
Note: See TracBrowser for help on using the repository browser.