Set focus question - page 3 - General Help and Assistance on using CHDK stable releases - CHDK Forum

Set focus question

  • 29 Replies
  • 2846 Views
Re: Set focus question
« Reply #20 on: 05 / August / 2020, 09:23:02 »
Advertisements
@c_joerg

Thanks.

*

Offline reyalp

  • ******
  • 13673
Re: Set focus question
« Reply #21 on: 05 / August / 2020, 12:44:52 »
For my own education I'm trying to dive deeper into the CHDK c code.

I'm starting in a place I know: shooting.c.

In this piece of code we see 'lens_get_focus_pos_from_lens'.

The question is: where do I look to find out how lens_get_focus_pos_from_lens is calculated. It doesn't appear to be defined in shooting.c.
For that specific function, see my earlier post in this thread: https://chdk.setepontos.com/index.php?topic=14086.msg143918#msg143918
Quote
lens_get_focus_pos and lens_get_focus_pos_from_lens are platform specific, defined in each platform wrappers.c. Typically they call firmware functions named _GetFocusLensSubjectDistance() and _GetFocusLensSubjectDistanceFromLens() respectively.
In other words, it's not calculated by CHDK. It comes from a firmware function.

As c_joerg says, the usual way to track these things down is to search the whole source. I tend to use grepwin https://tools.stefankueng.com/grepWin.html
Don't forget what the H stands for.

Re: Set focus question
« Reply #22 on: 05 / August / 2020, 23:25:35 »
FWIW, and I've posted this before, it's my belief that Powershots don't care about focus distance accuracy.  In AF mode they use a fast feedback loop to look for the sharpest image in software and adjust based on that. The reported focus distance is just an uncalibrated guess by the software so that it has a value to plug into the image's EXIF. CHDK pulls those same uncalibrated values out and then people get confused about why they make little sense. On most of the Powershots the huge depth of field and tiny sensors make accurate focus distance information irrelevant to most users.
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Set focus question
« Reply #23 on: 06 / August / 2020, 01:24:29 »
@waterwingz

Quote
In AF mode they use a fast feedback loop to look for the sharpest image in software and adjust based on that.

Quote
On most of the Powershots the huge depth of field and tiny sensors make accurate focus distance information irrelevant to most users.

For my use, I’m in MF mode. Also, my interests are aimed at the PSs with ‘larger’ sensors, eg G5X and G1X.

I’ve decided my approach is good enough. That is manually set focus on the closest object, accept the CHDK focus distance reported, use that to initiate focus bracketing and accept the set_focus reporting is ‘good enough’.

Thanks for your insight.


*

Offline Caefix

  • *****
  • 842
  • Sorry, busy deleting test shots...
Re: Set focus question
« Reply #24 on: 07 / August / 2020, 15:07:42 »
I would search global over all sources...
Notepad ++ has this feature too (and some nice plugins @ homepage)
« Last Edit: 07 / August / 2020, 15:09:19 by Caefix »
All lifetime is a loan from eternity.

Re: Set focus question
« Reply #25 on: 09 / August / 2020, 11:16:37 »
I’ve decided my approach is good enough. That is manually set focus on the closest object, accept the CHDK focus distance reported, use that to initiate focus bracketing and accept the set_focus reporting is ‘good enough’.
Sounds like a good approach. Once you realize the distance value CHDK gets from the Canon firmware is not calibrated (as Canon does not attempt to calibrated it for the reasons mentioned earlier) then if your script can work relative to that value you should have success.
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Set focus question
« Reply #26 on: 09 / August / 2020, 11:28:36 »
@waterwingz

Quote
your script can work relative to that value you should have success.

In the ‘final’ version, published today, I believe the optical equations, eg DoFs etc, are pretty good. I also decided to do all the DoF calculations in what I call ‘request space’, thus reducing the accumulation of Canon lens errors.

As usual, thanks for your support/guidance, as well as @reyalp

Cheers

Garry
« Last Edit: 09 / August / 2020, 11:36:32 by pigeonhill »

Re: Set focus question
« Reply #27 on: 09 / October / 2020, 11:19:40 »
FWIW, and I've posted this before, it's my belief that Powershots don't care about focus distance accuracy.  In AF mode they use a fast feedback loop to look for the sharpest image in software and adjust based on that. The reported focus distance is just an uncalibrated guess by the software so that it has a value to plug into the image's EXIF. CHDK pulls those same uncalibrated values out and then people get confused about why they make little sense. On most of the Powershots the huge depth of field and tiny sensors make accurate focus distance information irrelevant to most users.


Hey I've been a couple of months out of CHDK, and now that I check back I see that my suspicion about focus distance is confirmed. Good to know! It drove me a bit crazy when trying to write a focus table for my multi camera setup, despite same models and same distances, distance numbers were all over the place and it left me stumped... Question is, are these numbers consistent? Same value will produce the same focus distance everytime? If it does, it gives me a couple of ideas to write that focus table...


*

Offline c_joerg

  • *****
  • 1211
Re: Set focus question
« Reply #28 on: 09 / October / 2020, 11:34:46 »
Same value will produce the same focus distance everytime?


from my experience not ...
M100 100a, M3 101a, G9x II (1.00c), 2*G1x (101a,100e), S110 (103a), SX50 (100c), SX230 (101a), S45,
Flickr https://www.flickr.com/photos/136329431@N06/albums
YouTube https://www.youtube.com/channel/UCrTH0tHy9OYTVDzWIvXEMlw/videos?shelf_id=0&view=0&sort=dd

*

Offline reyalp

  • ******
  • 13673
Re: Set focus question
« Reply #29 on: 09 / October / 2020, 13:50:39 »
Same value will produce the same focus distance everytime?
from my experience not ...
I agree. Also, the SD value you get from a given set_focus value isn't deterministic. That is, if you call set_focus with say 1000, 1500, 2000, the get_focus values might be 950, 1600, 2040 one day, and 990, 1500, 1990 another...
You can even see this with the Canon MF control on some cameras
Don't forget what the H stands for.

 

Related Topics