AFInfo Tags for Pentax K3-iii

Started by ulrichk7, May 26, 2024, 07:22:54 AM

Previous topic - Next topic

ulrichk7

HI,

found some infos about the tag here .
This seems to be what is used by the K3-iii (the AFPointsInFocus is empty), but some of the info is not relevant for K3-iii(?)

I wonder, if it is possible to get the points in focus and to assign them to one of the 101(!) AF points of the camera.
The camera knows this  ;) see attachment - foto of the LCD monitor and the red-dot mark of the point in focus (Autofocus_sample.jpg).

My 'project' is to show this on the PC. Therefor I extract the (smaller) jpg from the DNG by
exiftool -b -W %d%f_AF.%s -copy0:previewimage -PreviewImage picture.DNG

An then fade it and compose with a prepared png of all AF points by
convert picture_AF.jpg -fill white -colorize 50% AF_points.png -gravity center -composite picture_with_AF_points.jpg

This works quite well and results in the second attachment (picture_with_AFpoints.jpg).

While this was the easy part, the question is now how to get the points in focus from the EXIF AFInfo and color them in red in the output?

exiftool -U -s '-Pentax_AFInfo*' picture.DNG
gives me 4976 lines of output.

I could prepare some sample DNG or need advice how to proceed.
Thank you in advance

Ulrich






StarGeek

Unfortunately, most camera companies do not document their MakerNotes. What is known of the MakerNotes has only been found by people testing things out by taking a photo, changing a setting, taking another photo, compare what has changed, etc.

It's quite probable that nobody knows what all that data means. Two of the tags listed under AFInfo literally have "Unknown" in their name.

So there's not much help to be offered. With thousands of lines of data, it seems like a huge task that nobody has felt it was worth the time needed to decode it, especially since camera companies are constantly changing formats and the results might not be transferable to other models.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

ulrichk7

Thank you StarGeek for the quick reply.
Yes, I was afraid of that. 4976 is a bit too much for trial and error.
I also read somewhere that the meaning might change in different firmware versions.
So I guess I will live with the two easy steps and - in case - do the coloring manually according to the LCD info.

Ulrich

Phil Harvey

This shouldn't be too hard to find.  If more than 1 AF point may be active at the same time, then the 101 AF points may be represented by the bits in 13 bytes.  But presumably there is also a primary AF point that may be represented by a single byte.  If you can shoot a series of 8 images I may be able to figure it out.  If we number the AF rows by letter A-I and the columns 1-13, then samples with AF points in this sequence would be good: A1,A2,A3,A13,B1,B2,E7(center),I13.  (For reference the picture you posted uses A11.)  You can email the samples to me: philharvey66 at gmail.com

- 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 May 27, 2024, 01:37:46 PMThis shouldn't be too hard to find.

Since there were no further replies to this topic and I couldn't find any corresponding entries in the "ancient history" I assume the task was hard enough so that nobody dared to tackle this 😄

A user of the LrC focus point plugin has contacted me to asked for K-3 III support. Of course, I'm unable to visualize focus points information that exiftool does not decode.

The guy has provided me with 41 JPG ooc images (one per each user-selectable point in focus) and I have gathered all Pentax_AFInfo tags in one big Excel file (4969 tags x 41 values). If you remove the all-zero tags, there are still ~2800 lines left.

From your experience, can you advise how to approach this to narrow down the potential entries and finally identify the relevant tags?

Thanks, Karsten

Phil Harvey

Hi Karsten,

I assume you know which focus point is selected for each image.

The easiest thing to do would be to upload these files somewhere and send me a link so I can look at them myself.  I have developed some scripts to compare metadata in multiple files to look for things like this.  My email is philharvey66 at gmail.com

- 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

I got the files and have taken a first look... nothing obvious.  Are we sure that this information is recorded?  Does any Pentax software show the AF points for this model?

- 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 have tried Pentax' Software Digital Camera Utility Version 5 (DCU) some weeks ago - unfortunately it doesn't show focus points. My contact is not aware of any other way than using the camera display.

Since the JPGs are OOC I would expect that focus point information has been recorded. Anyway, I will double check with my contact to make sure the camera displays focus points for these JPGs.

capricorn

My contact has confirmed that he only recorded JPGs and for these the camera does show focus points.

He also noted:

The SEL XS focus points, which I used for the test images were added to the K 3-III only with firmware version 1.70 in Dec 2022. Originally, the SEL S focus points were slightly larger. "Focusing when using the viewfinder can now be even more precise. The active focus area now also has the option of (XS) for the active AF area in addition to the (S) option."

He will do a second series of 41 images tomorrow using the SEL S focus points, which are slightly larger but exactly in the same place. I have no clue if/how this affects the coding of tags, but if your analysis is fully automated and script-based, it might be worthwhile to give it a try.

- Karsten

Phil Harvey

OK.  These samples could be helpful.  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 ($).

Phil Harvey

#10
I got the second set, thanks.

I've managed to decode the AF Points for the files you sent.  As well, I've fixed decoding of the sensor temperature.  This is what I get for the files:

