Author Topic: Focus distance strangeness  (Read 401 times)

garry23

  • Contributor
  • Hero Member
  • *****
  • Posts: 1703
Focus distance strangeness
« on: May 04, 2019, 10:10:57 AM »
I’ve spent a long time trying to understand Canon focus reporting, which is what I believe ML reports. That is the distance between the subject and the sensor plane.

In EXIF data, the Canon maker info reports upper and lower figures for focus distance, and these don’t seem to match the ML reporting well.

I just did the following test on a 24-105 F/4L.

Set the lens to 105mm, ie where one gets the max magnification and focused on a subject  (a test card) at about 2m away. I used auto focused and manual focus and always got a reasonable match to the ML reported focus distance.

I then changed focal length to 24mm and refocused, both trying auto and manual, and the ML focus distance now does not match the actual distance, which hasn’t changed from the first test. It is reported well short.

Something is not right.

My simple conclusion is that the ML, Canon, focus distance reporting is only ‘right’ at the long focal length of a zoom lens. After all this is where Canon reports their maximum magnification in the spec.

Does anyone else have any insight here?

70MM13

  • Member
  • ***
  • Posts: 223
Re: Focus distance strangeness
« Reply #1 on: May 04, 2019, 12:10:34 PM »
i've noticed a similar error in the reporting of focal distance in the canon dpp utility when using their "digital lens optimizer" tool.  the slider always shows the maximum focal distance when loading the image, no matter what the actual focal distance was for the shot.

this has been the case for as long as i can recall, going back many years...


a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 12181
  • Maintenance mode
Re: Focus distance strangeness
« Reply #2 on: May 04, 2019, 12:24:43 PM »

Walter Schulz

  • Contributor
  • Hero Member
  • *****
  • Posts: 6675
Re: Focus distance strangeness
« Reply #3 on: May 04, 2019, 12:26:00 PM »
@garry23:
Focus to 2 m, remove battery, insert battery. Now redo test.
Why? Because i got a ton of lens related issues browsing through lesser used ML features. You may redo your test with a quite old lens ("100/2.8 Macro USM (without IS L) era" old).
Photogs and videographers: Assist in proof reading upcoming in-camera help!. Your input is wanted and needed!

garry23

  • Contributor
  • Hero Member
  • *****
  • Posts: 1703
Re: Focus distance strangeness
« Reply #4 on: May 04, 2019, 01:24:21 PM »
@all

Have repeated testing several times and just did again.

Pulling battery does nothing, ie at 105mm lens reports a reasonably repeatable distance, ie 1.42m in this case.

Change FL to 24mm and I get 1.16.

Now I find it strange that the difference is the magnification FL difference ie (1+Max_Mag*(FL/Max_FL))/(1+Max_Mag)

Cheers

Garry

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 12181
  • Maintenance mode
Re: Focus distance strangeness
« Reply #5 on: May 04, 2019, 02:01:21 PM »
In your first post, you have mentioned some different sources of information:

- focus distance, as reported by ML
- minimum focus distance, as reported by Canon firmware in EXIF
- maximum focus distance, as reported by Canon firmware in EXIF

And some variables that could affect the outcome:

- lens: 24-105 F/4L (not everybody owns it, so you have to do the experiment and document it properly)
- lens focal length (105mm, 24mm)
- actual focus distance (close to 2 meters)

Is it unreasonable to ask for a table showing all these values during the experiment?

Also include other values printed by ML, that could be relevant (such as aperture, DOF near/far, hyperfocal and so on). You know these a lot better than me ;)

Without the numbers, I'm simply unable to follow your post.

garry23

  • Contributor
  • Hero Member
  • *****
  • Posts: 1703
Re: Focus distance strangeness
« Reply #6 on: May 04, 2019, 02:36:19 PM »
@a1ex

I have repeated the test with a Sigma 12-24mm, as well as the 24-105mm F/4L.

I kept the aperture constant at F/5.6 throughout.

I set the Sigma at 24mm and used auto focus and got the distance reported at 93cm, which I confirmed with a tape measure as being the distance between the sensor plane and the test object, a B&W flat test card.

