Issues with the format of the MakerNotes:AF Points Used for Nikon Z7 and Z6

Started by andydragon69, February 28, 2020, 04:54:29 PM

Previous topic - Next topic

andydragon69

I think the format of the AF Points Used for the Nikon Z6 and Z7 has changed when the Phase Defect AF is set to On (8).  The format is always the same both both cameras and looks like this:

08 00 e7 ce 9d 3b 07 e0 0c 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 08 00 00 00

As an example, for the above, this is the resulting AF Points: A4,A17,A18,A19,A22,A23,A24,A26,A27,A28,B2,B3,B4,B6,B7,B8,B11,B12,B13,B15,B16,B17,B20,B21,B22,C4,C5,C6,C9,C10,M21,N11

When using the current formatting (remove -n option), then the AF points are not correct compared to looking at them in Nikon's ViewNX-i.  The format of this string is always the same length.  I think this is some new encoding which doesn't match the old encoding.

When Phase Detect AF is off, the camera reports the AF point using the area / position instead.

If it would be helpful, I can share a SQLite DB with all EXIF tags dumped into it and a few of the images to look at in ViewNX-i to see the focus points if it would be helpful.

I did attach a low-res screen capture of the file with the above points shown with the focus point in ViewNX-i.

andydragon69

Looking at some of the images and overlaying them one on top of another, the Z6 and Z7 are using 99 PDAF points.  11 x 9 - both cameras basically line up when scaled.

andydragon69

