AF Info decoding isses for D7500?

Started by capricorn, February 01, 2025, 09:00:17 AM

Previous topic - Next topic

capricorn

While working with Nikon DSLR images to complete Nikon support of the Focus Points plugin, I found that there seems to be a decoding issue with D7500 AF info. (example file from depreview).

Full exiftool output shows two entries for PrimaryAFPoint, one of which is "Unknown".

D7500-1.jpg

Also, I found that D7500 is the only Nikon D/Z model I came across so far that can't be patched by exiftool to show the complete PD focus point layout (by writing the complete set of focus point names to AFPointsUsed). After running exiftool, AFPointsUsed has the proper value, but NX Studio will stick to the same single focus point of the original image. Not sure, it this "grid thing" is a NX Studio issue but since it's also related to AFPoint tags perhaps it's connected.


Phil Harvey

This will be difficult to decode fully without a D7500 but I'll see what I can do.  See this post for a similar issue, but in that case I had my D500 available to make my one sample images at the various AF settings.

On first inspection, it seems as if the D7500 uses 0x1c AFPointsSelected for the 51-point mode.  I don't know about the other modes yet.  I doubt this was ever decoded properly for the D7500 since we tend to concentrate on the high-end DSLR's first.

- 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 ($).

capricorn

I was not aware that it could be that difficult. Been looking at this camera as one the last DSLRs launched by Nikon.
If this will be missing from the list of supported cameras, I don't think I will get a big shitstorm ;D

capricorn

Quote from: Phil Harvey on February 01, 2025, 10:45:40 AMit seems as if the D7500 uses 0x1c AFPointsSelected for the 51-point mode.  I don't know about the other modes yet. 
This triggers a question that popped up yesterday. It's not related to D7500 but D780.

D780 was the first Nikon DSLR I came across the models I worked on to add them to the plugin, that seems to have three different

capricorn

Quote from: Phil Harvey on February 01, 2025, 10:45:40 AMit seems as if the D7500 uses 0x1c AFPointsSelected for the 51-point mode.  I don't know about the other modes yet. 
This triggers a question that is not related to D7500 but D780. D780 was the first model I came across that seems to have 3 different modes of storing AF information. See below. The standard Phase Detect mode using focus point names highlighted in blue, Contrast Detect mode using x, y, height and width in pixels highlighted in green. Plus a third mode, where EXIF says both PhaseDetect and ContrastDetect is "On" and a different grid (81-point instead of 51-point) is used to store AF information in PDAF format.

Do you know this behavior? Are there other models which are also using different types of x-point grids in different AF modes?

D780 AF Points.jpg


Phil Harvey

Yes.  The D7500 for example has at least 4 different AF modes.  3 with phase-detect and a different number of AF points, and 1 contrast detect mode where the AF area position and size is reported instead of individual points.

- 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 ($).

Phil Harvey

Honestly, the whole Nikon AF-point situation needs a bit of cleaning up, but this will be nearly impossible to do properly without being able to shoot test samples with the various models.

I tested various samples for the D7500 that I was able to download.  The AF-point information is stored in 4 separate locations:  2 called PrimaryAFPoint, 1 called AFPointsUsed, and a new one I'm calling AFPointsInFocus which is the one that Capture NX-D uses to display the AF points.  Whether or not "AFPointsInFocus" is the correct name, your guess is as good as mine, but this tag was at the same location as the D500 AFPointsInFocus tag (and I do have the D500 in hand so its AF decoding should be fairly reliable).

I also played with some D3400 samples and found that ExifTool wasn't extracting the Nikon-software-displayed AF points for these either, so I decoded a new tag I'm calling AFPointsSelected for this model (since it was at the same location as the D500 AFPointsSelected tag).  There are likely other models that need work, and testing with various AF modes, but again, there is only so much that can be done without having the camera in hand.

- 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 ($).

capricorn

Quote from: Phil Harvey on February 03, 2025, 09:22:57 AMThe AF-point information is stored in 4 separate locations:  2 called PrimaryAFPoint, 1 called AFPointsUsed, and a new one I'm calling AFPointsInFocus which is the one that Capture NX-D uses to display the AF points.  Whether or not "AFPointsInFocus" is the correct name, your guess is as good as mine
What??? My world view is collapsing right now! I used to firmly believe that exiftool was beyond reproach, and that the metadata structure used was like a law carved in stone!!! ;D
Joking aside. If I can support with test samples (files or conclusion regarding included AF metadata) I use for the focus point plugin, I'm happy to help.

