File Coverage

blib/lib/Image/ExifTool/InfiRay.pm
Criterion Covered Total %
statement 6 6 100.0
branch n/a
condition n/a
subroutine 2 2 100.0
pod n/a
total 8 8 100.0


line stmt bran cond sub pod time code
1             #------------------------------------------------------------------------------
2             # File: InfiRay.pm
3             #
4             # Description: InfiRay IJPEG thermal image metadata
5             #
6             # Revisions: 2023-02-08 - M. Del Sol Created
7             #
8             # References: 1) https://github.com/exiftool/exiftool/pull/184
9             #
10             # Notes: Information in this document has been mostly gathered by
11             # disassembling the P2 Pro Android app, version 1.0.8.230111.
12             #------------------------------------------------------------------------------
13              
14             package Image::ExifTool::InfiRay;
15              
16 1     1   4722 use strict;
  1         3  
  1         33  
17 1     1   5 use vars qw($VERSION);
  1         2  
  1         702  
18              
19             $VERSION = '1.00';
20              
21             my %convFloat2 = ( PrintConv => 'sprintf("%.2f", $val)' );
22             my %convPercent = ( PrintConv => 'sprintf("%.1f %%", $val * 100)' );
23             my %convMeters = ( PrintConv => 'sprintf("%.2f m", $val)' );
24             my %convCelsius = ( PrintConv => 'sprintf("%.2f C", $val)' );
25              
26             # InfiRay IJPEG version header, found in JPEGs APP2
27             %Image::ExifTool::InfiRay::Version = (
28             GROUPS => { 0 => 'APP2', 2 => 'Image' },
29             PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
30             VARS => { NO_LOOKUP => 1 }, # omit tags from lookup
31             NOTES => q{
32             This table lists tags found in the InfiRay APP2 IJPEG version header, found
33             in JPEGs taken with the P2 Pro camera app.
34             },
35             0x00 => { Name => 'IJPEGVersion', Format => 'int8u[4]' },
36             # 0x04 => { Name => 'IJPEGSignature', Format => 'string[6]' }, # "IJPEG\0"
37             0x0c => { Name => 'IJPEGOrgType', Format => 'int8u' },
38             0x0d => { Name => 'IJPEGDispType', Format => 'int8u' },
39             0x0e => { Name => 'IJPEGRotate', Format => 'int8u' },
40             0x0f => { Name => 'IJPEGMirrorFlip', Format => 'int8u' },
41             0x10 => { Name => 'ImageColorSwitchable', Format => 'int8u' },
42             0x11 => { Name => 'ThermalColorPalette', Format => 'int16u' },
43             0x20 => { Name => 'IRDataSize', Format => 'int64u' },
44             0x28 => { Name => 'IRDataFormat', Format => 'int16u' },
45             0x2a => { Name => 'IRImageWidth', Format => 'int16u' },
46             0x2c => { Name => 'IRImageHeight', Format => 'int16u' },
47             0x2e => { Name => 'IRImageBpp', Format => 'int8u' },
48             0x30 => { Name => 'TempDataSize', Format => 'int64u' },
49             0x38 => { Name => 'TempDataFormat', Format => 'int16u' },
50             0x3a => { Name => 'TempImageWidth', Format => 'int16u' },
51             0x3c => { Name => 'TempImageHeight', Format => 'int16u' },
52             0x3e => { Name => 'TempImageBpp', Format => 'int8u' },
53             0x40 => { Name => 'VisibleDataSize', Format => 'int64u' },
54             0x48 => { Name => 'VisibleDataFormat', Format => 'int16u' },
55             0x4a => { Name => 'VisibleImageWidth', Format => 'int16u' },
56             0x4c => { Name => 'VisibleImageHeight', Format => 'int16u' },
57             0x4e => { Name => 'VisibleImageBpp', Format => 'int8u' },
58             );
59              
60             # InfiRay IJPEG factory temperature, found in IJPEG's APP4 section
61             %Image::ExifTool::InfiRay::Factory = (
62             GROUPS => { 0 => 'APP4', 2 => 'Image' },
63             PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
64             VARS => { NO_LOOKUP => 1 }, # omit tags from lookup
65             NOTES => q{
66             This table lists tags found in the InfiRay APP4 IJPEG camera factory
67             defaults and calibration data.
68             },
69             0x00 => { Name => 'IJPEGTempVersion', Format => 'int8u[4]' },
70             0x04 => { Name => 'FactDefEmissivity', Format => 'int8s' },
71             0x05 => { Name => 'FactDefTau', Format => 'int8s' },
72             0x06 => { Name => 'FactDefTa', Format => 'int16s' },
73             0x08 => { Name => 'FactDefTu', Format => 'int16s' },
74             0x0a => { Name => 'FactDefDist', Format => 'int16s' },
75             0x0c => { Name => 'FactDefA0', Format => 'int32s' },
76             0x10 => { Name => 'FactDefB0', Format => 'int32s' },
77             0x14 => { Name => 'FactDefA1', Format => 'int32s' },
78             0x18 => { Name => 'FactDefB1', Format => 'int32s' },
79             0x1c => { Name => 'FactDefP0', Format => 'int32s' },
80             0x20 => { Name => 'FactDefP1', Format => 'int32s' },
81             0x24 => { Name => 'FactDefP2', Format => 'int32s' },
82             0x44 => { Name => 'FactRelSensorTemp', Format => 'int16s' },
83             0x46 => { Name => 'FactRelShutterTemp', Format => 'int16s' },
84             0x48 => { Name => 'FactRelLensTemp', Format => 'int16s' },
85             0x64 => { Name => 'FactStatusGain', Format => 'int8s' },
86             0x65 => { Name => 'FactStatusEnvOK', Format => 'int8s' },
87             0x66 => { Name => 'FactStatusDistOK', Format => 'int8s' },
88             0x67 => { Name => 'FactStatusTempMap', Format => 'int8s' },
89             # Missing: ndist_table_len, ndist_table, nuc_t_table_len, nuc_t_table
90             );
91              
92             # InfiRay IJPEG picture temperature information, found in IJPEG's APP5 section
93             %Image::ExifTool::InfiRay::Picture = (
94             GROUPS => { 0 => 'APP5', 2 => 'Image' },
95             PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
96             VARS => { NO_LOOKUP => 1 }, # omit tags from lookup
97             NOTES => q{
98             This table lists tags found in the InfiRay APP5 IJPEG picture temperature
99             information.
100             },
101             0x00 => { Name => 'EnvironmentTemp', Format => 'float', %convCelsius },
102             0x04 => { Name => 'Distance', Format => 'float', %convMeters },
103             0x08 => { Name => 'Emissivity', Format => 'float', %convFloat2 },
104             0x0c => { Name => 'Humidity', Format => 'float', %convPercent },
105             0x10 => { Name => 'ReferenceTemp', Format => 'float', %convCelsius },
106             0x20 => { Name => 'TempUnit', Format => 'int8u' },
107             0x21 => { Name => 'ShowCenterTemp', Format => 'int8u' },
108             0x22 => { Name => 'ShowMaxTemp', Format => 'int8u' },
109             0x23 => { Name => 'ShowMinTemp', Format => 'int8u' },
110             0x24 => { Name => 'TempMeasureCount', Format => 'int16u' },
111             # TODO: process extra measurements list
112             );
113              
114             # InfiRay IJPEG visual-infrared mixing mode, found in IJPEG's APP6 section
115             %Image::ExifTool::InfiRay::MixMode = (
116             GROUPS => { 0 => 'APP6', 2 => 'Image' },
117             PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
118             VARS => { NO_LOOKUP => 1 }, # omit tags from lookup
119             NOTES => q{
120             This table lists tags found in the InfiRay APP6 IJPEG visual-infrared mixing
121             mode section.
122             },
123             0x00 => { Name => 'MixMode', Format => 'int8u' },
124             0x01 => { Name => 'FusionIntensity', Format => 'float', %convPercent },
125             0x05 => { Name => 'OffsetAdjustment', Format => 'float' },
126             0x09 => { Name => 'CorrectionAsix', Format => 'float[30]' },
127             );
128              
129             # InfiRay IJPEG camera operation mode, found in IJPEG's APP7 section
130             #
131             # I do not know in what units these times are, or what do they represent.
132             %Image::ExifTool::InfiRay::OpMode = (
133             GROUPS => { 0 => 'APP7', 2 => 'Image' },
134             PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
135             VARS => { NO_LOOKUP => 1 }, # omit tags from lookup
136             NOTES => q{
137             This table lists tags found in the InfiRay APP7 IJPEG camera operation mode
138             section.
139             },
140             0x00 => { Name => 'WorkingMode', Format => 'int8u' },
141             0x01 => { Name => 'IntegralTime', Format => 'int32u' },
142             0x05 => { Name => 'IntegratTimeHdr', Format => 'int32u' },
143             0x09 => { Name => 'GainStable', Format => 'int8u' },
144             0x0a => { Name => 'TempControlEnable', Format => 'int8u' },
145             0x0b => { Name => 'DeviceTemp', Format => 'float', %convCelsius },
146             );
147              
148             # InfiRay IJPEG isothermal information, found in IJPEG's APP8 section
149             #
150             # I have genuinely no clue what is the meaning of any of this information, or
151             # what is it used for.
152             %Image::ExifTool::InfiRay::Isothermal = (
153             GROUPS => { 0 => 'APP8', 2 => 'Image' },
154             PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
155             VARS => { NO_LOOKUP => 1 }, # omit tags from lookup
156             NOTES => q{
157             This table lists tags found in the InfiRay APP8 IJPEG picture isothermal
158             information.
159             },
160             0x00 => { Name => 'IsothermalMax', Format => 'float' },
161             0x04 => { Name => 'IsothermalMin', Format => 'float' },
162             0x08 => { Name => 'ChromaBarMax', Format => 'float' },
163             0x0c => { Name => 'ChromaBarMin', Format => 'float' },
164             );
165              
166             # InfiRay IJPEG sensor information, found in IJPEG's APP9 section
167             %Image::ExifTool::InfiRay::Sensor = (
168             GROUPS => { 0 => 'APP9', 2 => 'Image' },
169             PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
170             VARS => { NO_LOOKUP => 1 }, # omit tags from lookup
171             NOTES => q{
172             This table lists tags found in the InfiRay APP9 IJPEG sensor information
173             chunk.
174             },
175             0x000 => { Name => 'IRSensorManufacturer', Format => 'string[12]' },
176             0x040 => { Name => 'IRSensorName', Format => 'string[12]' },
177             0x080 => { Name => 'IRSensorPartNumber', Format => 'string[32]' },
178             0x0c0 => { Name => 'IRSensorSerialNumber', Format => 'string[32]' },
179             0x100 => { Name => 'IRSensorFirmware', Format => 'string[12]' },
180             0x140 => { Name => 'IRSensorAperture', Format => 'float', %convFloat2 },
181             0x144 => { Name => 'IRFocalLength', Format => 'float', %convFloat2 },
182             0x180 => { Name => 'VisibleSensorManufacturer', Format => 'string[12]' },
183             0x1c0 => { Name => 'VisibleSensorName', Format => 'string[12]' },
184             0x200 => { Name => 'VisibleSensorPartNumber', Format => 'string[32]' },
185             0x240 => { Name => 'VisibleSensorSerialNumber', Format => 'string[32]' },
186             0x280 => { Name => 'VisibleSensorFirmware', Format => 'string[12]' },
187             0x2c0 => { Name => 'VisibleSensorAperture', Format => 'float' },
188             0x2c4 => { Name => 'VisibleFocalLength', Format => 'float' },
189             );
190              
191             __END__