I didn't move the camera and changed the Sigma's FL to 12mm and used auto focus several time, and got the constantly correct result of 93cm as the focus distance.

 :)

I kept the camera in the same place and changed the lens to the Canon 24-105 and set FL to 105.

Auto refocused several time and got 93cm.  :)

Changed the FL to 24 and repeated the auto refocus test several time and got 84cm each time :-(

As I say: strange  ???


a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 12181
  • Maintenance mode
Re: Focus distance strangeness
« Reply #7 on: May 04, 2019, 03:20:21 PM »
- focus distance, as reported by ML
- minimum focus distance, as reported by Canon firmware in EXIF
- maximum focus distance, as reported by Canon firmware in EXIF

Which of these was 93 and 84?

What values did you get for the other two?

What about DOF far/near, hyperfocal and so on?

What is the resolution of your lens encoder? (i.e. the next "focus distance"-s reported right below and right above 93 and 84, as you turn the focus ring)

Sorry, your report is not precise. Playing "twenty questions" to extract the useful values, is not fun. Please document what you did, in a way that others can understand. I'm unable to follow.

garry23

  • Contributor
  • Hero Member
  • *****
  • Posts: 1703
Re: Focus distance strangeness
« Reply #8 on: May 04, 2019, 03:50:16 PM »
@a1ex

Sorry, not trying to be difficult  ;)

Repeated the test with the 24-105 at f/5.6.

Set to FL of 105mm; ML focus in LV reported as 1.06m. ML hyperfocal, near DoF and near DoF reported as: 65m, 1.04m, 1.07m. Using simple, ie not diffraction aware. Canon EXIF for FocusDistance Upper says 1.06M and Lower 0.98m.

Switched to 24mm FL and auto focused several times to prove repeatable of focus. ML LV focus stated as 91cm. ML hyperfocal, near DoF and near DoF reported as: 3.47m, 82cm, 1.47m. Using simple, ie not diffraction aware. Canon EXIF says Upper is 0.91 and lower is 0.84.

As I say, the strangeness is that the focus distance should be the same. Hyperfocal changes from FL changing, and DoFs are related to focus distance and H.

garry23

  • Contributor
  • Hero Member
  • *****
  • Posts: 1703
Re: Focus distance strangeness
« Reply #9 on: May 04, 2019, 04:58:11 PM »
@a1ex

...plus have noticed that the ML reported lens focus distance can be out relative to the EXIF Canon (upper and lower), unless I inject a short sleep.

In the tests I've run, with a sleep between two images, at 8m and 16m, the EXIF is around 8m and 16m.

Without the sleep I see 8m and 8m.

Have you seen that before?

BTW I do wait

Code: [Select]
function my_shoot()
    camera.shoot()
    camera.wait()
end

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 12181
  • Maintenance mode
Re: Focus distance strangeness
« Reply #10 on: May 04, 2019, 05:47:30 PM »
Quick test with the 50/1.8 STM and 5D2. Actual focus distance not measured; only cross-checked values from ML with those from EXIF.

Code: [Select]
Focus dist  Focus dist  Focus dist   Aperture
Disp by ML  Lower EXIF  Upper EXIF
  34cm        0.34m       0.34m        f/1.8
  37cm        0.34m       0.37m        f/1.8
  41cm        0.37m       0.41m        f/1.8
  47cm        0.41m       0.47m        f/1.8
  53cm        0.47m       0.53m        f/1.8
  62cm        0.53m       0.62m        f/1.8
  73cm        0.62m       0.73m        f/1.8
  87cm        0.73m       0.87m        f/1.8
  1.10m       0.87m       1.1m         f/1.8
  1.41m       1.1m        1.41m        f/1.8
  1.99m       1.41m       1.99m        f/1.8
  3.50m       1.99m       3.5m         f/1.8
  8.61m       3.5m        8.61m        f/1.8
  inf         81.91m      inf          f/1.8
  inf         81.91m      inf          f/22
  8.61m       3.5m        8.61m        f/22
  3.50m       1.99m       3.5m         f/22
  1.99m       1.41m       1.99m        f/22
  1.41m       1.1m        1.41m        f/22
  1.10m       0.87m       1.1m         f/22
  87cm        0.73m       0.87m        f/22
  73cm        0.62m       0.73m        f/22
  62cm        0.53m       0.62m        f/22
  53cm        0.47m       0.53m        f/22
  47cm        0.41m       0.47m        f/22
  41cm        0.37m       0.41m        f/22
  37cm        0.34m       0.37m        f/22
  34cm        0.34m       0.34m        f/22

