Canon MakerData focusing distance

Started by sergenious, March 24, 2025, 07:13:43 AM

Previous topic - Next topic

sergenious

I am working on an Android application to browse photos in the way it should always be (that is, by physical directories, like on Windows, and not everything flat and sorted by date, like the stupid stock Android "Gallery" apps do):

- https://github.com/sergenious/MediaBrowserAndroid

This app displays as much EXIF values, as I thought was necessary and mostly the values that are contained in my photo files from several photo cameras, which I owned during my life: https://github.com/sergenious/MediaBrowserAndroid/blob/main/app/src/main/java/com/sergenious/mediabrowser/io/exif/ExifTag.java

However, I am struggling with Canon Maker notes. As it's proprietary format, no official specification exists. I understand that. The best source I found until now is this one:

- https://github.com/leapmotion/FreeImage/blob/master/Source/Metadata/TagLib.cpp#L239

Here, I am most interested in FocusDistanceUpper and FocusDistanceLower. But when I read this structure of tag 4, I get back 34 short values, as is expected. But the values for FocusDistanceUpper and Lower at the offsets 19 and 20 are always 0.

How does your ExifTool know how to interpret these values? As it does display them correctly in meters.

Phil Harvey

First, the page you reference is 10 years old, so newer cameras won't be represented.

Second, the FocusDistance tags are found in different locations for different models.  ExifTool currently extracts them from 21 different locations, but your reference lists only 1.

Here is the ExifTool code to extract Canon MakerNote information.

The FocusDistance tags are stored as 16-bit unsigned integers in reverse byte order.  Divide by 100 to get meters.  A value of 65535 is infinity.

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

sergenious

Wow, thank you, you are amazing. Thanks, will check the code.

I only don't understand, how the EXIF standard was so shortsighted, to not expect such fields, and that camera manufacturers didn't unify by using some same custom EXIF tags, which would then later became a standard. Now the whole EXIF stuff is just one chaos :(

I also don't understand, why the maker data is such a closed secret, for the manufacturers to not reveal the specifications. What would they loose by publishing the specs?

Phil Harvey

I have said repeatedly that the people responsible for the EXIF specification are brain dead.

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