exiftool_vendored 13.19.0 → 13.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -65,7 +65,7 @@ use Image::ExifTool::Exif;
65
65
  use Image::ExifTool::GPS;
66
66
  use Image::ExifTool::XMP;
67
67
 
68
- $VERSION = '4.43';
68
+ $VERSION = '4.44';
69
69
 
70
70
  sub LensIDConv($$$);
71
71
  sub ProcessNikonAVI($$$);
@@ -840,6 +840,73 @@ my %activeDLightingZ7 = (
840
840
  5 => 'Extra High',
841
841
  );
842
842
 
843
+ my %aFAreaModeCD = ( #contrast detect modes
844
+ 0 => 'Contrast-detect', # (D3)
845
+ 1 => 'Contrast-detect (normal area)', # (D90/D5000)
846
+ # (D90 and D5000 give value of 2 when set to 'Face Priority' and
847
+ # 'Subject Tracking', but I didn't have a face to shoot at or a
848
+ # moving subject to track so perhaps this value changes dynamically)
849
+ 2 => 'Contrast-detect (wide area)', # (D90/D5000)
850
+ 3 => 'Contrast-detect (face priority)', # (ViewNX)
851
+ 4 => 'Contrast-detect (subject tracking)', # (ViewNX)
852
+ 128 => 'Single', #PH (1V3)
853
+ 129 => 'Auto (41 points)', #PH (NC)
854
+ 130 => 'Subject Tracking (41 points)', #PH (NC)
855
+ 131 => 'Face Priority (41 points)', #PH (NC)
856
+ 192 => 'Pinpoint', #PH (Z7)
857
+ 193 => 'Single', #PH (Z7)
858
+ 194 => 'Dynamic', #PH (Z7)
859
+ 195 => 'Wide (S)', #PH (Z7)
860
+ 196 => 'Wide (L)', #PH (Z7)
861
+ 197 => 'Auto', #PH (Z7)
862
+ 198 => 'Auto (People)', #28 (Z7) #if no faces are detected, will record as 'Auto'. Camera setting recorded in AFAreaMode field in the MakerNotes area
863
+ 199 => 'Auto (Animal)', #28 (Z7) #if no animals are detected, will record as 'Auto'. Camera setting recorded in AFAreaMode field in the MakerNotes area
864
+ 200 => 'Normal-area AF', #28 (D6)
865
+ 201 => 'Wide-area AF', #28 (D6)
866
+ 202 => 'Face-priority AF', #28 (D6)
867
+ 203 => 'Subject-tracking AF', #28 (D6)
868
+ 204 => 'Dynamic Area (S)', #28 (Z9)
869
+ 205 => 'Dynamic Area (M)', #28 (Z9)
870
+ 206 => 'Dynamic Area (L)', #28 (Z9)
871
+ 207 => '3D-tracking', #28 (Z9)
872
+ 208 => 'Wide-Area (C1/C2)', #28 (Z8, Z9)
873
+ );
874
+
875
+ my %aFAreaModePD = ( #phase detect modes
876
+ 0 => 'Single Area', # (called "Single Point" in manual - PH)
877
+ 1 => 'Dynamic Area', #PH
878
+ 2 => 'Dynamic Area (closest subject)', #PH
879
+ 3 => 'Group Dynamic', #PH
880
+ 4 => 'Dynamic Area (9 points)', #JD/28
881
+ 5 => 'Dynamic Area (21 points)', #28
882
+ 6 => 'Dynamic Area (51 points)', #28
883
+ 7 => 'Dynamic Area (51 points, 3D-tracking)', #PH/28
884
+ 8 => 'Auto-area',
885
+ 9 => 'Dynamic Area (3D-tracking)', #PH (D5000 "3D-tracking (11 points)")
886
+ 10 => 'Single Area (wide)', #PH
887
+ 11 => 'Dynamic Area (wide)', #PH
888
+ 12 => 'Dynamic Area (wide, 3D-tracking)', #PH
889
+ 13 => 'Group Area', #PH
890
+ 14 => 'Dynamic Area (25 points)', #PH
891
+ 15 => 'Dynamic Area (72 points)', #PH
892
+ 16 => 'Group Area (HL)', #28
893
+ 17 => 'Group Area (VL)', #28
894
+ 18 => 'Dynamic Area (49 points)', #28
895
+ 128 => 'Single', #PH (1J1,1J2,1J3,1J4,1S1,1S2,1V2,1V3)
896
+ 129 => 'Auto (41 points)', #PH (1J1,1J2,1J3,1J4,1S1,1S2,1V1,1V2,1V3,AW1)
897
+ 130 => 'Subject Tracking (41 points)', #PH (1J1,1J4,1J3)
898
+ 131 => 'Face Priority (41 points)', #PH (1J1,1J3,1S1,1V2,AW1)
899
+ # 134 - seen for 1V1[PhaseDetectAF=0] (PH)
900
+ # 135 - seen for 1J2[PhaseDetectAF=4] (PH)
901
+ 192 => 'Pinpoint', #PH (NC)
902
+ 193 => 'Single', #PH (NC)
903
+ 194 => 'Dynamic', #28 (Z7)
904
+ 195 => 'Wide (S)', #PH (NC)
905
+ 196 => 'Wide (L)', #PH (NC)
906
+ 197 => 'Auto', #PH (NC)
907
+ 199 => 'Auto', #28 (Z7) Z7 has also been observed to record 197 for Auto-area (same camera, different firmware versions, early production model)
908
+ );
909
+
843
910
  my %aFAreaModeZ9 = (
844
911
  0 => 'Pinpoint',
845
912
  1 => 'Single',
@@ -853,6 +920,13 @@ my %aFAreaModeZ9 = (
853
920
  13 => 'Wide (C2)',
854
921
  );
855
922
 
923
+ my %aFDetectionMethod = (
924
+ 0 => 'Phase Detect', #thru viewfinder
925
+ 1 => 'Contrast Detect', #LiveView
926
+ 2 => 'Hybrid', #Z-series and D780
927
+ );
928
+
929
+
856
930
  my %banksZ9 = (
857
931
  0 => 'A',
858
932
  1 => 'B',
@@ -1370,7 +1444,7 @@ my %retouchValues = ( #PH
1370
1444
  54 => 'Low Key', # (S3500)
1371
1445
  );
1372
1446
 
1373
- # AF points for models with 11 focus points (eg. D3400)
1447
+ # AF points for AFInfo models with 11 focus points
1374
1448
  my %afPoints11 = (
1375
1449
  0 => '(none)',
1376
1450
  0x7ff => 'All 11 Points',
@@ -1530,7 +1604,7 @@ my %afPoints153 = (
1530
1604
  31 => 'B8', 62 => 'H13', 93 => 'C17', 124 => 'G4',
1531
1605
  );
1532
1606
 
1533
- # AF point indices for models with 81 focus points, eg. Z6/Z7/Z50 (ref 38)
1607
+ # AF point indices for models with 81 Auto-area focus points, eg. Z6/Z7/Z50 (ref 38)
1534
1608
  # - 9 rows (A-I) with 9 columns (1-9), center is E5
1535
1609
  #
1536
1610
  # 7 6 5 4 3 2 1 0
@@ -3025,15 +3099,31 @@ my %base64coord = (
3025
3099
  PrintConvInv => '$self->InverseDateTime($val,0)',
3026
3100
  },
3027
3101
  0x00b7 => [{
3102
+ Name => 'AFInfo2',
3103
+ # LiveView-enabled DSLRs introduced starting in 2007 (D3/D300)
3104
+ Condition => '$$valPt =~ /^0100/',
3105
+ SubDirectory => { TagTable => 'Image::ExifTool::Nikon::AFInfo2V0100' },
3106
+ },{
3107
+ Name => 'AFInfo2',
3108
+ # All Expeed 5 processor and most Expeed 4 processor models from 2016 - D5, D500, D850, D3400, D3500, D7500 (D5600 is v0100)
3109
+ Condition => '$$valPt =~ /^0101/',
3110
+ SubDirectory => { TagTable => 'Image::ExifTool::Nikon::AFInfo2V0101' },
3111
+ },{
3112
+ Name => 'AFInfo2',
3113
+ # Nikon 1 Series cameras
3114
+ Condition => '$$valPt =~ /^020[01]/',
3115
+ SubDirectory => { TagTable => 'Image::ExifTool::Nikon::AFInfo2V0200' },
3116
+ },{
3117
+ Name => 'AFInfo2',
3118
+ # Expeed 6 processor models - D6, D780, Z5, Z6, Z7, Z30, Z50, Z6_2, Z7_2 and Zfc
3119
+ Condition => '$$valPt =~ /^030[01]/',
3120
+ SubDirectory => { TagTable => 'Image::ExifTool::Nikon::AFInfo2V0300' },
3121
+ },{
3028
3122
  Name => 'AFInfo2',
3029
3123
  # Expeed 7 processor models - Z8 & Z9 (AFInfo2Version 0400), Z6iii & Zf (AFInfo2Version 0401)
3030
3124
  # and Z50ii (AFInfo2Version 0402)
3031
3125
  Condition => '$$valPt =~ /^040[012]/',
3032
3126
  SubDirectory => { TagTable => 'Image::ExifTool::Nikon::AFInfo2V0400' },
3033
- },{ #JD
3034
- Name => 'AFInfo2',
3035
- # (this structure may be byte swapped when rewritten by CaptureNX)
3036
- SubDirectory => { TagTable => 'Image::ExifTool::Nikon::AFInfo2' },
3037
3127
  }],
3038
3128
  0x00b8 => [{ #PH
3039
3129
  Name => 'FileInfo',
@@ -4050,127 +4140,55 @@ my %base64coord = (
4050
4140
  },
4051
4141
  );
4052
4142
 
4053
- # Nikon AF information for D3 and D300 (ref JD)
4054
- %Image::ExifTool::Nikon::AFInfo2 = (
4143
+ %Image::ExifTool::Nikon::AFInfo2V0100 = (
4055
4144
  %binaryDataAttrs,
4056
4145
  GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4057
4146
  DATAMEMBER => [ 0, 4, 6 ],
4058
- NOTES => "These tags are written by Nikon DSLR's which have the live view feature.",
4147
+ NOTES => q{
4148
+ AF information for Nikon cameras with LiveView that were introduced 2007
4149
+ thru 2015 (and the D5600 in 2016), including D3, D4, D3000, D3100-D3300,
4150
+ D5000-D5600, D6x0, D700, D7000, D7100, D810
4151
+ },
4059
4152
  0 => {
4060
4153
  Name => 'AFInfo2Version',
4061
4154
  Format => 'undef[4]',
4062
4155
  Writable => 0,
4063
4156
  RawConv => '$$self{AFInfo2Version} = $val',
4064
4157
  },
4065
- 4 => { #PH
4066
- Name => 'ContrastDetectAF',
4067
- RawConv => '$$self{ContrastDetectAF} = $val',
4068
- PrintConv => {
4069
- %offOn,
4070
- 2 => 'On (2)', #PH (Z7)
4071
- },
4072
- Notes => 'this is Off for the hybrid AF used in Nikon 1 models',
4158
+ 4 => {
4159
+ Name => 'AFDetectionMethod', #specifies phase detect or contrast detect
4160
+ RawConv => '$$self{AFDetectionMethod} = $val',
4161
+ PrintConv => \%aFDetectionMethod ,
4073
4162
  },
4074
4163
  5 => [
4075
4164
  {
4076
4165
  Name => 'AFAreaMode',
4077
- Condition => 'not $$self{ContrastDetectAF}',
4078
- Notes => 'ContrastDetectAF Off',
4079
- PrintConv => {
4080
- 0 => 'Single Area', # (called "Single Point" in manual - PH)
4081
- 1 => 'Dynamic Area', #PH
4082
- 2 => 'Dynamic Area (closest subject)', #PH
4083
- 3 => 'Group Dynamic', #PH
4084
- 4 => 'Dynamic Area (9 points)', #JD/28
4085
- 5 => 'Dynamic Area (21 points)', #28
4086
- 6 => 'Dynamic Area (51 points)', #28
4087
- 7 => 'Dynamic Area (51 points, 3D-tracking)', #PH/28
4088
- 8 => 'Auto-area',
4089
- 9 => 'Dynamic Area (3D-tracking)', #PH (D5000 "3D-tracking (11 points)")
4090
- 10 => 'Single Area (wide)', #PH
4091
- 11 => 'Dynamic Area (wide)', #PH
4092
- 12 => 'Dynamic Area (wide, 3D-tracking)', #PH
4093
- 13 => 'Group Area', #PH
4094
- 14 => 'Dynamic Area (25 points)', #PH
4095
- 15 => 'Dynamic Area (72 points)', #PH
4096
- 16 => 'Group Area (HL)', #28
4097
- 17 => 'Group Area (VL)', #28
4098
- 18 => 'Dynamic Area (49 points)', #28
4099
- 128 => 'Single', #PH (1J1,1J2,1J3,1J4,1S1,1S2,1V2,1V3)
4100
- 129 => 'Auto (41 points)', #PH (1J1,1J2,1J3,1J4,1S1,1S2,1V1,1V2,1V3,AW1)
4101
- 130 => 'Subject Tracking (41 points)', #PH (1J1,1J4,1J3)
4102
- 131 => 'Face Priority (41 points)', #PH (1J1,1J3,1S1,1V2,AW1)
4103
- # 134 - seen for 1V1[PhaseDetectAF=0] (PH)
4104
- # 135 - seen for 1J2[PhaseDetectAF=4] (PH)
4105
- 192 => 'Pinpoint', #PH (NC)
4106
- 193 => 'Single', #PH (NC)
4107
- 195 => 'Wide (S)', #PH (NC)
4108
- 196 => 'Wide (L)', #PH (NC)
4109
- 197 => 'Auto', #PH (NC)
4110
- },
4166
+ Condition => '$$self{AFDetectionMethod} == 0',
4167
+ PrintConv => \%aFAreaModePD, #phase detect
4111
4168
  },
4112
- { #PH (D3/D90/D5000)
4169
+ {
4113
4170
  Name => 'AFAreaMode',
4114
- Notes => 'ContrastDetectAF On',
4115
- PrintConv => {
4116
- 0 => 'Contrast-detect', # (D3)
4117
- 1 => 'Contrast-detect (normal area)', # (D90/D5000)
4118
- # (D90 and D5000 give value of 2 when set to 'Face Priority' and
4119
- # 'Subject Tracking', but I didn't have a face to shoot at or a
4120
- # moving subject to track so perhaps this value changes dynamically)
4121
- 2 => 'Contrast-detect (wide area)', # (D90/D5000)
4122
- 3 => 'Contrast-detect (face priority)', # (ViewNX)
4123
- 4 => 'Contrast-detect (subject tracking)', # (ViewNX)
4124
- 128 => 'Single', #PH (1V3)
4125
- 129 => 'Auto (41 points)', #PH (NC)
4126
- 130 => 'Subject Tracking (41 points)', #PH (NC)
4127
- 131 => 'Face Priority (41 points)', #PH (NC)
4128
- 192 => 'Pinpoint', #PH (Z7)
4129
- 193 => 'Single', #PH (Z7)
4130
- 194 => 'Dynamic', #PH (Z7)
4131
- 195 => 'Wide (S)', #PH (Z7)
4132
- 196 => 'Wide (L)', #PH (Z7)
4133
- 197 => 'Auto', #PH (Z7)
4134
- 198 => 'Auto (People)', #28 (Z7) #if no faces are detected, will record as 'Auto'. Camera setting recorded in AFAreaMode field in the MakerNotes area
4135
- 199 => 'Auto (Animal)', #28 (Z7) #if no animals are detected, will record as 'Auto'. Camera setting recorded in AFAreaMode field in the MakerNotes area
4136
- 200 => 'Normal-area AF', #28 (D6)
4137
- 201 => 'Wide-area AF', #28 (D6)
4138
- 202 => 'Face-priority AF', #28 (D6)
4139
- 203 => 'Subject-tracking AF', #28 (D6)
4140
- 204 => 'Dynamic Area (S)', #28 (Z9)
4141
- 205 => 'Dynamic Area (M)', #28 (Z9)
4142
- 206 => 'Dynamic Area (L)', #28 (Z9)
4143
- 207 => '3D-tracking', #28 (Z9)
4144
- 208 => 'Wide-Area (C1/C2)', #28 (Z8, Z9)
4145
- },
4171
+ PrintConv => \%aFAreaModeCD, #contrast detect
4146
4172
  },
4147
4173
  ],
4148
4174
  6 => {
4149
- Name => 'PhaseDetectAF', #JD(AutoFocus), PH(PhaseDetectAF)
4150
- Notes => 'PrimaryAFPoint and AFPointsUsed below are only valid when this is On',
4151
- RawConv => '$$self{PhaseDetectAF} = $val',
4175
+ Name => 'FocusPointSchema',
4176
+ RawConv => '$$self{FocusPointSchema} = $val',
4177
+ Hidden => 1,
4152
4178
  PrintConv => {
4153
- # [observed AFAreaMode values in square brackets for each PhaseDetectAF value]
4154
- 0 => 'Off',
4155
- 1 => 'On (51-point)', #PH
4156
- 2 => 'On (11-point)', #PH
4157
- 3 => 'On (39-point)', #29 (D7000)
4158
- 4 => 'On (73-point)', #PH (1J1[128/129],1J2[128/129/135],1J3/1S1/1V2[128/129/131],1V1[129],AW1[129/131])
4159
- 5 => 'On (5)', #PH (1S2[128/129], 1J4/1V3[129])
4160
- 6 => 'On (105-point)', #PH (1J4/1V3[128/130])
4161
- 7 => 'On (153-point)', #PH (D5/D500/D850)
4162
- 8 => 'On (81-point)', #38
4163
- 9 => 'On (105-point)', #28 (D6)
4179
+ 0 => 'Off', # LiveView or manual focus or no focus
4180
+ 1 => '51-point', # (D3/D3S/D3X/D4/D4S/D300/D300S/D700/D750/D800/D800E/D810/D7100/D7200)
4181
+ 2 => '11-point', # (D90/D3000/D3100/D3200/D3300/D5000/D5100)
4182
+ 3 => '39-point', # (D600/D610/D5200/D5300/D5500/D5600/D7000/Df)
4164
4183
  },
4165
4184
  },
4166
4185
  7 => [
4167
4186
  { #PH/JD
4168
4187
  Name => 'PrimaryAFPoint',
4169
- # PrimaryAFPoint may only be valid for PhaseDetect - certainly true on the D6, possibly other bodies? (ref 28)
4170
- Condition => '$$self{PhaseDetectAF} < 2 and $$self{AFInfo2Version} !~ /^03/',
4188
+ Condition => '$$self{FocusPointSchema} == 1', #51 focus-point models
4171
4189
  Notes => q{
4172
4190
  models with 51-point AF -- 5 rows (A-E) and 11 columns (1-11): D3, D3S, D3X,
4173
- D4, D4S, D300, D300S, D700, D800, D800e and D810
4191
+ D4, D4S, D300, D300S, D700, D750, D800, D800E, D810, D7100 and D7200
4174
4192
  },
4175
4193
  PrintConvColumns => 5,
4176
4194
  PrintConv => {
@@ -4178,11 +4196,10 @@ my %base64coord = (
4178
4196
  %afPoints51,
4179
4197
  1 => 'C6 (Center)', # (add " (Center)" to central point)
4180
4198
  },
4181
- },
4182
- { #10
4199
+ },{ #10
4183
4200
  Name => 'PrimaryAFPoint',
4184
- Notes => 'models with 11-point AF: D90, D3000, D3100, D5000 and D5100',
4185
- Condition => '$$self{PhaseDetectAF} == 2',
4201
+ Notes => 'models with 11-point AF: D90, D3000-D3300, D5000 and D5100',
4202
+ Condition => '$$self{FocusPointSchema} == 2', #11 focus-point models
4186
4203
  PrintConvColumns => 2,
4187
4204
  PrintConv => {
4188
4205
  0 => '(none)',
@@ -4198,11 +4215,10 @@ my %base64coord = (
4198
4215
  10 => 'Lower-right',
4199
4216
  11 => 'Far Right',
4200
4217
  },
4201
- },
4202
- { #29
4218
+ },{ #29
4203
4219
  Name => 'PrimaryAFPoint',
4204
- Condition => '$$self{PhaseDetectAF} == 3',
4205
- Notes => 'models with 39-point AF: D600 and D7000',
4220
+ Condition => '$$self{FocusPointSchema} == 3', #39 focus-point models
4221
+ Notes => 'models with 39-point AF: D600, D610, D5200-D5600, D7000 and Df',
4206
4222
  PrintConvColumns => 5,
4207
4223
  PrintConv => {
4208
4224
  0 => '(none)',
@@ -4210,83 +4226,181 @@ my %base64coord = (
4210
4226
  1 => 'C6 (Center)', # (add " (Center)" to central point)
4211
4227
  },
4212
4228
  },
4213
- { #PH
4229
+ {
4214
4230
  Name => 'PrimaryAFPoint',
4215
- Condition => '$$self{PhaseDetectAF} == 4',
4216
- Notes => 'Nikon 1 models with older 135-point AF and 73-point phase-detect AF',
4217
- PrintConvColumns => 5,
4218
- PrintConv => {
4219
- 0 => '(none)',
4220
- %afPoints135,
4221
- 1 => 'E8 (Center)', # (add " (Center)" to central point)
4222
- },
4231
+ Condition => '$$self{FocusPointSchema} == 0', #LiveView or manual focus or no focus (reporting only for purposes of backward compatibility with v13.19 and earlier)
4232
+ PrintConv => { 0 => '(none)', },
4223
4233
  },
4224
- { #PH (NC)
4225
- Name => 'PrimaryAFPoint',
4226
- Condition => '$$self{PhaseDetectAF} == 5',
4234
+ ],
4235
+ 8 => [
4236
+ { #JD/PH
4237
+ Name => 'AFPointsUsed',
4238
+ Condition => '$$self{FocusPointSchema} == 1', # 51 focus-point models
4227
4239
  Notes => q{
4228
- Nikon 1 models with newer 135-point AF and 73-point phase-detect AF -- 9
4229
- rows (B-J) and 15 columns (1-15), inside a grid of 11 rows by 15 columns.
4230
- The points are numbered sequentially, with F8 at the center
4240
+ models with 51-point AF -- 5 rows: A1-9, B1-11, C1-11, D1-11, E1-9. Center
4241
+ point is C6
4231
4242
  },
4243
+ Format => 'undef[7]',
4244
+ ValueConv => 'join(" ", unpack("H2"x7, $val))',
4245
+ ValueConvInv => '$val=~tr/ //d; pack("H*",$val)',
4246
+ PrintConv => sub { PrintAFPoints(shift, \%afPoints51) },
4247
+ PrintConvInv => sub { PrintAFPointsInv(shift, \%afPoints51) },
4248
+ },
4249
+ { #10
4250
+ Name => 'AFPointsUsed',
4251
+ Condition => '$$self{FocusPointSchema} == 2', # 11 focus-point models
4252
+ Notes => 'models with 11-point AF',
4253
+ # read as int16u in little-endian byte order
4254
+ Format => 'undef[2]',
4255
+ ValueConv => 'unpack("v",$val)',
4256
+ ValueConvInv => 'pack("v",$val)',
4257
+ PrintConvColumns => 2,
4232
4258
  PrintConv => {
4233
4259
  0 => '(none)',
4234
- 82 => 'F8 (Center)',
4235
- OTHER => sub {
4236
- my ($val, $inv) = @_;
4237
- return GetAFPointGrid($val, 15, $inv);
4260
+ 0x7ff => 'All 11 Points',
4261
+ BITMASK => {
4262
+ 0 => 'Center',
4263
+ 1 => 'Top',
4264
+ 2 => 'Bottom',
4265
+ 3 => 'Mid-left',
4266
+ 4 => 'Upper-left',
4267
+ 5 => 'Lower-left',
4268
+ 6 => 'Far Left',
4269
+ 7 => 'Mid-right',
4270
+ 8 => 'Upper-right',
4271
+ 9 => 'Lower-right',
4272
+ 10 => 'Far Right',
4238
4273
  },
4239
4274
  },
4240
4275
  },
4241
- { #PH
4242
- Name => 'PrimaryAFPoint',
4243
- Condition => '$$self{PhaseDetectAF} == 6',
4276
+ { #29/PH
4277
+ Name => 'AFPointsUsed',
4278
+ Condition => '$$self{FocusPointSchema} == 3', # 39 focus-point models
4244
4279
  Notes => q{
4245
- Nikon 1 models with 171-point AF and 105-point phase-detect AF -- 9 rows
4246
- (B-J) and 19 columns (2-20), inside a grid of 11 rows by 21 columns. The
4247
- points are numbered sequentially, with F11 at the center
4248
- },
4249
- PrintConv => {
4250
- 0 => '(none)',
4251
- #22 => 'B2 (Top-left)',
4252
- #40 => 'B20 (Top-right)',
4253
- 115 => 'F11 (Center)',
4254
- #190 => 'J2 (Bottom-left)',
4255
- #208 => 'J20 (Bottom-right)',
4256
- OTHER => sub {
4257
- my ($val, $inv) = @_;
4258
- return GetAFPointGrid($val, 21, $inv);
4259
- },
4280
+ models with 39-point AF -- 5 rows: A1-3, B1-11, C1-11, D1-11, E1-3. Center
4281
+ point is C6
4260
4282
  },
4283
+ Format => 'undef[5]',
4284
+ ValueConv => 'join(" ", unpack("H2"x5, $val))',
4285
+ ValueConvInv => '$val=~tr/ //d; pack("H*",$val)',
4286
+ PrintConv => sub { PrintAFPoints(shift, \%afPoints39) },
4287
+ PrintConvInv => sub { PrintAFPointsInv(shift, \%afPoints39) },
4261
4288
  },
4289
+ {
4290
+ Name => 'AFPointsUsed',
4291
+ Condition => '$$self{FocusPointSchema} == 0', #LiveView or manual focus or no focus (reporting only for purposes of backward compatibility with v13.19 and earlier)
4292
+ PrintConv => { 0 => '(none)', },
4293
+ },
4294
+ ],
4295
+ 0x10 => { #PH (D90 and D5000)
4296
+ Name => 'AFImageWidth',
4297
+ Condition => '$$self{AFDetectionMethod} == 1', #contrast detect
4298
+ Format => 'int16u',
4299
+ RawConv => '$val ? $val : undef',
4300
+ Notes => 'this and the following tags are valid only for contrast-detect AF',
4301
+ },
4302
+ 0x12 => { #PH
4303
+ Name => 'AFImageHeight',
4304
+ Condition => '$$self{AFDetectionMethod} == 1', #contrast detect
4305
+ Format => 'int16u',
4306
+ RawConv => '$val ? $val : undef',
4307
+ },
4308
+ 0x14 => { #PH
4309
+ Name => 'AFAreaXPosition',
4310
+ Condition => '$$self{AFDetectionMethod} == 1', #contrast detect
4311
+ Notes => 'center of AF area in AFImage coordinates',
4312
+ Format => 'int16u',
4313
+ RawConv => '$val ? $val : undef',
4314
+ },
4315
+ 0x16 => { #PH
4316
+ Name => 'AFAreaYPosition',
4317
+ Condition => '$$self{AFDetectionMethod} == 1', #contrast detect
4318
+ Format => 'int16u',
4319
+ RawConv => '$val ? $val : undef',
4320
+ },
4321
+ 0x18 => { #PH
4322
+ Name => 'AFAreaWidth',
4323
+ Condition => '$$self{AFDetectionMethod} == 1', #contrast detect
4324
+ Format => 'int16u',
4325
+ Notes => 'size of AF area in AFImage coordinates',
4326
+ RawConv => '$val ? $val : undef',
4327
+ },
4328
+ 0x1a => { #PH
4329
+ Name => 'AFAreaHeight',
4330
+ Condition => '$$self{AFDetectionMethod} == 1', #contrast detect
4331
+ Format => 'int16u',
4332
+ RawConv => '$val ? $val : undef',
4333
+ },
4334
+ 0x1c => [
4262
4335
  { #PH
4263
- Name => 'PrimaryAFPoint',
4264
- Condition => '$$self{PhaseDetectAF} == 7 and $$self{AFInfo2Version} eq "0100"',
4265
- Notes => q{
4266
- Nikon models with 153-point AF -- 9 rows (A-I) and 17 columns (1-17): D5,
4267
- D500 and D850
4268
- },
4269
- PrintConvColumns => 5,
4270
- PrintConv => {
4271
- 0 => '(none)',
4272
- %afPoints153,
4273
- 1 => 'E9 (Center)',
4274
- },
4336
+ Name => 'ContrastDetectAFInFocus',
4337
+ Condition => '$$self{AFDetectionMethod} == 1', #contrast detect
4338
+ PrintConv => { 0 => 'No', 1 => 'Yes' },
4339
+ },{ #PH (D500, see forum11190)
4340
+ Name => 'AFPointsSelected',
4341
+ Condition => '$$self{FocusPointSchema} == 7',
4342
+ Format => 'undef[20]',
4343
+ ValueConv => 'join(" ", unpack("H2"x20, $val))',
4344
+ ValueConvInv => '$val=~tr/ //d; pack("H*",$val)',
4345
+ PrintConv => sub { PrintAFPoints(shift, \%afPoints153) },
4346
+ PrintConvInv => sub { PrintAFPointsInv(shift, \%afPoints153) },
4347
+ },
4348
+ # (#28) this is incorrect - [observed values 0, 1, 16, 64, 128, 1024 (mostly 0 & 1), but not tied to the display of focus point in NXStudio]
4349
+ #{ #PH (D3400) (NC "selected")
4350
+ # Name => 'AFPointsSelected',
4351
+ # Condition => '$$self{FocusPointSchema} == 2',
4352
+ # Format => 'int16u',
4353
+ # PrintConv => \%afPoints11,
4354
+ #},
4355
+ ],
4356
+ );
4357
+
4358
+ %Image::ExifTool::Nikon::AFInfo2V0101 = (
4359
+ %binaryDataAttrs,
4360
+ GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4361
+ DATAMEMBER => [ 0, 4, 5, 6 ],
4362
+ NOTES => q{
4363
+ AF information for Nikon cameras D5, D500, D850, D3400, D3500 and D7500
4364
+ },
4365
+ 0 => {
4366
+ Name => 'AFInfo2Version',
4367
+ Format => 'undef[4]',
4368
+ Writable => 0,
4369
+ RawConv => '$$self{AFInfo2Version} = $val',
4370
+ },
4371
+ 4 => {
4372
+ Name => 'AFDetectionMethod',
4373
+ RawConv => '$$self{AFDetectionMethod} = $val',
4374
+ PrintConv => \%aFDetectionMethod,
4375
+ },
4376
+ 5 => [
4377
+ {
4378
+ Name => 'AFAreaMode',
4379
+ Condition => '$$self{AFDetectionMethod} == 0',
4380
+ RawConv => '$$self{AFAreaMode} = $val',
4381
+ PrintConv => \%aFAreaModePD, #phase detect
4275
4382
  },
4276
4383
  {
4277
- Name => 'PrimaryAFPoint',
4278
- Condition => '$$self{AFInfo2Version} eq "0100"',
4279
- Notes => 'future models?...',
4280
- PrintConv => {
4281
- 0 => '(none)',
4282
- 1 => 'Center',
4283
- },
4384
+ Name => 'AFAreaMode',
4385
+ RawConv => '$$self{AFAreaMode} = $val',
4386
+ PrintConv => \%aFAreaModeCD, #contrast detect
4284
4387
  },
4285
4388
  ],
4389
+ 6 => {
4390
+ Name => 'FocusPointSchema',
4391
+ RawConv => '$$self{FocusPointSchema} = $val',
4392
+ Hidden => 1,
4393
+ PrintConv => {
4394
+ 0 => 'Off', # LiveView or manual focus or no focus
4395
+ 1 => '51-point', # (D7500)
4396
+ 2 => '11-point', # (D3400/D3500)
4397
+ 7 => '153-point', # (D5/D500/D850) 153 focus points (17 columns x 9 rows) - of these 55 are user selectable (11 columns x 5 rows)
4398
+ },
4399
+ },
4286
4400
  8 => [
4287
4401
  { #JD/PH
4288
4402
  Name => 'AFPointsUsed',
4289
- Condition => '$$self{PhaseDetectAF} < 2 and $$self{AFInfo2Version} !~ /^03/',
4403
+ Condition => '$$self{FocusPointSchema} == 1', #51 focus-point models
4290
4404
  Notes => q{
4291
4405
  models with 51-point AF -- 5 rows: A1-9, B1-11, C1-11, D1-11, E1-9. Center
4292
4406
  point is C6
@@ -4294,12 +4408,11 @@ my %base64coord = (
4294
4408
  Format => 'undef[7]',
4295
4409
  ValueConv => 'join(" ", unpack("H2"x7, $val))',
4296
4410
  ValueConvInv => '$val=~tr/ //d; pack("H*",$val)',
4297
- PrintConv => sub { PrintAFPoints(shift, \%afPoints51); },
4298
- PrintConvInv => sub { PrintAFPointsInv(shift, \%afPoints51); },
4299
- },
4300
- { #10
4411
+ PrintConv => sub { PrintAFPoints(shift, \%afPoints51) },
4412
+ PrintConvInv => sub { PrintAFPointsInv(shift, \%afPoints51) },
4413
+ },{ #10
4301
4414
  Name => 'AFPointsUsed',
4302
- Condition => '$$self{PhaseDetectAF} == 2',
4415
+ Condition => '$$self{FocusPointSchema} == 2', #11 focus-point models
4303
4416
  Notes => 'models with 11-point AF',
4304
4417
  # read as int16u in little-endian byte order
4305
4418
  Format => 'undef[2]',
@@ -4324,19 +4437,260 @@ my %base64coord = (
4324
4437
  },
4325
4438
  },
4326
4439
  },
4327
- { #29/PH
4328
- Name => 'AFPointsUsed',
4329
- Condition => '$$self{PhaseDetectAF} == 3',
4440
+ { #PH (D5,D500, D850)
4441
+ Name => 'AFPointsUsed', #when focus is not obtained, will report '(none)' otherwise will report a single point from among AFPointsSelected
4442
+ Condition => '$$self{FocusPointSchema} == 7', #153 focus-point models
4330
4443
  Notes => q{
4331
- models with 39-point AF -- 5 rows: A1-3, B1-11, C1-11, D1-11, E1-3. Center
4332
- point is C6
4444
+ models with 153-point AF -- 9 rows (A-I) and 17 columns (1-17). Center
4445
+ point is E9
4333
4446
  },
4334
- Format => 'undef[5]',
4335
- ValueConv => 'join(" ", unpack("H2"x5, $val))',
4447
+ Format => 'undef[20]',
4448
+ ValueConv => 'join(" ", unpack("H2"x20, $val))',
4336
4449
  ValueConvInv => '$val=~tr/ //d; pack("H*",$val)',
4337
- PrintConv => sub { PrintAFPoints(shift, \%afPoints39); },
4338
- PrintConvInv => sub { PrintAFPointsInv(shift, \%afPoints39); },
4450
+ PrintConv => sub { PrintAFPoints(shift, \%afPoints153) },
4451
+ PrintConvInv => sub { PrintAFPointsInv(shift, \%afPoints153) },
4452
+ },{
4453
+ Name => 'AFPointsUsed',
4454
+ Condition => '$$self{FocusPointSchema} == 0', #LiveView or manual focus or no focus (reporting only for purposes of backward compatibility with v13.19 and earlier)
4455
+ PrintConv => { 0 => '(none)', },
4456
+ },
4457
+ ],
4458
+ 0x1c => [
4459
+ {#PH
4460
+ Name => 'ContrastDetectAFInFocus',
4461
+ Condition => '$$self{AFDetectionMethod} == 1', #contrast detect
4462
+ PrintConv => { 0 => 'No', 1 => 'Yes' },
4463
+ },
4464
+ { #JD/PH
4465
+ Name => 'AFPointsUsed',
4466
+ Condition => '$$self{FocusPointSchema} == 1 and
4467
+ ($$self{AFAreaMode} == 8 or $$self{AFAreaMode} == 9 or $$self{AFAreaMode} == 13 )', #phase detect 51 focus-point models
4468
+ Format => 'undef[7]',
4469
+ ValueConv => 'join(" ", unpack("H2"x7, $val))',
4470
+ ValueConvInv => '$val=~tr/ //d; pack("H*",$val)',
4471
+ PrintConv => sub { PrintAFPoints(shift, \%afPoints51) },
4472
+ PrintConvInv => sub { PrintAFPointsInv(shift, \%afPoints51) },
4473
+ },{ #PH (D500, see forum11190)
4474
+ Name => 'AFPointsSelected', # where the viewfinder AF point(s) were positioned when initiating focus in AFAreaMode 3D-tracking Group-area
4475
+ # will contain a value regardless of whether or not focus was obtained
4476
+ # reflects the focus points displayed by NXStudio when AFAreaMode is Group-area
4477
+ Condition => '$$self{FocusPointSchema} == 7 and
4478
+ ($$self{AFAreaMode} == 8 or $$self{AFAreaMode} == 9 or $$self{AFAreaMode} == 13 )', #phase detect 153 focus-point models in Auto-area/3D-tracking/Group-area
4479
+ Format => 'undef[20]',
4480
+ ValueConv => 'join(" ", unpack("H2"x20, $val))',
4481
+ ValueConvInv => '$val=~tr/ //d; pack("H*",$val)',
4482
+ PrintConv => sub { PrintAFPoints(shift, \%afPoints153) },
4483
+ PrintConvInv => sub { PrintAFPointsInv(shift, \%afPoints153) },
4484
+ },
4485
+ ],
4486
+ 0x30 => [
4487
+ { #PH (D7500) (NC "in focus")
4488
+ Name => 'AFPointsInFocus', # refelcts the focus point(s) displayed by NXStudio when AFAreaMode is Auto-area or 3D-tracking.
4489
+ # erroneously named as there is no assurance the reported points are in focus
4490
+ Condition => '$$self{FocusPointSchema} == 1', #51 focus-point models
4491
+ Format => 'undef[7]',
4492
+ ValueConv => 'join(" ", unpack("H2"x7, $val))',
4493
+ ValueConvInv => '$val=~tr/ //d; pack("H*",$val)',
4494
+ PrintConv => sub { PrintAFPoints(shift, \%afPoints51) },
4495
+ PrintConvInv => sub { PrintAFPointsInv(shift, \%afPoints51) },
4496
+ },{ #PH (D500, see forum11190)
4497
+ Name => 'AFPointsInFocus',
4498
+ Condition => '$$self{FocusPointSchema} == 7', #153 focus-point models
4499
+ Notes => 'AF points in focus at the time time image was captured',
4500
+ Format => 'undef[20]',
4501
+ ValueConv => 'join(" ", unpack("H2"x20, $val))',
4502
+ ValueConvInv => '$val=~tr/ //d; pack("H*",$val)',
4503
+ PrintConv => sub { PrintAFPoints(shift, \%afPoints153) },
4504
+ PrintConvInv => sub { PrintAFPointsInv(shift, \%afPoints153) },
4505
+ },
4506
+ ],
4507
+ 0x44 => [ #AFInfoVersion 0100 use 0x08 for this tag. v0101 could do that as well. The difference is that when Group-area fails to focus..
4508
+ #...this code (incorrectly) reports a value for PrimaryAFPoint. Moving this code to the 0x08 slot would correctly report '(none)'...
4509
+ #...leaving it here for now for compatibility purposes
4510
+ { #PH/JD
4511
+ Name => 'PrimaryAFPoint',
4512
+ Condition => '$$self{FocusPointSchema} == 1', #51 focus-point models
4513
+ Notes => q{
4514
+ models with 51-point AF -- 5 rows (A-E) and 11 columns (1-11): D7500
4515
+ },
4516
+ PrintConvColumns => 5,
4517
+ PrintConv => {
4518
+ 0 => '(none)',
4519
+ %afPoints51,
4520
+ 1 => 'C6 (Center)', # (add " (Center)" to central point)
4521
+ },
4522
+ },{ #10
4523
+ Name => 'PrimaryAFPoint',
4524
+ Notes => 'models with 11-point AF: D3400, D3500',
4525
+ Condition => '$$self{FocusPointSchema} == 2', #11 focus-point models
4526
+ PrintConvColumns => 2,
4527
+ PrintConv => {
4528
+ 0 => '(none)',
4529
+ 1 => 'Center',
4530
+ 2 => 'Top',
4531
+ 3 => 'Bottom',
4532
+ 4 => 'Mid-left',
4533
+ 5 => 'Upper-left',
4534
+ 6 => 'Lower-left',
4535
+ 7 => 'Far Left',
4536
+ 8 => 'Mid-right',
4537
+ 9 => 'Upper-right',
4538
+ 10 => 'Lower-right',
4539
+ 11 => 'Far Right',
4540
+ },
4541
+ },{ #PH
4542
+ Name => 'PrimaryAFPoint',
4543
+ Condition => '$$self{FocusPointSchema} == 7', #153 focus-point models
4544
+ Notes => q{
4545
+ Nikon models with 153-point AF -- 9 rows (A-I) and 17 columns (1-17): D5,
4546
+ D500 and D850
4547
+ },
4548
+ PrintConvColumns => 5,
4549
+ PrintConv => {
4550
+ 0 => '(none)',
4551
+ %afPoints153,
4552
+ 1 => 'E9 (Center)',
4553
+ },
4554
+ },{
4555
+ Name => 'PrimaryAFPoint',
4556
+ Condition => '$$self{FocusPointSchema} == 0', #LiveView or manual focus or no focus (reporting only for purposes of backward compatibility with v13.19 and earlier)
4557
+ PrintConv => { 0 => '(none)', },
4558
+ },
4559
+ ],
4560
+ 0x46 => { #PH
4561
+ Name => 'AFImageWidth',
4562
+ Condition => '$$self{AFDetectionMethod} == 1', #contrast detect
4563
+ Format => 'int16u',
4564
+ RawConv => '$val ? $val : undef',
4565
+ Notes => 'this and the following tags are valid only for contrast-detect AF',
4566
+ },
4567
+ 0x48 => { #PH
4568
+ Name => 'AFImageHeight',
4569
+ Condition => '$$self{AFDetectionMethod} == 1', #contrast detect
4570
+ Format => 'int16u',
4571
+ RawConv => '$val ? $val : undef',
4572
+ },
4573
+ 0x4a => { #PH
4574
+ Name => 'AFAreaXPosition',
4575
+ Condition => '$$self{AFDetectionMethod} == 1', #contrast detect
4576
+ Notes => 'center of AF area in AFImage coordinates',
4577
+ Format => 'int16u',
4578
+ RawConv => '$val ? $val : undef',
4579
+ },
4580
+ 0x4c => { #PH
4581
+ Name => 'AFAreaYPosition',
4582
+ Condition => '$$self{AFDetectionMethod} == 1', #contrast detect
4583
+ Format => 'int16u',
4584
+ RawConv => '$val ? $val : undef',
4585
+ },
4586
+ 0x4e => { #PH
4587
+ Name => 'AFAreaWidth',
4588
+ Condition => '$$self{AFDetectionMethod} == 1', #contrast detect
4589
+ Format => 'int16u',
4590
+ Notes => 'size of AF area in AFImage coordinates',
4591
+ RawConv => '$val ? $val : undef',
4592
+ },
4593
+ 0x50 => { #PH
4594
+ Name => 'AFAreaHeight',
4595
+ Condition => '$$self{AFDetectionMethod} == 1', #contrast detect
4596
+ Format => 'int16u',
4597
+ RawConv => '$val ? $val : undef',
4598
+ },
4599
+ 0x52 => {
4600
+ Name => 'ContrastDetectAFInFocus',
4601
+ Condition => '$$self{AFDetectionMethod} == 1', #contrast detect
4602
+ PrintConv => { 0 => 'No', 1 => 'Yes' },
4603
+ },
4604
+ );
4605
+
4606
+ %Image::ExifTool::Nikon::AFInfo2V0200 = (
4607
+ %binaryDataAttrs,
4608
+ GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4609
+ DATAMEMBER => [ 0, 6 ],
4610
+ NOTES => q{
4611
+ AF information for Nikon 1 series cameras: Nikon 1 V1, V2, V3, J1, J2, J3,
4612
+ S1, S2 AW1.
4613
+ },
4614
+ 0 => {
4615
+ Name => 'AFInfo2Version',
4616
+ Format => 'undef[4]',
4617
+ Writable => 0,
4618
+ RawConv => '$$self{AFInfo2Version} = $val',
4619
+ },
4620
+ 5 => {
4621
+ Name => 'AFAreaMode',
4622
+ PrintConv => {
4623
+ 128 => 'Single', #PH (1J1,1J2,1J3,1J4,1S1,1S2,1V2,1V3)
4624
+ 129 => 'Auto (41 points)', #PH (1J1,1J2,1J3,1J4,1S1,1S2,1V1,1V2,1V3,AW1)
4625
+ 130 => 'Subject Tracking (41 points)', #PH (1J1,1J4,1J3)
4626
+ 131 => 'Face Priority (41 points)', #PH (1J1,1J3,1S1,1V2,AW1)
4627
+ # 134 - seen for 1V1[PhaseDetectAF=0] (PH)
4628
+ # 135 - seen for 1J2[PhaseDetectAF=4] (PH)
4629
+ },
4630
+ },
4631
+ 6 => {
4632
+ Name => 'PhaseDetectAF', #JD(AutoFocus), PH(PhaseDetectAF)
4633
+ Notes => 'PrimaryAFPoint and AFPointsUsed below are only valid when this is On',
4634
+ RawConv => '$$self{PhaseDetectAF} = $val',
4635
+ PrintConv => {
4636
+ # [observed AFAreaMode values in square brackets for each PhaseDetectAF value]
4637
+ 4 => 'On (73-point)', #PH (1J1[128/129],1J2[128/129/135],1J3/1S1/1V2[128/129/131],1V1[129],AW1[129/131])
4638
+ 5 => 'On (5)', #PH (1S2[128/129], 1J4/1V3[129])
4639
+ 6 => 'On (105-point)', #PH (1J4/1V3[128/130])
4640
+ },
4641
+ },
4642
+ 7 => [
4643
+ { #PH
4644
+ Name => 'PrimaryAFPoint',
4645
+ Condition => '$$self{PhaseDetectAF} == 4',
4646
+ Notes => 'Nikon 1 models with older 135-point AF and 73-point phase-detect AF',
4647
+ PrintConvColumns => 5,
4648
+ PrintConv => {
4649
+ 0 => '(none)',
4650
+ %afPoints135,
4651
+ 1 => 'E8 (Center)', # (add " (Center)" to central point)
4652
+ },
4339
4653
  },
4654
+ { #PH (NC)
4655
+ Name => 'PrimaryAFPoint',
4656
+ Condition => '$$self{PhaseDetectAF} == 5',
4657
+ Notes => q{
4658
+ Nikon 1 models with newer 135-point AF and 73-point phase-detect AF -- 9
4659
+ rows (B-J) and 15 columns (1-15), inside a grid of 11 rows by 15 columns.
4660
+ The points are numbered sequentially, with F8 at the center
4661
+ },
4662
+ PrintConv => {
4663
+ 0 => '(none)',
4664
+ 82 => 'F8 (Center)',
4665
+ OTHER => sub {
4666
+ my ($val, $inv) = @_;
4667
+ return GetAFPointGrid($val, 15, $inv);
4668
+ },
4669
+ },
4670
+ },
4671
+ { #PH
4672
+ Name => 'PrimaryAFPoint',
4673
+ Condition => '$$self{PhaseDetectAF} == 6',
4674
+ Notes => q{
4675
+ Nikon 1 models with 171-point AF and 105-point phase-detect AF -- 9 rows
4676
+ (B-J) and 19 columns (2-20), inside a grid of 11 rows by 21 columns. The
4677
+ points are numbered sequentially, with F11 at the center
4678
+ },
4679
+ PrintConv => {
4680
+ 0 => '(none)',
4681
+ #22 => 'B2 (Top-left)',
4682
+ #40 => 'B20 (Top-right)',
4683
+ 115 => 'F11 (Center)',
4684
+ #190 => 'J2 (Bottom-left)',
4685
+ #208 => 'J20 (Bottom-right)',
4686
+ OTHER => sub {
4687
+ my ($val, $inv) = @_;
4688
+ return GetAFPointGrid($val, 21, $inv);
4689
+ },
4690
+ },
4691
+ },
4692
+ ],
4693
+ 8 => [
4340
4694
  { #PH (1AW1,1J1,1J2,1J3,1S1,1V1,1V2)
4341
4695
  Name => 'AFPointsUsed',
4342
4696
  Condition => '$$self{PhaseDetectAF} == 4',
@@ -4348,8 +4702,8 @@ my %base64coord = (
4348
4702
  Format => 'undef[17]',
4349
4703
  ValueConv => 'join(" ", unpack("H2"x17, $val))',
4350
4704
  ValueConvInv => '$val=~tr/ //d; pack("H*",$val)',
4351
- PrintConv => sub { PrintAFPoints(shift, \%afPoints135); },
4352
- PrintConvInv => sub { PrintAFPointsInv(shift, \%afPoints135); },
4705
+ PrintConv => sub { PrintAFPoints(shift, \%afPoints135) },
4706
+ PrintConvInv => sub { PrintAFPointsInv(shift, \%afPoints135) },
4353
4707
  },
4354
4708
  { #PH (1S2)
4355
4709
  Name => 'AFPointsUsed',
@@ -4361,371 +4715,220 @@ my %base64coord = (
4361
4715
  Format => 'undef[21]',
4362
4716
  ValueConv => 'join(" ", unpack("H2"x21, $val))',
4363
4717
  ValueConvInv => '$val=~tr/ //d; pack("H*",$val)',
4364
- PrintConv => sub { PrintAFPointsGrid(shift, 15); },
4365
- PrintConvInv => sub { PrintAFPointsGridInv(shift, 15, 21); },
4718
+ PrintConv => sub { PrintAFPointsGrid(shift, 15) },
4719
+ PrintConvInv => sub { PrintAFPointsGridInv(shift, 15, 21) },
4720
+ },
4721
+ { #PH (1J4,1V3)
4722
+ Name => 'AFPointsUsed',
4723
+ Condition => '$$self{PhaseDetectAF} == 6',
4724
+ Notes => q{
4725
+ models with 171-point AF -- 9 rows (B-J) and 19 columns (2-20). Center
4726
+ point is F10
4727
+ },
4728
+ Format => 'undef[29]',
4729
+ ValueConv => 'join(" ", unpack("H2"x29, $val))',
4730
+ ValueConvInv => '$val=~tr/ //d; pack("H*",$val)',
4731
+ PrintConv => sub { PrintAFPointsGrid(shift, 21) },
4732
+ PrintConvInv => sub { PrintAFPointsGridInv(shift, 21, 29) },
4733
+ },
4734
+ ],
4735
+ );
4736
+
4737
+ %Image::ExifTool::Nikon::AFInfo2V0300 = (
4738
+ %binaryDataAttrs,
4739
+ GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4740
+ DATAMEMBER => [ 0, 4, 6, 7, 46, 48 ],
4741
+ NOTES => q{
4742
+ AF information for Nikon cameras with the Expeed 6 processor: D6, D780, Z5,
4743
+ Z6, Z6ii, Z7, Z7ii, Z50 and Zfc.
4744
+ },
4745
+ 0 => {
4746
+ Name => 'AFInfo2Version',
4747
+ Format => 'undef[4]',
4748
+ Writable => 0,
4749
+ RawConv => '$$self{AFInfo2Version} = $val',
4750
+ },
4751
+ 4 => {
4752
+ Name => 'AFDetectionMethod',
4753
+ RawConv => '$$self{AFDetectionMethod} = $val',
4754
+ PrintConv => \%aFDetectionMethod ,
4755
+ },
4756
+ 5 => [
4757
+ {
4758
+ Name => 'AFAreaMode',
4759
+ Condition => '$$self{AFDetectionMethod} == 0',
4760
+ PrintConv => \%aFAreaModePD, #phase detect
4761
+ },
4762
+ {
4763
+ Name => 'AFAreaMode',
4764
+ PrintConv => \%aFAreaModeCD, #contrast detect
4765
+ },
4766
+ ],
4767
+ 6 => {
4768
+ Name => 'FocusPointSchema',
4769
+ RawConv => '$$self{FocusPointSchema} = $val',
4770
+ Hidden => 1,
4771
+ PrintConv => {
4772
+ 0 => 'Off', # LiveView or manual focus or no focus
4773
+ 1 => '51-point', # (D780) 51 points through the viewfinder, 81/273 points in LiveView
4774
+ 8 => '81-point', # (Z6/Z6ii/Z7/Z7ii/Z30/Z50/Z50ii/Zfc/D780) 81-points refers to the number of auto-area focus points arranged as a 9x9 grid. Number of single-point focus points vary by model.
4775
+ 9 => '105-point', # (D6) arranged as a 15 column x 9 row grid
4366
4776
  },
4367
- { #PH (1J4,1V3)
4777
+ },
4778
+ 7 => {
4779
+ Name => 'AFCoordinatesAvailable', #0 => 'AFPointsUsed is populated' 1 => 'AFAreaXPosition & AFAreaYPosition are populated'
4780
+ RawConv => '$$self{AFCoordinatesAvailable} = $val',
4781
+ PrintConv => \%noYes ,
4782
+ },
4783
+ 0x0a => [
4784
+ { #JD/PH
4368
4785
  Name => 'AFPointsUsed',
4369
- Condition => '$$self{PhaseDetectAF} == 6',
4786
+ Condition => '$$self{FocusPointSchema} == 1 and $$self{AFCoordinatesAvailable} == 0', #D780 when AFAreaXYPositions are not populated
4370
4787
  Notes => q{
4371
- models with 171-point AF -- 9 rows (B-J) and 19 columns (2-20). Center
4372
- point is F10
4788
+ models with 51-point AF -- 5 rows: A1-9, B1-11, C1-11, D1-11, E1-9. Center
4789
+ point is C6
4373
4790
  },
4374
- Format => 'undef[29]',
4375
- ValueConv => 'join(" ", unpack("H2"x29, $val))',
4791
+ Format => 'undef[7]',
4792
+ ValueConv => 'join(" ", unpack("H2"x7, $val))',
4376
4793
  ValueConvInv => '$val=~tr/ //d; pack("H*",$val)',
4377
- PrintConv => sub { PrintAFPointsGrid(shift, 21); },
4378
- PrintConvInv => sub { PrintAFPointsGridInv(shift, 21, 29); },
4379
- },
4380
- { #PH (D5,D500)
4794
+ PrintConv => sub { PrintAFPoints(shift, \%afPoints51) },
4795
+ PrintConvInv => sub { PrintAFPointsInv(shift, \%afPoints51) },
4796
+ },{
4381
4797
  Name => 'AFPointsUsed',
4382
- Condition => '$$self{PhaseDetectAF} == 7',
4798
+ Condition => '$$self{FocusPointSchema} == 8 and $$self{AFCoordinatesAvailable} == 0', # Z6/Z6ii/Z7/Z7ii/Z50/Z50ii/Zfc/D780 when AFAreaXYPositions are not populated
4383
4799
  Notes => q{
4384
- models with 153-point AF -- 9 rows (A-I) and 17 columns (1-17). Center
4385
- point is E9
4800
+ models with hybrid detect AF have 81 auto-area points -- 9 rows (A-I) and 9 columns (1-9). Center point is E5
4386
4801
  },
4387
- Format => 'undef[20]',
4388
- ValueConv => 'join(" ", unpack("H2"x20, $val))',
4802
+ Format => 'undef[11]',
4803
+ ValueConv => 'join(" ", unpack("H2"x11, $val))',
4389
4804
  ValueConvInv => '$val=~tr/ //d; pack("H*",$val)',
4390
- PrintConv => sub { PrintAFPoints(shift, \%afPoints153); },
4391
- PrintConvInv => sub { PrintAFPointsInv(shift, \%afPoints153); },
4392
- },
4393
- { #PH
4805
+ PrintConv => sub { PrintAFPoints(shift, \%afPoints81) },
4806
+ PrintConvInv => sub { PrintAFPointsInv(shift, \%afPoints81) },
4807
+ },{
4394
4808
  Name => 'AFPointsUsed',
4395
- # version 301 uses a separate field at offset 0x0a for this tag (ref 28)
4396
- Condition => '$$self{AFInfo2Version} !~ /^03/',
4397
- Format => 'undef[7]',
4398
- ValueConv => 'join(" ", unpack("H2"x7, $val))',
4399
- ValueConvInv => '$val=~tr/ //d; pack("H*",$val)',
4400
- PrintConv => '"Unknown ($val)"',
4401
- PrintConvInv => '$val=~s/Unknown \\((.*)\\)/$1/; $val',
4402
- },
4403
- { #PH
4404
- Name => 'PrimaryAFPoint',
4405
- Condition => '$$self{PhaseDetectAF} == 1 and $$self{AFInfo2Version} =~ /^03/',
4406
- Notes => 'newer models with 51-point AF',
4407
- PrintConvColumns => 5,
4408
- PrintConv => {
4409
- 0 => '(none)',
4410
- %afPoints51,
4411
- 1 => 'C6 (Center)', # (add " (Center)" to central point)
4412
- },
4413
- },
4414
- { #PH (Z7)
4415
- Name => 'PrimaryAFPoint',
4416
- Condition => '$$self{PhaseDetectAF} == 8 and $$self{AFInfo2Version} =~ /^03/',
4417
- PrintConvColumns => 5,
4418
- PrintConv => {
4419
- 0 => '(none)',
4420
- %afPoints81,
4421
- 1 => 'E5 (Center)', # (add " (Center)" to central point)
4422
- },
4423
- },
4424
- # this was wrong, but keep the code as a comment in case it may be useful later
4425
- #{ #PH (Z7) (NC)
4426
- # Name => 'PrimaryAFPoint',
4427
- # Condition => '$$self{PhaseDetectAF} == 8 and $$self{AFInfo2Version} =~ /^03/',
4428
- # Notes => q{
4429
- # Nikon models with 493-point AF -- 17 rows (A-Q) and 29 columns (1-29), I15
4430
- # at the center
4431
- # },
4432
- # PrintConv => {
4433
- # 0 => '(none)',
4434
- # 246 => 'I15 (Center)',
4435
- # OTHER => sub {
4436
- # my ($val, $inv) = @_;
4437
- # return GetAFPointGrid($val, 29, $inv);
4438
- # },
4439
- # },
4440
- #},
4441
- ],
4442
- 0x0a => [{ #PH (D780)
4443
- Name => 'AFPointsUsed',
4444
- Condition => '$$self{PhaseDetectAF} == 1 and $$self{AFInfo2Version} =~ /^03/',
4445
- Notes => 'newer models with 51-point AF',
4446
- Format => 'undef[7]',
4447
- ValueConv => 'join(" ", unpack("H2"x7, $val))',
4448
- ValueConvInv => '$val=~tr/ //d; pack("H*",$val)',
4449
- PrintConv => sub { PrintAFPoints(shift, \%afPoints51); },
4450
- PrintConvInv => sub { PrintAFPointsInv(shift, \%afPoints51); },
4451
- },{ #38 (Z6/Z7/Z50)
4452
- Name => 'AFPointsUsed',
4453
- Condition => '$$self{PhaseDetectAF} == 8 and $$self{AFInfo2Version} =~ /^03/',
4454
- Notes => q{
4455
- models with 81-selectable point AF -- 9 rows (A-I) and 9 columns (1-9) for
4456
- phase detect AF points. Center point is E5
4457
- },
4458
- Format => 'undef[11]',
4459
- ValueConv => 'join(" ", unpack("H2"x11, $val))',
4460
- ValueConvInv => '$val=~tr/ //d; pack("H*",$val)',
4461
- PrintConv => sub { PrintAFPoints(shift, \%afPoints81); },
4462
- PrintConvInv => sub { PrintAFPointsInv(shift, \%afPoints81); },
4463
- },{ #28 (D6) in any of the 3 Group modes on the D6, the points specify the outer boundaries of the focus point area; otherwise the tag value is consistent with other Nikon bodies
4464
- Name => 'AFPointsUsed',
4465
- Condition => '$$self{PhaseDetectAF} == 9 and $$self{AFInfo2Version} =~ /^03/',
4466
- Notes => q{
4467
- models with 105-point AF -- 7 rows (A-G) and 15 columns (1-15). Center
4468
- point is D8
4469
- },
4470
- Format => 'undef[14]',
4471
- ValueConv => 'join(" ", unpack("H2"x14, $val))',
4472
- ValueConvInv => '$val=~tr/ //d; pack("H*",$val)',
4473
- PrintConv => sub { PrintAFPoints(shift, \%afPoints105); },
4474
- PrintConvInv => sub { PrintAFPointsInv(shift, \%afPoints105); },
4475
- }],
4476
- 0x10 => { #PH (D90 and D5000)
4477
- Name => 'AFImageWidth',
4478
- Condition => '$$self{AFInfo2Version} eq "0100"',
4479
- Format => 'int16u',
4480
- RawConv => '$val ? $val : undef',
4481
- Notes => 'this and the following tags are valid only for contrast-detect AF',
4482
- },
4483
- 0x12 => { #PH
4484
- Name => 'AFImageHeight',
4485
- Condition => '$$self{AFInfo2Version} eq "0100"',
4486
- Format => 'int16u',
4487
- RawConv => '$val ? $val : undef',
4488
- },
4489
- 0x14 => { #PH
4490
- Name => 'AFAreaXPosition',
4491
- Condition => '$$self{AFInfo2Version} eq "0100"',
4492
- Notes => 'center of AF area in AFImage coordinates',
4493
- Format => 'int16u',
4494
- RawConv => '$val ? $val : undef',
4495
- },
4496
- 0x16 => { #PH
4497
- Name => 'AFAreaYPosition',
4498
- Condition => '$$self{AFInfo2Version} eq "0100"',
4499
- Format => 'int16u',
4500
- RawConv => '$val ? $val : undef',
4501
- },
4502
- # AFAreaWidth/Height for the D90 and D5000:
4503
- # 352x288 (AF normal area),
4504
- # 704x576 (AF face priority, wide area, subject tracking)
4505
- 0x18 => { #PH
4506
- Name => 'AFAreaWidth',
4507
- Condition => '$$self{AFInfo2Version} eq "0100"',
4508
- Format => 'int16u',
4509
- Notes => 'size of AF area in AFImage coordinates',
4510
- RawConv => '$val ? $val : undef',
4511
- },
4512
- 0x1a => { #PH
4513
- Name => 'AFAreaHeight',
4514
- Condition => '$$self{AFInfo2Version} eq "0100"',
4515
- Format => 'int16u',
4516
- RawConv => '$val ? $val : undef',
4517
- },
4518
- 0x1c => [
4519
- { #PH
4520
- Name => 'ContrastDetectAFInFocus',
4521
- Condition => '$$self{AFInfo2Version} eq "0100" and $$self{ContrastDetectAF}',
4522
- PrintConv => { 0 => 'No', 1 => 'Yes' },
4523
- },{ #PH (D500, see forum11190)
4524
- Name => 'AFPointsSelected',
4525
- Condition => '$$self{AFInfo2Version} eq "0101" and $$self{PhaseDetectAF} == 7',
4526
- Format => 'undef[20]',
4527
- ValueConv => 'join(" ", unpack("H2"x20, $val))',
4809
+ Condition => '$$self{FocusPointSchema} == 9 and $$self{AFCoordinatesAvailable} == 0', # D6 focus-point model when AFAreaXYPositions are not populated
4810
+ Format => 'undef[14]',
4811
+ ValueConv => 'join(" ", unpack("H2"x14, $val))',
4528
4812
  ValueConvInv => '$val=~tr/ //d; pack("H*",$val)',
4529
- PrintConv => sub { PrintAFPoints(shift, \%afPoints153); },
4530
- PrintConvInv => sub { PrintAFPointsInv(shift, \%afPoints153); },
4531
- },{ #PH (D3400) (NC "selected")
4532
- Name => 'AFPointsSelected',
4533
- Condition => '$$self{AFInfo2Version} eq "0101" and $$self{PhaseDetectAF} == 2',
4534
- Format => 'int16u',
4535
- PrintConv => \%afPoints11,
4813
+ PrintConv => sub { PrintAFPoints(shift, \%afPoints105) },
4814
+ PrintConvInv => sub { PrintAFPointsInv(shift, \%afPoints105) },
4536
4815
  },
4537
4816
  ],
4538
- # 0x1d - always zero (with or without live view)
4539
4817
  0x2a => { #PH (Z7)
4540
4818
  Name => 'AFImageWidth',
4541
- Condition => '$$self{AFInfo2Version} =~ /^03/',
4542
4819
  Format => 'int16u',
4543
4820
  RawConv => '$val ? $val : undef',
4544
4821
  },
4545
4822
  0x2c => { #PH (Z7)
4546
4823
  Name => 'AFImageHeight',
4547
- Condition => '$$self{AFInfo2Version} =~ /^03/',
4548
4824
  Format => 'int16u',
4549
4825
  RawConv => '$val ? $val : undef',
4550
4826
  },
4551
4827
  0x2e => { #PH (Z7)
4552
4828
  Name => 'AFAreaXPosition',
4553
- Condition => q{
4554
- $$self{ContrastDetectAF} == 2 and $$self{AFInfo2Version} =~ /^03/ or
4555
- $$self{ContrastDetectAF} == 1 and $$self{AFInfo2Version} =~ /^0301/
4556
- },
4829
+ Condition => '$$self{AFCoordinatesAvailable} == 1', # is field populated?
4830
+ RawConv => '$$self{AFAreaXPosition} = $val',
4557
4831
  Format => 'int16u', # (decodes same byte as 0x2f)
4558
4832
  },
4559
- 0x2f => { #28 (Z7) Still photography range 1-17 for the 493 point Z7 (arranged in a 29x17 grid. Center at x=16, y=10).
4560
- Name => 'FocusPositionHorizontal',
4561
- Condition => q{
4562
- $$self{ContrastDetectAF} == 2 and $$self{AFInfo2Version} =~ /^03/ or
4563
- $$self{ContrastDetectAF} == 1 and $$self{AFInfo2Version} =~ /^0301/
4564
- },
4565
- PrintConv => sub { my ($val) = @_; PrintAFPointsLeftRight($val, 29 ); },
4833
+ 0x2f => [
4834
+ {
4835
+ Name => 'FocusPositionHorizontal', # 209/231 focus point cameras
4836
+ Condition => '$$self{Model} =~ /^NIKON (Z 30|Z 50|Z fc)\b/i and $$self{AFAreaXPosition} != 0', #models Z30, Z50, Zfc
4837
+ ValueConv => 'int($$self{AFAreaXPosition} / 260 )', #divisor is an estimate (chosen to cause center point to report 'C')
4838
+ PrintConv => sub { my ($val) = @_; PrintAFPointsLeftRight($val, 19 ) },
4839
+ },{
4840
+ Name => 'FocusPositionHorizontal', #273/299 focus point cameras
4841
+ Condition => '$$self{Model} =~ /^NIKON (Z 5|Z 6|Z 6_2|D780)\b/i and $$self{AFAreaXPosition} != 0', #models Z5, Z6, Z6ii, D780
4842
+ ValueConv => 'int($$self{AFAreaXPosition} / 260 )', #divisor is an estimate (chosen to cause center point to report 'C')
4843
+ PrintConv => sub { my ($val) = @_; PrintAFPointsLeftRight($val, 21 ) },
4844
+ },{
4845
+ Name => 'FocusPositionHorizontal', #405/493 focus point cameras
4846
+ Condition => '$$self{Model} =~ /^NIKON (Z 7|Z 7_2)\b/i and $$self{AFAreaXPosition} != 0', #models Z7/Z7ii
4847
+ ValueConv => 'int($$self{AFAreaXPosition} / 260 )', #divisor is the measured horizontal pixel separation between adjacent points
4848
+ PrintConv => sub { my ($val) = @_; PrintAFPointsLeftRight($val, 29 ) },
4566
4849
  },
4567
- 0x30 => [
4568
- { #PH (Z7)
4569
- Name => 'AFAreaYPosition',
4570
- Condition => q{
4571
- $$self{ContrastDetectAF} == 2 and $$self{AFInfo2Version} =~ /^03/ or
4572
- $$self{ContrastDetectAF} == 1 and $$self{AFInfo2Version} =~ /^0301/
4573
- },
4574
- Format => 'int16u', # (decodes same byte as 0x31)
4575
- },{ #PH (D500, see forum11190)
4576
- Name => 'AFPointsInFocus',
4577
- Condition => '$$self{AFInfo2Version} eq "0101" and $$self{PhaseDetectAF} == 7',
4578
- Notes => 'AF points in focus at the time time image was captured',
4579
- Format => 'undef[20]',
4580
- ValueConv => 'join(" ", unpack("H2"x20, $val))',
4581
- ValueConvInv => '$val=~tr/ //d; pack("H*",$val)',
4582
- PrintConv => sub { PrintAFPoints(shift, \%afPoints153); },
4583
- PrintConvInv => sub { PrintAFPointsInv(shift, \%afPoints153); },
4584
- },{ #PH (D7500) (NC "in focus")
4585
- Name => 'AFPointsInFocus',
4586
- Condition => '$$self{AFInfo2Version} eq "0101" and $$self{PhaseDetectAF} == 1',
4587
- Format => 'undef[7]',
4588
- ValueConv => 'join(" ", unpack("H2"x7, $val))',
4589
- ValueConvInv => '$val=~tr/ //d; pack("H*",$val)',
4590
- PrintConv => sub { PrintAFPoints(shift, \%afPoints51); },
4591
- PrintConvInv => sub { PrintAFPointsInv(shift, \%afPoints51); },
4592
- },
4850
+ #the only other AFInfoVersion 03xx camera is the D6. It allows the LiveView focus point to positioned anywhere in the frame, rendering this tag somewhat meaningless for that camera
4593
4851
  ],
4594
- 0x31 => { #28 (Z7)
4595
- Name => 'FocusPositionVertical',
4596
- Condition => q{
4597
- $$self{ContrastDetectAF} == 2 and $$self{AFInfo2Version} =~ /^03/ or
4598
- $$self{ContrastDetectAF} == 1 and $$self{AFInfo2Version} =~ /^0301/
4599
- },
4600
- PrintConv => sub { my ($val) = @_; PrintAFPointsUpDown($val, 17 ); },
4852
+ 0x30 => { #PH (Z7)
4853
+ Name => 'AFAreaYPosition',
4854
+ Condition => '$$self{AFCoordinatesAvailable} == 1', # is field populated?
4855
+ RawConv => '$$self{AFAreaYPosition} = $val',
4856
+ Format => 'int16u', # (decodes same byte as 0x31)
4857
+ },
4858
+ 0x31 => [
4859
+ {
4860
+ Name => 'FocusPositionVertical', # 209/233 focus point cameras
4861
+ Condition => '$$self{Model} =~ /^NIKON (Z 30|Z 50|Z fc)\b/i and $$self{AFAreaYPosition} != 0', #models Z30, Z50, Zfc
4862
+ ValueConv => 'int($$self{AFAreaYPosition} / 286 )', #divisor is an estimate (chosen to cause center point to report 'C')
4863
+ PrintConv => sub { my ($val) = @_; PrintAFPointsUpDown($val, 11 ) },
4864
+ },{
4865
+ Name => 'FocusPositionVertical', #273/299 focus point cameras
4866
+ Condition => '$$self{Model} =~ /^NIKON (Z 5|Z 6|Z 6_2|D780)\b/i and $$self{AFAreaYPosition} != 0', #models Z5, Z6, Z6ii, D780
4867
+ ValueConv => 'int($$self{AFAreaYPosition} / 286 )', #divisor is an estimate (chosen to cause center point to report 'C')
4868
+ PrintConv => sub { my ($val) = @_; PrintAFPointsUpDown($val, 13 ) },
4869
+ },{
4870
+ Name => 'FocusPositionVertical', #405/493 focus point cameras
4871
+ Condition => '$$self{Model} =~ /^NIKON (Z 7|Z 7_2)\b/i and $$self{AFAreaYPosition} != 0', #models Z7/Z7ii
4872
+ ValueConv => 'int($$self{AFAreaYPosition} / 292 )', #divisor is the measured vertical pixel separation between adjacent points
4873
+ PrintConv => sub { my ($val) = @_; PrintAFPointsUpDown($val, 17 ) },
4601
4874
  },
4602
- 0x32 => { #PH (Z7)
4875
+ ],
4876
+ 0x32 => { #PH
4603
4877
  Name => 'AFAreaWidth',
4604
- Condition => '$$self{AFInfo2Version} =~ /^03/',
4605
4878
  Format => 'int16u',
4606
4879
  RawConv => '$val ? $val : undef',
4607
4880
  },
4608
- 0x34 => { #PH (Z7)
4881
+ 0x34 => { #PH
4609
4882
  Name => 'AFAreaHeight',
4610
- Condition => '$$self{AFInfo2Version} =~ /^03/',
4611
4883
  Format => 'int16u',
4612
4884
  RawConv => '$val ? $val : undef',
4613
4885
  },
4614
- 0x38 => { #28
4615
- Name => 'PrimaryAFPoint',
4616
- Condition => '$$self{PhaseDetectAF} == 9 and $$self{AFInfo2Version} =~ /^03/',
4617
- Notes => q{
4618
- Nikon models with 105-point AF -- 7 rows (A-G) and 15 columns (1-15): D6
4619
- },
4620
- PrintConvColumns => 5,
4621
- PrintConv => {
4622
- 0 => '(none)',
4623
- %afPoints105,
4624
- 1 => 'D8 (Center)',
4625
- },
4626
- },
4627
- 0x44 => [
4628
- {
4886
+ 0x38 =>[
4887
+ { #PH/JD
4629
4888
  Name => 'PrimaryAFPoint',
4630
- Condition => '$$self{PhaseDetectAF} == 7 and $$self{AFInfo2Version} eq "0101"',
4889
+ Condition => '$$self{FocusPointSchema} == 1 and $$self{AFCoordinatesAvailable} == 0', #51 focus-point models when AFAreaXYPositions are not populated
4890
+ Notes => q{
4891
+ models with 51-point AF -- 5 rows (A-E) and 11 columns (1-11): D3, D3S, D3X,
4892
+ D4, D4S, D300, D300S, D700, D750, D800, D800E, D810, D7100 and D7200
4893
+ },
4631
4894
  PrintConvColumns => 5,
4632
4895
  PrintConv => {
4633
4896
  0 => '(none)',
4634
- %afPoints153,
4635
- 1 => 'E9 (Center)',
4897
+ %afPoints51,
4898
+ 1 => 'C6 (Center)', # (add " (Center)" to central point)
4636
4899
  },
4637
- },
4638
- { #PH
4900
+ },{
4639
4901
  Name => 'PrimaryAFPoint',
4640
- Notes => 'D3500',
4641
- Condition => '$$self{PhaseDetectAF} == 2 and $$self{AFInfo2Version} eq "0101"',
4642
- PrintConvColumns => 2,
4643
- PrintConv => {
4644
- 0 => '(none)',
4645
- 1 => 'Center',
4646
- 2 => 'Top',
4647
- 3 => 'Bottom',
4648
- 4 => 'Mid-left',
4649
- 5 => 'Upper-left',
4650
- 6 => 'Lower-left',
4651
- 7 => 'Far Left',
4652
- 8 => 'Mid-right',
4653
- 9 => 'Upper-right',
4654
- 10 => 'Lower-right',
4655
- 11 => 'Far Right',
4902
+ Condition => '$$self{FocusPointSchema} == 8 and $$self{AFCoordinatesAvailable} == 0', # Z6/Z6ii/Z7/Z7ii/Z50/Z50ii/Zfc/D780 when AFAreaXYPositions are not populated
4903
+ Notes => q{
4904
+ models with hybrid detect AF have 81 auto-area points -- 9 rows (A-I) and 9 columns (1-9). Center point is E5
4656
4905
  },
4657
- },
4658
- {
4659
- Name => 'PrimaryAFPoint',
4660
- Condition => '$$self{PhaseDetectAF} == 1 and $$self{AFInfo2Version} eq "0101"',
4661
4906
  PrintConvColumns => 5,
4662
4907
  PrintConv => {
4663
4908
  0 => '(none)',
4664
- %afPoints51,
4665
- 1 => 'C6 (Center)',
4909
+ %afPoints81,
4910
+ 1 => 'E5 (Center)', # (add " (Center)" to central point)
4666
4911
  },
4667
- },
4668
- {
4912
+ },{ #28
4669
4913
  Name => 'PrimaryAFPoint',
4670
- Condition => '$$self{AFInfo2Version} eq "0101"',
4671
- Notes => 'future models?...',
4672
- Priority => 0,
4914
+ Condition => '$$self{FocusPointSchema} == 9 and $$self{AFCoordinatesAvailable} == 0', #153 focus-point models when AFAreaXYPositions are not populated
4915
+ Notes => q{
4916
+ Nikon models with 105-point AF -- 7 rows (A-G) and 15 columns (1-15): D6
4917
+ },
4918
+ PrintConvColumns => 5,
4673
4919
  PrintConv => {
4674
4920
  0 => '(none)',
4675
- 1 => 'Center',
4921
+ %afPoints105,
4922
+ 1 => 'D8 (Center)',
4676
4923
  },
4677
4924
  },
4678
- ],
4679
- 0x46 => {
4680
- Name => 'AFImageWidth',
4681
- Condition => '$$self{ContrastDetectAF} == 1 and $$self{AFInfo2Version} eq "0101"',
4682
- Format => 'int16u',
4683
- RawConv => '$val ? $val : undef',
4684
- Notes => 'this and the following tags are valid only for contrast-detect AF',
4685
- },
4686
- 0x48 => {
4687
- Name => 'AFImageHeight',
4688
- Condition => '$$self{ContrastDetectAF} == 1 and $$self{AFInfo2Version} eq "0101"',
4689
- Format => 'int16u',
4690
- RawConv => '$val ? $val : undef',
4691
- },
4692
- 0x4a => {
4693
- Name => 'AFAreaXPosition',
4694
- Condition => '$$self{ContrastDetectAF} == 1 and $$self{AFInfo2Version} eq "0101"',
4695
- Notes => 'center of AF area in AFImage coordinates',
4696
- Format => 'int16u',
4697
- RawConv => '$val ? $val : undef',
4698
- },
4699
- 0x4c => {
4700
- Name => 'AFAreaYPosition',
4701
- Condition => '$$self{ContrastDetectAF} == 1 and $$self{AFInfo2Version} eq "0101"',
4702
- Format => 'int16u',
4703
- RawConv => '$val ? $val : undef',
4704
- },
4705
- 0x4e => {
4706
- Name => 'AFAreaWidth',
4707
- Condition => '$$self{ContrastDetectAF} == 1 and $$self{AFInfo2Version} eq "0101"',
4708
- Format => 'int16u',
4709
- Notes => 'size of AF area in AFImage coordinates',
4710
- RawConv => '$val ? $val : undef',
4711
- },
4712
- 0x50 => {
4713
- Name => 'AFAreaHeight',
4714
- Condition => '$$self{ContrastDetectAF} == 1 and $$self{AFInfo2Version} eq "0101"',
4715
- Format => 'int16u',
4716
- RawConv => '$val ? $val : undef',
4717
- },
4718
- 0x52 => {
4719
- Name => 'ContrastDetectAFInFocus',
4720
- Condition => '$$self{ContrastDetectAF} == 1 and $$self{AFInfo2Version} eq "0101"',
4721
- PrintConv => { 0 => 'No', 1 => 'Yes' },
4722
- },
4925
+ ]
4723
4926
  );
4724
4927
 
4725
4928
  %Image::ExifTool::Nikon::AFInfo2V0400 = (
4726
4929
  %binaryDataAttrs,
4727
4930
  GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4728
- DATAMEMBER => [ 0, 5 ],
4931
+ DATAMEMBER => [ 0, 4, 5, 7, 66, 68 ],
4729
4932
  NOTES => q{
4730
4933
  AF information for Nikon cameras with the Expeed 7 processor: The Zf, Z6_3,
4731
4934
  Z8, Z9 and Z50_3.
@@ -4736,7 +4939,12 @@ my %base64coord = (
4736
4939
  Writable => 0,
4737
4940
  RawConv => '$$self{AFInfo2Version} = $val',
4738
4941
  },
4739
- 5 => { #28
4942
+ 4 => {
4943
+ Name => 'AFDetectionMethod',
4944
+ RawConv => '$$self{AFDetectionMethod} = $val',
4945
+ PrintConv => \%aFDetectionMethod ,
4946
+ },
4947
+ 5 => {
4740
4948
  Name => 'AFAreaMode', #reflects the mode active when the shutter is tripped, not the position of the Focus Mode button (which is recorded in MenuSettingsZ9 tag also named AfAreaMode)
4741
4949
  RawConv => '$$self{AFAreaModeUsed} = $val',
4742
4950
  PrintConv => {
@@ -4752,6 +4960,11 @@ my %base64coord = (
4752
4960
  208 => 'Wide (C1/C2)',
4753
4961
  },
4754
4962
  },
4963
+ 7 => {
4964
+ Name => 'AFCoordinatesAvailable', #0 => 'AFPointsUsed is populated' 1 => 'AFAreaXPosition & AFAreaYPosition are populated'
4965
+ RawConv => '$$self{AFCoordinatesAvailable} = $val',
4966
+ PrintConv => \%noYes ,
4967
+ },
4755
4968
  10 => [{
4756
4969
  # valid only for AFAreaModes where the camera selects the focus point (i.e., AutoArea & 3D-Tracking)
4757
4970
  # and the camera has yet to determine a focus target (in these cases tags AFAreaXPosition and AFAreaYPosition will be zeroes)
@@ -4761,59 +4974,83 @@ my %base64coord = (
4761
4974
  Notes => 'either AFPointsUsed or AFAreaX/YPosition will be set, but not both',
4762
4975
  ValueConv => 'join(" ", unpack("H2"x51, $val))',
4763
4976
  ValueConvInv => '$val=~tr/ //d; pack("H*",$val)',
4764
- PrintConv => sub { PrintAFPoints(shift, \@afPoints405); },
4765
- PrintConvInv => sub { PrintAFPointsInv(shift, \@afPoints405); },
4977
+ PrintConv => sub { PrintAFPoints(shift, \@afPoints405) }, #full-frame sensor, 45MP, auto-area focus point configuration
4978
+ PrintConvInv => sub { PrintAFPointsInv(shift, \@afPoints405) },
4766
4979
  },{
4767
4980
  Name => 'AFPointsUsed', # Z6iii and Zf (AFInfo2Version 0401)
4768
4981
  Condition => '$$self{Model} =~ /^NIKON (Z6_3|Z f)\b/i and ($$self{AFAreaModeUsed} == 197 or $$self{AFAreaModeUsed} == 207)',
4769
4982
  Format => 'undef[38]',
4770
4983
  ValueConv => 'join(" ", unpack("H2"x38, $val))',
4771
4984
  ValueConvInv => '$val=~tr/ //d; pack("H*",$val)',
4772
- PrintConv => sub { PrintAFPoints(shift, \@afPoints299); },
4773
- PrintConvInv => sub { PrintAFPointsInv(shift, \@afPoints299); },
4985
+ PrintConv => sub { PrintAFPoints(shift, \@afPoints299) },
4986
+ PrintConvInv => sub { PrintAFPointsInv(shift, \@afPoints299) }, #full-frame sensor, 24MP, auto-area focus point configuration
4774
4987
  },{
4775
4988
  Name => 'AFPointsUsed', # Z50ii (AFInfo2Version 0402)
4776
4989
  Condition => '$$self{Model} =~ /^NIKON Z50_2\b/i and ($$self{AFAreaModeUsed} == 197 or $$self{AFAreaModeUsed} == 207)',
4777
4990
  Format => 'undef[29]',
4778
4991
  ValueConv => 'join(" ", unpack("H2"x29, $val))',
4779
4992
  ValueConvInv => '$val=~tr/ //d; pack("H*",$val)',
4780
- PrintConv => sub { PrintAFPoints(shift, \@afPoints231); },
4781
- PrintConvInv => sub { PrintAFPointsInv(shift, \@afPoints231); },
4993
+ PrintConv => sub { PrintAFPoints(shift, \@afPoints231) },
4994
+ PrintConvInv => sub { PrintAFPointsInv(shift, \@afPoints231) }, #crop sensor, 21MP, auto-area focus point configuration
4782
4995
  }],
4783
- 62 => {
4996
+ 0x3e => {
4784
4997
  Name => 'AFImageWidth',
4785
4998
  Format => 'int16u',
4999
+ RawConv => '$val ? $val : undef',
4786
5000
  },
4787
5001
  0x40 => {
4788
5002
  Name => 'AFImageHeight',
4789
5003
  Format => 'int16u',
5004
+ RawConv => '$val ? $val : undef',
4790
5005
  },
4791
5006
  0x42 => { #28
4792
5007
  Name => 'AFAreaXPosition', #top left image corner is the origin
5008
+ Condition => '$$self{AFCoordinatesAvailable} == 1', # is field populated?
5009
+ RawConv => '$$self{AFAreaXPosition} = $val',
4793
5010
  Format => 'int16u', # (decodes same byte as 0x43)
4794
- RawConv => '$val ? $val : undef',
4795
5011
  },
4796
- #0x43 => {
4797
- # Name => 'FocusPositionHorizontal',
4798
- # Notes => q{
4799
- # the focus points form a 29x17 grid, but the X,Y coordinate values run from 1,1
4800
- # to 30,19. The horizontal coordinate 11R (5) and the vertical coordinates 6U
4801
- # (4) and 2D (12) are not used for some reason
4802
- # },
4803
- # # 493 focus points for Z9 fall in a 30x19 grid
4804
- # # (the 11R (5) position is not used, for a total of 29 columns, ref AlbertShan email)
4805
- # PrintConv => sub { my ($val) = @_; PrintAFPointsLeftRight($val, 29); },
4806
- #},
5012
+ 0x43 => [
5013
+ {
5014
+ Name => 'FocusPositionHorizontal', # 209/231 focus point cameras
5015
+ Condition => '$$self{Model} =~ /^NIKON Z50_2\b/i and $$self{AFAreaXPosition} != 0', #model Z50ii
5016
+ ValueConv => 'int($$self{AFAreaXPosition} / 260 )', #divisor is the estimated separation between adjacent points (informed by the measured Z7ii separation)
5017
+ PrintConv => sub { my ($val) = @_; PrintAFPointsLeftRight($val, 19 ) },
5018
+ },{
5019
+ Name => 'FocusPositionHorizontal', #273/299 focus point cameras
5020
+ Condition => '$$self{Model} =~ /^NIKON (Z6_3|Z f)\b/i and $$self{AFAreaXPosition} != 0', #models Z6iii and Zf
5021
+ ValueConv => 'int($$self{AFAreaXPosition} / 260 )', #divisor is the estimated separation between adjacent points (informed by the measured Z7ii separation)
5022
+ PrintConv => sub { my ($val) = @_; PrintAFPointsLeftRight($val, 21 ) },
5023
+ },{
5024
+ Name => 'FocusPositionHorizontal', #405/493 focus point cameras
5025
+ Condition => '$$self{Model} =~ /^NIKON (Z 8|Z 9)\b/i and $$self{AFAreaXPosition} != 0', #models Z8 and Z9
5026
+ ValueConv => 'int($$self{AFAreaXPosition} / 260 )', #divisor is the measured horizontal pixel separation between adjacent points
5027
+ PrintConv => sub { my ($val) = @_; PrintAFPointsLeftRight($val, 29 ) },
5028
+ },
5029
+ ],
4807
5030
  0x44 => { #28
4808
5031
  Name => 'AFAreaYPosition',
5032
+ Condition => '$$self{AFCoordinatesAvailable} == 1', # is field populated?
5033
+ RawConv => '$$self{AFAreaYPosition} = $val',
4809
5034
  Format => 'int16u', # (decodes same byte as 0x45)
4810
- RawConv => '$val ? $val : undef',
4811
5035
  },
4812
- #0x45 => {
4813
- # Name => 'FocusPositionVertical',
4814
- # # (the 6U (4) and 2D (12) are not used, for a total of 17 rows, ref AlbertShan email)
4815
- # PrintConv => sub { my ($val) = @_; PrintAFPointsUpDown($val, 17); },
4816
- #},
5036
+ 0x45 => [
5037
+ {
5038
+ Name => 'FocusPositionVertical', # 209/233 focus point cameras
5039
+ Condition => '$$self{Model} =~ /^NIKON Z50_2\b/i and $$self{AFAreaYPosition} != 0', #model Z50ii
5040
+ ValueConv => 'int($$self{AFAreaYPosition} / 286 )', #divisor chosen to cause center point report 'C'
5041
+ PrintConv => sub { my ($val) = @_; PrintAFPointsUpDown($val, 11 ) },
5042
+ },{
5043
+ Name => 'FocusPositionVertical', #273/299 focus point cameras
5044
+ Condition => '$$self{Model} =~ /^NIKON (Z6_3|Z f)\b/i and $$self{AFAreaYPosition} != 0', #models Z6iii and Zf
5045
+ ValueConv => 'int($$self{AFAreaYPosition} / 286 )', #divisor chosen to cause center point report 'C'
5046
+ PrintConv => sub { my ($val) = @_; PrintAFPointsUpDown($val, 13 ) },
5047
+ },{
5048
+ Name => 'FocusPositionVertical', #405/493 focus point cameras
5049
+ Condition => '$$self{Model} =~ /^NIKON (Z 8|Z 9)\b/i and $$self{AFAreaYPosition} != 0', #models Z8 and Z9
5050
+ ValueConv => 'int($$self{AFAreaYPosition} / 292 )', #divisor is the measured vertical pixel separation between adjacent points
5051
+ PrintConv => sub { my ($val) = @_; PrintAFPointsUpDown($val, 17 ) },
5052
+ },
5053
+ ],
4817
5054
  0x46 => {
4818
5055
  Name => 'AFAreaWidth',
4819
5056
  Format => 'int16u',
@@ -5629,6 +5866,7 @@ my %nikonFocalConversions = (
5629
5866
  44 => 'Nikkor Z 70-180mm f/2.8', #28
5630
5867
  45 => 'Nikkor Z 600mm f/6.3 VR S', #28
5631
5868
  46 => 'Nikkor Z 135mm f/1.8 S Plena', #28
5869
+ 47 => 'Nikkor Z 35mm f/1.2 S', #28
5632
5870
  48 => 'Nikkor Z 28-400mm f/4-8 VR', #30
5633
5871
  51 => 'Nikkor Z 35mm f/1.4', #28
5634
5872
  52 => 'Nikkor Z 50mm f/1.4', #28
@@ -5698,7 +5936,7 @@ my %nikonFocalConversions = (
5698
5936
  Name => 'LensDriveEnd', # byte contains: 1 at CFD/MOD; 2 at Infinity; 0 otherwise
5699
5937
  Condition => '$$self{LensID} and $$self{LensID} != 0 and $$self{FocusMode} ne "Manual"', #valid for Z-mount lenses in focus modes other than M
5700
5938
  Format => 'int8u',
5701
- RawConv => 'unless (defined $$self{FocusDistanceRangeWidth} and not $$self{FocusDistanceRangeWidth}) { if ($val == 0 ) {$$self{LensDriveEnd} = "No"} else { $$self{LensDriveEnd} = "CFD"}; } else{ $$self{LensDriveEnd} = "Inf"}',
5939
+ RawConv => 'unless (defined $$self{FocusDistanceRangeWidth} and not $$self{FocusDistanceRangeWidth}) { if ($val == 0 ) {$$self{LensDriveEnd} = "No"} else { $$self{LensDriveEnd} = "CFD"} } else{ $$self{LensDriveEnd} = "Inf"}',
5702
5940
  Unknown => 1,
5703
5941
  },
5704
5942
  0x58 => { #28
@@ -13349,10 +13587,33 @@ my %nikonFocalConversions = (
13349
13587
  6 => 'High',
13350
13588
  },
13351
13589
  },
13352
- 0x20000b7 => {
13590
+ 0x20000b7 => [{
13353
13591
  Name => 'AFInfo2',
13354
- SubDirectory => { TagTable => 'Image::ExifTool::Nikon::AFInfo2' },
13355
- },
13592
+ # LiveView-enabled DSLRs introduced starting in 2007 (D3/D300)
13593
+ Condition => '$$valPt =~ /^0100/',
13594
+ SubDirectory => { TagTable => 'Image::ExifTool::Nikon::AFInfo2V0100' },
13595
+ },{
13596
+ Name => 'AFInfo2',
13597
+ # All Expeed 5 processor and most Expeed 4 processor models from 2016 - D5, D500, D850, D3400, D3500, D7500 (D5600 is v0100)
13598
+ Condition => '$$valPt =~ /^0101/',
13599
+ SubDirectory => { TagTable => 'Image::ExifTool::Nikon::AFInfo2V0101' },
13600
+ },{
13601
+ Name => 'AFInfo2',
13602
+ # Nikon 1 Series cameras
13603
+ Condition => '$$valPt =~ /^020[01]/',
13604
+ SubDirectory => { TagTable => 'Image::ExifTool::Nikon::AFInfo2V0200' },
13605
+ },{
13606
+ Name => 'AFInfo2',
13607
+ # Expeed 6 processor models - D6, D780, Z5, Z6, Z7, Z30, Z50, Z6_2, Z7_2 and Zfc
13608
+ Condition => '$$valPt =~ /^030[01]/',
13609
+ SubDirectory => { TagTable => 'Image::ExifTool::Nikon::AFInfo2V0300' },
13610
+ },{
13611
+ Name => 'AFInfo2',
13612
+ # Expeed 7 processor models - Z8 & Z9 (AFInfo2Version 0400), Z6iii & Zf (AFInfo2Version 0401)
13613
+ # and Z50ii (AFInfo2Version 0402)
13614
+ Condition => '$$valPt =~ /^040[012]/',
13615
+ SubDirectory => { TagTable => 'Image::ExifTool::Nikon::AFInfo2V0400' },
13616
+ }],
13356
13617
  # 0x20000c0 - undef[8]
13357
13618
  0x20000c3 => {
13358
13619
  Name => 'BarometerInfo',
@@ -13490,10 +13751,33 @@ my %nikonFocalConversions = (
13490
13751
  },
13491
13752
  AutoFocus => {
13492
13753
  Require => {
13493
- 0 => 'Nikon:PhaseDetectAF',
13494
- 1 => 'Nikon:ContrastDetectAF',
13754
+ 0 => 'Nikon:FocusMode',
13755
+ },
13756
+ ValueConv => '($val[0] =~ /^Manual/i) ? 0 : 1',
13757
+ PrintConv => \%offOn,
13758
+ },
13759
+ PhaseDetectAF => {
13760
+ Require => {
13761
+ 0 => 'Nikon:FocusPointSchema',
13762
+ 1 => 'Nikon:AFDetectionMethod',
13763
+ },
13764
+ ValueConv => '(($val[1]) == 0) ? ($val[0]) : 0', # for backward compatibility, report FocusPointSchema when AFDetectionMethod indicates Phase Detect is on
13765
+ PrintConv => {
13766
+ 0 => 'Off', #contrast detect or hybrid detect
13767
+ 1 => 'On (51-point)', #PH
13768
+ 2 => 'On (11-point)', #PH
13769
+ 3 => 'On (39-point)', #29 (D7000)
13770
+ 7 => 'On (153-point)', #PH (D5/D500/D850)
13771
+ #8 => 'On (81-point)', #38 will not see this value - only available in hybrid detect
13772
+ 9 => 'On (105-point)', #28 (D6)
13773
+ },
13774
+ },
13775
+ ContrastDetectAF => {
13776
+ Require => {
13777
+ 0 => 'Nikon:FocusMode',
13778
+ 1 => 'Nikon:AFDetectionMethod',
13495
13779
  },
13496
- ValueConv => '($val[0] or $val[1]) ? 1 : 0',
13780
+ ValueConv => '(($val[0] !~ /^Manual/i) and ($val[1] == 1)) ? 1 : 0',
13497
13781
  PrintConv => \%offOn,
13498
13782
  },
13499
13783
  );
@@ -13648,7 +13932,7 @@ sub PrintAFPointsGridInv($$$)
13648
13932
  sub PrintAFPointsLeftRight($$)
13649
13933
  {
13650
13934
  my ($col, $ncol) = @_;
13651
- my $center = 1 + ($ncol + 1)/2;
13935
+ my $center = ($ncol + 1) / 2;
13652
13936
  return 'n/a' if $col == 0; #out of focus
13653
13937
  return 'C' if $col == $center;
13654
13938
  return sprintf('%d', $center - $col) . 'L of Center' if $col < $center;
@@ -13662,7 +13946,7 @@ sub PrintAFPointsLeftRight($$)
13662
13946
  sub PrintAFPointsUpDown($$)
13663
13947
  {
13664
13948
  my ($row, $nrow) = @_;
13665
- my $center = 1 + ($nrow + 1)/2;
13949
+ my $center = ($nrow + 1) / 2;
13666
13950
  return 'n/a' if $row == 0; #out of focus
13667
13951
  return 'C' if $row == $center;
13668
13952
  return sprintf('%d', $center - $row) . 'U from Center' if $row < $center;