Remarks:

- the focus distance encoder has a small number of unique positions
- there's no hysteresis (same values when turning the focus ring back and forth)
- aperture does not affect the results (so, "Lower" and "Upper" have nothing to do with DOF near/far)
- the value displayed by ML always matches the "Upper" distance reported in EXIF
- there is another "Lower" distance, currently ignored by ML
- unique values of "Lower" are mostly the same as for "Upper", with one exception on my lens (81.91m vs infinity)
- "Lower" and "Upper" in EXIF must be the ends of an interval where the actual focus distance is believed to be (by Canon firmware)
- since ML only displays the right end of the interval, it overestimates the EXIF value
- the mean value of the two distances might be a better estimation
- the geometric mean might be even better (rationale somewhere in this topic; I can make some plots if needed).

Delay: outside LiveView, ML refreshes the lens parameters once per second (by polling the MPU). By default, Canon firmware does not refresh this information unless you take a picture. So, if you print the focus distance from ML (e.g. from a Lua script) before taking a picture, without waiting for a refresh, you may get old (incorrect) values.

TLDR - yes, the focus distance reported by ML could be a bit better.


The difference you are seeing might be simply from the encoder resolution.

garry23

  • Contributor
  • Hero Member
  • *****
  • Posts: 1703
Re: Focus distance strangeness
« Reply #11 on: May 04, 2019, 06:05:56 PM »
@a1ex

Once again, thanks for the insight.

Regarding this insight:

Quote
Delay: outside LiveView, ML refreshes the lens parameters once per second (by polling the MPU).

As my script runs in LV only, do I assume that the lens parameter refresh is 'instant', or is it still once per second.

BTW I'm going to stop now and carry on experimenting myself, ie you should go back under cover  ;)

c_joerg

  • New to the forum
  • *
  • Posts: 36
Re: Focus distance strangeness
« Reply #12 on: May 04, 2019, 11:41:37 PM »
Quick test with the 50/1.8 STM and 5D2.
I did some investigation with the M3 as well
https://chdk.setepontos.com/index.php?topic=13756.20

- the focus distance encoder has a small number of unique positions
Max 31 positions on my efs 55-250 mm  is stm

I find it interesting that all my lenses have the same maximum lower focus distance

Focus Distance Lower max    : 8191cm
Focus Distance Upper max    : 65535 cm => inf

- aperture does not affect the results (so, "Lower" and "Upper"
I notice this as well..


- the mean value of the two distances might be a better estimation
 

I think these values are just any table values. They are not very accurate either. My G1x provides much more accurate distance values





6D

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 12181
  • Maintenance mode
Re: Focus distance strangeness
« Reply #13 on: May 05, 2019, 07:20:47 AM »
Quote
I think these values are just any table values. They are not very accurate either.

Fully agree. However, if we were to display just one value, I believe the geometric mean would be the best choice.

Why? Plot the same graphs as (steps, 1 / distance) on linear scale; the result will be a lot closer to a straight line. That means, arithmetic mean will be a lot more biased than geometric mean, for estimating the "middle" distance (between the two limits provided by Canon firmware).

c_joerg

  • New to the forum
  • *
  • Posts: 36
Re: Focus distance strangeness
« Reply #14 on: May 05, 2019, 10:52:48 AM »
Why? Plot the same graphs as (steps, 1 / distance) on linear scale; the result will be a lot closer to a straight line.
Right…
So, if you know upper and lower distance you could implement a function which gives you a focus distance for each step…

@a1ex
I hope I do not disturb your break...

Is it possible (after AF) to read the absolute number of focus steps?
Code: [Select]
call_event_proc("EFLensCom.MoveFocus",steps,speed)On the M3 I can also change the speed. Do you know which influence the speed has or where are the limits?



6D