Further research indicates that the AF points data is a bitmask of points from the second byte for the following 11 bytes and there are not 99 points but 81 (so far as I've seen) in a 9 x 9 array.  I've been working through all my images to determine the layout (which is insanely time consuming since ViewNX-i crashes constantly).  So far this is what I've been able to find (42 points):


Found points, byte mapping:
       7    6    5    4    3    2    1    0
00 : [   ][G5 ][F5 ][   ][B5 ][C5 ][D5 ][E5 ]
01 : [   ][F6 ][   ][   ][C6 ][D6 ][E6 ][   ]
02 : [F4 ][   ][B4 ][C4 ][D4 ][E4 ][   ][H6 ]
03 : [   ][   ][C7 ][D7 ][E7 ][   ][   ][G4 ]
04 : [B3 ][C3 ][D3 ][E3 ][   ][H7 ][   ][F7 ]
05 : [   ][   ][   ][   ][H3 ][G3 ][F3 ][A3 ]
06 : [   ][   ][   ][   ][G8 ][F8 ][A8 ][B8 ]
07 : [E9 ][   ][   ][G2 ][F2 ][   ][   ][   ]
08 : [   ][   ][G9 ][F9 ][   ][B9 ][   ][   ]
09 : [   ][   ][F1 ][   ][B1 ][   ][   ][   ]
0a : [   ][   ][   ][   ][   ][   ][   ][   ]
Found 42 of 81 points: A3,A8,B1,B3,B4,B5,B8,B9,C3,C4,C5,C6,C7,D3,D4,D5,D6,D7,E3,E4,E5,E6,E7,E9,F1,F2,F3,F4,F5,F6,F7,F8,F9,G2,G3,G4,G5,G8,G9,H3,H6,H7

Found points, sensor mapping:
       1    2    3    4    5    6    7    8    9
A : [   ][   ][ X ][   ][   ][   ][   ][ X ][   ]
B : [ X ][   ][ X ][ X ][ X ][   ][   ][ X ][ X ]
C : [   ][   ][ X ][ X ][ X ][ X ][ X ][   ][   ]
D : [   ][   ][ X ][ X ][ X ][ X ][ X ][   ][   ]
E : [   ][   ][ X ][ X ][ X ][ X ][ X ][   ][ X ]
F : [ X ][ X ][ X ][ X ][ X ][ X ][ X ][ X ][ X ]
G : [   ][ X ][ X ][ X ][ X ][   ][   ][ X ][ X ]
H : [   ][   ][ X ][   ][   ][ X ][ X ][   ][   ]
I : [   ][   ][   ][   ][   ][   ][   ][   ][   ]

andydragon69

I was able to map all the PDAF points in the AF Points Used data for Nikon Z6 and Z7 (not sure about Z50) when the Phase Detect AF is On (8):


Found points, byte mapping:
       7    6    5    4    3    2    1    0
00 : [H5 ][G5 ][F5 ][A5 ][B5 ][C5 ][D5 ][E5 ]
01 : [G6 ][F6 ][A6 ][B6 ][C6 ][D6 ][E6 ][I5 ]
02 : [F4 ][A4 ][B4 ][C4 ][D4 ][E4 ][I6 ][H6 ]
03 : [A7 ][B7 ][C7 ][D7 ][E7 ][I4 ][H4 ][G4 ]
04 : [B3 ][C3 ][D3 ][E3 ][I7 ][H7 ][G7 ][F7 ]
05 : [C8 ][D8 ][E8 ][I3 ][H3 ][G3 ][F3 ][A3 ]
06 : [D2 ][E2 ][I8 ][H8 ][G8 ][F8 ][A8 ][B8 ]
07 : [E9 ][I2 ][H2 ][G2 ][F2 ][A2 ][B2 ][C2 ]
08 : [I9 ][H9 ][G9 ][F9 ][A9 ][B9 ][C9 ][D9 ]
09 : [H1 ][G1 ][F1 ][A1 ][B1 ][C1 ][D1 ][E1 ]
0a : [   ][   ][   ][   ][   ][   ][   ][I1 ]
Found 81 of 81 points: A1,A2,A3,A4,A5,A6,A7,A8,A9,B1,B2,B3,B4,B5,B6,B7,B8,B9,C1,C2,C3,C4,C5,C6,C7,C8,C9,D1,D2,D3,D4,D5,D6,D7,D8,D9,E1,E2,E3,E4,E5,E6,E7,E8,E9,F1,F2,F3,F4,F5,F6,F7,F8,F9,G1,G2,G3,G4,G5,G6,G7,G8,G9,H1,H2,H3,H4,H5,H6,H7,H8,H9,I1,I2,I3,I4,I5,I6,I7,I8,I9

Found points, sensor mapping:
       1    2    3    4    5    6    7    8    9
A : [ X ][ X ][ X ][ X ][ X ][ X ][ X ][ X ][ X ]
B : [ X ][ X ][ X ][ X ][ X ][ X ][ X ][ X ][ X ]
C : [ X ][ X ][ X ][ X ][ X ][ X ][ X ][ X ][ X ]
D : [ X ][ X ][ X ][ X ][ X ][ X ][ X ][ X ][ X ]
E : [ X ][ X ][ X ][ X ][ X ][ X ][ X ][ X ][ X ]
F : [ X ][ X ][ X ][ X ][ X ][ X ][ X ][ X ][ X ]
G : [ X ][ X ][ X ][ X ][ X ][ X ][ X ][ X ][ X ]
H : [ X ][ X ][ X ][ X ][ X ][ X ][ X ][ X ][ X ]
I : [ X ][ X ][ X ][ X ][ X ][ X ][ X ][ X ][ X ]


Is there a git repo either on GitHub or somewhere else that I can look at creating a pull request?  Is https://github.com/exiftool/exiftool the appropriate GIT repo?

andydragon69

Trying to update the code for the new map of focus points but I'm afraid I'm willfully ignorant of Perl, so I'm not sure how to make this code skip the first two bytes of the value:


        { #AD (Z6/Z7)
            Name => 'AFPointsUsed',
            Condition => '$$self{PhaseDetectAF} == 8 and $$self{Model} =~ /^NIKON (Z 6|Z 7)$/',
            Notes => q{
                models with 81-selectable point AF -- 9 rows (A-I) and 9 columns
                (1-9) for phase detect AF points. Center point is E5
            },
            Format => 'undef[13]',                  -- This value is 13 bytes, but I need to skip the first two and process the 11 bytes after that
            ValueConv => 'join(" ", unpack("H2"x13, $val))',
            ValueConvInv => '$val=~tr/ //d; pack("H*",$val)',
            PrintConv => sub { PrintAFPoints(shift, \%afPoints81); },
            PrintConvInv => sub { PrintAFPointsInv(shift, \%afPoints81); },
        },


Hopefully someone can help me out how to skip the first two bytes.  So close to making this work.

andydragon69

I was able to figure this out by just starting my map at index 17 instead of 1.  I have created a pull request from my fork / branch with the changes.  Would love to see this become part of the official tool.

Phil Harvey

...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Phil Harvey

Could you also take a look at the PrimaryAFPoint to see if this is decoded properly?

Thanks.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

andydragon69

I don't have any images (out of almost 30k shots) on these two cameras where the PrimaryAFPoint is set to anything other than 0 or 1?

Primary AF Point                : 1
AF Points Used                  : 00 00 00 00 00 00 00

Without -n is:

Primary AF Point                : C6 (Center)
AF Points Used                  : (none)

for those with none:

Primary AF Point                : 0
AF Points Used                  : 2f 00 00 18 00 f8 00 e0 03 80 0f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 2f 00 00 00

OR

Primary AF Point                : (none)
AF Points Used                  : A1,A2,A3,A4,A6,A28,A29,B15,B16,B17,B18,B19,C4,C5,C6,C7,C8,C22,C23,C24,C25,C26,M21,N8,N9,N10,N11,N13

Phil Harvey

...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

andydragon69

I did eventually find some Nikon Z50 files with the AF Points Used set.  Looks like they are the same and the model 'NIKON Z 50' can be included along with 'NIKON Z 6' and 'NIKON Z 7'.  I confirmed that the values match the Z6/Z7 for the two sample images I found.  I can create another pull request or leave it to you to make that small change, let me know which you prefer.

andydragon69

I created the pull request with the update to include Nikon Z 50.

Phil Harvey

Great, thanks.  I was wondering about the Z50.  I think I'll just apply this patch to all Z models for now.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).