I checked 13.18 on the 65 D7500 test files I have downloaded. Now the two instances of PrimaryAFPoint (a tag which is also used by the plugin) always show the same value, so I guess I will remove the workaround to handle corrupt information for D7500. Thanks for looking into this and providing a fix!

Coming back to "AF-point information is stored in 4 separate locations". For D850 I have seen some interesting files, where PrimaryAFPoint is different from AFPointsInFocus and is also not contained in AFPointSelected. I will put something together later, perhaps this can help to understand the different meaning of these entries.

capricorn

Instead focusing on the "interesting D850 files" I have run exiftool over my entire collection of Nikon DSLR test files, which cover all cameras with min. 39 focus points. For some models I have just few files, for others it's a bigger number. See attachment for results.

From the contiguous gaps in AFPointsSelected and AFPointsInFocus it seems obvious that either Nikon has handled specific models differently from others, or it's an inconsistency in decoding.

In more than 80% of all the cases, PrimaryAFPoint is same as AFPointsUsed and this is what NX Studio displays.

The remaining 20% consist of quite a few D7500 images. I have skipped these for more detailed analysis, because it's too difficult to judge the name of displayed focus point without having the visual aid of the entire focus points layout.

Unlike for all other Nikon DSLRs, exiftool doesn't allow any focus points to be written to a D7500 original file. I have been using this method to create a complete layout of all focus points in an image file, display the image in NX Studio and take basic measurements to create a mapping file that reproduces the cell layout for use by the plugin.


capricorn

... continuing ...

By comparing the plugin's output (overlaid with the complete fp layout) against NX Studio it's easy to verify the focus point names.


For D780, D810 and D850 there are cases in which NX Studio does not display PrimaryAFPoint but AFPointsUsed or AFPointsSelected.

For me as a non Nikon user it's hard to interpret this. Also, I don't know whether NX Studio is considered the ultimate reference if it comes to evaluating focus / focus points.

If you want to have any of the files, let me know.

AFPoints Results.xlsx

Phil Harvey

Quote from: capricorn on February 04, 2025, 02:45:49 PMUnlike for all other Nikon DSLRs, exiftool doesn't allow any focus points to be written to a D7500 original file.

It should.  I tested 13.18 and it works for me to write AFPointsInFocus when I am viewing them with Capture NX-D.

Quote from: capricorn on February 04, 2025, 03:10:46 PMFor D780, D810 and D850 there are cases in which NX Studio does not display PrimaryAFPoint but AFPointsUsed or AFPointsSelected.

.. and probably AFPointsInFocus for the D7500.  I know.  It's a mess. :(  It would be really nice if all of the Nikon-app-displayed AF points were consistently named, but I'm not sure that even Nikon is consistent about which ones they display.  At any rate, it would be a major project to try to clean this up.

- 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 ($).

capricorn

Quote from: Phil Harvey on February 04, 2025, 04:47:01 PMIt should.  I tested 13.18 and it works for me to write AFPointsInFocus when I am viewing them with Capture NX-D.
You're right! The difference with D7500 is that my used procedure to create the AF layout grid by patching AFPointsUsed leads to an error "files weren't updated due to errors". Writing AFPointsInFocus works, while exiftool's behavior is the exact opposite for other cameras. No problem, I'm happy if one method works 😊

So far, Capture NX-D was not on my radar. I installed it as well and it seems that for the special cases I mentioned in my previous post at least it shows the same focus point display behavior as NX Studio. Anything else would have thrown me into complete chaos😄

For me, the discussion about the various AFPoint tags is very helpful indeed, as it helps me to better understand the original implementation of the plugin, what I should change to be consistent with what Nikon does, and why.

Looking at the below D500 image with its Primary AF Point P (which is same as AFPointInFocus), how would you assess the meaning of other focus points U (FocusPointsUsed) and S (FocusPointsSelected) ?

DSC_1284.NEF Focus Points.jpg
DSC_1284 AFInfo.jpg

Phil Harvey

I'm just guessing, but I imagine that maybe one could select an AF point and the camera could choose a nearby one to use instead.  Perhaps this sort of thing may be changed in the camera autofocus settings -- I don't have time to look into this in detail.  It is always tricky to determine the reason why a camera would store very nearly the same metadata in multiple places.

- 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 ($).

capricorn