> exiftool K3-III_AFPoints_* -filename -afpoints -afpointsunknown -sensortemperature -u -T
IMG46885.JPG C2 C2 32.1 C
IMG46886.JPG C3 C3 32.1 C
IMG46887.JPG C4 C4 32.1 C
IMG46888.JPG C5 C5 32.1 C
IMG46889.JPG C6 C6 32.2 C
IMG46890.JPG C7 C7 32.2 C
IMG46891.JPG C8 C8 32.2 C
IMG46892.JPG D1 D1 32.3 C
IMG46893.JPG D2 D2 32.3 C
IMG46894.JPG D3 D3 32.4 C
IMG46895.JPG D4 D4 32.3 C
IMG46896.JPG D5 D5 32.4 C
IMG46897.JPG D6 D6 32.5 C
IMG46898.JPG D7 D7 32.5 C
IMG46900.JPG D8 D8 32.5 C
IMG46901.JPG D9 D9 32.6 C
IMG46902.JPG E1 E1 32.7 C
IMG46903.JPG E2 E2 32.7 C
IMG46904.JPG E3 E3 32.6 C
IMG46905.JPG E4 E4 32.7 C
IMG46906.JPG E5 E5 32.7 C
IMG46907.JPG E6 E6 32.7 C
IMG46908.JPG E7 E7 32.8 C
IMG46909.JPG E8 E8 32.9 C
IMG46910.JPG E9 E9 32.9 C
IMG46911.JPG F1 F1 32.9 C
IMG46912.JPG F2 F2 33.0 C
IMG46913.JPG F3 F3 33.0 C
IMG46914.JPG F4 F4 33.0 C
IMG46915.JPG F5 F5 33.0 C
IMG46916.JPG F6 F6 33.1 C
IMG46917.JPG F7 F7 33.1 C
IMG46918.JPG F8 F8 33.1 C
IMG46919.JPG F9 F9 33.2 C
IMG46920.JPG G2 G2 33.2 C
IMG46921.JPG G3 G3 33.3 C
IMG46922.JPG G4 G4 33.3 C
IMG46923.JPG G5 G5 33.3 C
IMG46924.JPG G6 G6 33.3 C
IMG46925.JPG G7 G7 33.4 C
IMG46926.JPG G8 G8 33.4 C
IMG46954.JPG C2 C2 24.9 C
IMG46955.JPG C3 C3 25.0 C
IMG46956.JPG C4 C4 25.1 C
IMG46957.JPG C5 C5 25.1 C
IMG46958.JPG C6 C6 25.3 C
IMG46959.JPG C7 C7 25.4 C
IMG46960.JPG C8 C8 25.4 C
IMG46961.JPG D1 D1 25.6 C
IMG46962.JPG D2 D2 25.6 C
IMG46963.JPG D3 D3 25.8 C
IMG46964.JPG D4 D4 25.9 C
IMG46965.JPG D5 D5 26.1 C
IMG46966.JPG D6 D6 26.1 C
IMG46967.JPG D7 D7 26.1 C
IMG46968.JPG D8 D8 26.3 C
IMG46969.JPG D9 (none) 26.4 C
IMG46970.JPG E1 E1 26.4 C
IMG46971.JPG E2 E2 26.5 C
IMG46972.JPG E3 E3 26.5 C
IMG46973.JPG E4 E4 26.7 C
IMG46974.JPG E5 E5 26.7 C
IMG46975.JPG E6 E6 26.8 C
IMG46976.JPG E7 E7 26.8 C
IMG46977.JPG E8 E8 27.0 C
IMG46978.JPG E9 E9 27.0 C
IMG46979.JPG F1 E1.E3.F1 27.1 C
IMG46980.JPG F2 F2 27.2 C
IMG46981.JPG F3 F3 27.2 C
IMG46982.JPG F4 F4 27.3 C
IMG46983.JPG F5 F5 27.3 C
IMG46984.JPG F6 F6 27.4 C
IMG46985.JPG F7 F7 27.5 C
IMG46986.JPG F8 F8 27.6 C
IMG46987.JPG F9 F9 27.7 C
IMG46988.JPG G2 G2 27.8 C
IMG46989.JPG G3 G3 27.8 C
IMG46990.JPG G4 G4 27.9 C
IMG46991.JPG G5 G5 27.9 C
IMG46992.JPG G6 G6 28.0 C
IMG46993.JPG G7 G7 28.1 C
IMG46994.JPG G8 G8 28.1 C

Each AF point is represented by a different byte in the AFInfo record, but the order of the points is weird: C3 C4 C5 C6 C7 D3 D4 D5 D6 D7 E3 E4 E5 E6 E7 F3 F4 F5 F6 F7 G3 G4 G5 G6 G7 E1 E9 D2 D8 E2 E8 F2 F8 C2 C8 G2 G8 D1 D9 F1 F9.  Using the -n option gives you the original byte values instead of the AF point names as above.

The decoding for XS and S modes is the same.

I don't know what AFPointsUnknown is indicating, so I'll extract this as an Unknown tag for now.

Expect this update in version 13.27.

- Phil

Edit: Fixed ExifTool version number
...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

OMG, you're a magician, Phil 👏👏👏

I have spent like an hour, filtering out tags that don't seem to be relevant, and searching for row patterns for the remaining tags. What is the trick to approach such a task? Or is it your business secret? 😉😄

P.S.: I guess you're referring to 13.27, right?

Phil Harvey

Yes, 13.27.

The trick was to stare at the -U output until my head started throbbing... ;)

And I'm still staring.  There is some other potentially interesting stuff happening in the AFInfo record.  My normal technique for AF points didn't work because normally they don't have a separate byte for each point.  What worked was to look for bytes that were different for only one image, then I noticed that there was a set of bytes where a different one was non-zero for each image.  It would have been easier if the AF points were ordered, but eventually I spotted this.  It didn't help that some AF points were labelled incorrectly in the 2nd set of images you sent, but this set of images was very helpful for comparison.

The other interesting stuff seems to be a measurement done at each AF point, with a second measurement at each of the 33 inner AF points.  These measurements have values between about -100 and +200, but I don't know what they mean.  I think I'll extract these as AFPointValues and make it Unknown.

- 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

...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

#14
Minor change upcoming in 13.28:  In the event that multiple AF points are active, 13.27 uses a dot (.) as a separator.  13.28 will use a comma (,).

Also, I'm thinking the tag should be called AFPointsSelected instead of AFPoints.

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