supplierdeeply

Trying to understand get_dofinfo()

  • 8 Replies
  • 1454 Views
*

Offline eponymous

  • *
  • 38
  • Canon A4000
Trying to understand get_dofinfo()
« on: 16 / September / 2014, 20:24:11 »
Advertisements
I'm trying to understand how dof readings work on my A4000. Using this script to get the readings before and after a shot,  I get the results below:

Code: [Select]
--[[
@Title Testing DOF
--]]
d={}
props=require("propcase")

print_screen(1)

press("shoot_half")
repeat sleep(50) until get_shooting() == true
d=get_dofinfo()
shoot()
e=get_dofinfo()

for key,value in pairs(d) do print(key,value) end
for key,value in pairs(e) do print(key,value) end

print_screen(-1)

sleep (3000)

Before the shot (d):

hyp_valid true
eff_focal_length 28000
coc 5
aperture 3051
near 925
min_stack_dist 29
dof -1
focal_length 5000
hyp_dist 1644
far -1
focus 2118
focus_valid true


After the shot (e):

hyp_valid true
eff_focal_length 28000
coc 5
aperture 3051
near 660
min_stack_dist 29
dof 2681
focal_length 5000
hyp_dist 1644
far 3341
focus 1103
focus_valid false


Why the changes?
John

Re: Trying to understand get_dofinfo()
« Reply #1 on: 16 / September / 2014, 21:03:09 »
The press("shoot_half" ) makes the camera focus and set the exposure. Typically a script would then issue a press ("shoot_full").   When you chose to use a shoot() instead, you reset the process and the camera set a new focus point and exposure.  Hence the new and slightly different focus values.
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline msl

  • *****
  • 1235
  • A720 IS, SX220 HS 1.01a
    • CHDK inside
Re: Trying to understand get_dofinfo()
« Reply #2 on: 17 / September / 2014, 04:15:20 »
The first result shows all values how they are stored as  default values after turn on the camera. The second result says, the camera has determined a subject distance, but could not find the focus (focus_valid = false).

For a better understanding you can also use the CHDK DOF calculator.

CHDK Settings => OSD Parameters => DOF Calculator => Show DOF calculator

Use the option [Separat+]. This shows all valid results in green after a half press of the shutter.

msl
German CHDK pages:  CHDK forum | CHDK inside | CHDK Twitter News by msl | Download CHDK-DE (Autobuild)
Note: SDM violates the GPL rules!

Re: Trying to understand get_dofinfo()
« Reply #3 on: 17 / September / 2014, 10:13:27 »
The first result shows all values how they are stored as  default values after turn on the camera.
I think there is some confusion here based on how eponymous asked his question.  As I read it,  the first value (d) that he is referring to is initialized AFTER the script does a press("shoot_half") & get_shooting() wait.  So it should have the various focus values set at that point based on what the camera "sees" when the shoot_half goes to the ready state.
Ported :   A1200    SD940   G10    Powershot N    G16


*

Offline eponymous

  • *
  • 38
  • Canon A4000
Re: Trying to understand get_dofinfo()
« Reply #4 on: 17 / September / 2014, 10:14:18 »
OK, thanks for the help.

I changed  the script to:
Code: [Select]
--[[
@Title Testing DOF
--]]
d={}
props=require("propcase")

print_screen(1)

press("shoot_half")
repeat sleep(50) until get_shooting() == true
d=get_dofinfo()
click("shoot_full")
release("shoot_half")
e=get_dofinfo()

for key,value in pairs(d) do print(key,value) end
for key,value in pairs(e) do print(key,value) end

print_screen(-1)

DOF still seems to be flakey though. I set the display to [+Separat] and the camera itself seems to have trouble sometimes, with varying readings of the same scene.

However d should be the settings used for the photo, right?
John

Re: Trying to understand get_dofinfo()
« Reply #5 on: 17 / September / 2014, 10:27:15 »
DOF still seems to be flakey though. I set the display to [+Separat] and the camera itself seems to have trouble sometimes, with varying readings of the same scene.
With the huge DOF of the little Powershot lenses,  the actual focus point for any particular shot (other than extreme closeups) is not very important.  I suspect that Canon makes the focus mechanism to be just "good enough" and thus not very precise when you look at the actual numbers.

Quote
However d should be the settings used for the photo, right?
AFAIK,  the values for d & e should be the same with your revised script.  Is that not the case?
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline eponymous

  • *
  • 38
  • Canon A4000
Re: Trying to understand get_dofinfo()
« Reply #6 on: 17 / September / 2014, 11:25:34 »
However d should be the settings used for the photo, right?
AFAIK,  the values for d & e should be the same with your revised script.  Is that not the case?
Not always. Still testing, but it looks like they're different when the camera doesn't get a good focus. That is, the DOF display is not all green.
John

Re: Trying to understand get_dofinfo()
« Reply #7 on: 17 / September / 2014, 11:28:16 »
Do you have things like continuous autofocus, servo autofocus, and safety autofocus turned off in the Canon menus?
Ported :   A1200    SD940   G10    Powershot N    G16


*

Offline eponymous

  • *
  • 38
  • Canon A4000
Re: Trying to understand get_dofinfo()
« Reply #8 on: 17 / September / 2014, 15:50:31 »
Do you have things like continuous autofocus, servo autofocus, and safety autofocus turned off in the Canon menus?
Ah, that might be it. I had servo AF on. When I turn it off, the two readings are the same.

On the idea that the camera is getting close enough, I note that the dof_info.focus value is definitely too short (as is the sd reported by CHDK's dof). For example, on a regular photo of a blank wall in my house, focus = 845, but the wall is ~1850mm away. Since the DOF is reported as 1175, that's enough to get the wall in focus. The CHDK DOF will also report different focus numbers upon repeated manual half-shoots, where I just put my finger on and off the button, so I don't think this is a very precise thing.

(The focus reading, btw, is always one of the stepped values I posted over in this thread.)
John

 

Related Topics