supplierdeeply

Setting focus from scripts or menus

  • 555 Replies
  • 74840 Views
*

Offline Sdack

  • ***
  • 191
Re: Setting focus from scripts or menus
« Reply #550 on: 29 / November / 2017, 19:05:31 »
Advertisements
set_prop.AF_LOCK(1)
The function is set_aflock(1)
From the script output, it looks like set_mf(1) should also work.

I realized that set_mf(1) does in fact work for my IXUS160 cause it's in my script.

However I went ahead with the test you suggest below:

Quote
You can test this by aiming the camera at a subject it doesn't have trouble focusing on, and then using set_focus() to set the opposite extreme. So if your test object is nearby, you could do something like the following in chdkptp

=set_focus(50000) shoot()

and the resulting image should be badly out of focus if SD override worked, or in focus if it didn't.
And my resulting image was sharp on an object less than a meter away, so I hope that is useful
information

Here's my results from a get_dofinfo() command

Code: [Select]
con 1> =return get_dofinfo()
2:return:table:{hyp_valid=false,eff_focal_length=28000,coc=5,aperture=3268,near=-1,min_stack_dist=28,dof=-1,focal_length=5000,hyp_dist=1535,far=-1,focus=-1,focus_valid=false,}


I am wondering what hyp_valid=false might mean?  Every camera has a hyperfocal distance, right?

I'm simply looking for the command to set my focal length at it's hyperfocal distance, for maximum depth of field.

Any suggetions welcome
Sdack
« Last Edit: 29 / November / 2017, 19:49:27 by Sdack »

Re: Setting focus from scripts or menus
« Reply #551 on: 29 / November / 2017, 22:26:08 »
And my resulting image was sharp on an object less than a meter away,
Repeat the test but use this command string instead :
Code: [Select]
=set_mf(1) set_focus(2000) shoot()
Quote from: Sdack link=topic=11078.msg135482#msg13548
I'm simply looking for the command to set my focal length at it's hyperfocal distance, for maximum depth of field.
Assuming you can put your camera into a mode where CHDK SD override works correctly, (i.e. call set_mf(1) first) then use :
Code: [Select]
set_focus(get_dofinfo().hyp_dist)

Incidentally, I reverted your recent wiki edit that said
Quote
or maybe try
=return get_dofinfo()
chdkptp command syntax does not belong on a page that describes scripting functions.
« Last Edit: 29 / November / 2017, 22:36:34 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline Sdack

  • ***
  • 191
Re: Setting focus from scripts or menus
« Reply #552 on: 29 / November / 2017, 23:59:05 »
And my resulting image was sharp on an object less than a meter away,
Repeat the test but use this command string instead :
Code: [Select]
=set_mf(1) set_focus(2000) shoot()
Quote from: Sdack link=topic=11078.msg135482#msg13548
I'm simply looking for the command to set my focal length at it's hyperfocal distance, for maximum depth of field.
Assuming you can put your camera into a mode where CHDK SD override works correctly, (i.e. call set_mf(1) first) then use :
Code: [Select]
set_focus(get_dofinfo().hyp_dist)

Hi, using the full command sequence now ie.
=set_mf(1)
=set_focus(XXX)
=shoot()

I shot several focal lengths, from 300mm to 10,000mm, plus the hyperfocal formula you suggested above.  The 300mm version was very clearly blurry for distant objects but it seems there's no visible difference, over 3000mm.  I guess that's just the normal state of the Canon lens on this model.

Quote
Incidentally, I reverted your recent wiki edit that said
Quote
or maybe try
=return get_dofinfo()
chdkptp command syntax does not belong on a page that describes scripting functions.

Thanks for that.  I was trying to be helpful but I'm obviously not up to speed yet.
Sdack

*

Offline reyalp

  • ******
  • 11583
Re: Setting focus from scripts or menus
« Reply #553 on: 30 / November / 2017, 01:47:43 »
Hi, using the full command sequence now ie.
=set_mf(1)
=set_focus(XXX)
=shoot()
A general warning: If you are setting overrides in chdkptp, you should do it all in one command, like
=set_mf(1)  set_focus(XXX) shoot()

because many overrides only take effect for the duration of a script. Your example should be OK because focus stays at whatever you set it to after set_mf(), but for cameras that allow focus override in AF mode, this would not work. Exposure overrides will also be ignored if they are a separate command from the shoot.

Quote
I am wondering what hyp_valid=false might mean?  Every camera has a hyperfocal distance, right?
Yes, every camera should have a hyperfocal distance, but it depends on the zoom and aperture.
I'm not sure what the intent of that value is, it seems depend on whether the camera focused successfully (which should be irrelevant to the hyperfocal distance) and whether the camera is ready in half press, which may be required to correctly get the aperture.

To get the values in half press in chdkptp, you can do something like

=press'shoot_half' repeat sleep(10) until get_shooting() return get_dofinfo()
Don't forget what the H stands for.


*

Offline reyalp

  • ******
  • 11583
Re: Setting focus from scripts or menus
« Reply #554 on: 22 / April / 2018, 17:48:59 »
A random observation:
On sx160, attempting to use set_mf to turn  MF on or off while the camera is in display + sensor off power saving mode crashes
Code: [Select]
ASSERT!! Imager.c Line 1001
Occured Time  2018:04:22 13:41:38
Task ID: 28246079
Task name: WBIntegTask
This isn't really surprising.

It would be nice if there was a way to detect when the camera was in this state though.
Don't forget what the H stands for.

*

Offline srsa_4c

  • ******
  • 3725
Re: Setting focus from scripts or menus
« Reply #555 on: 24 / April / 2018, 14:43:02 »
It would be nice if there was a way to detect when the camera was in this state though.
The fw variable directly involved in this assert (0x20a4+4) would be a first candidate. I located the equivalent on one of my cameras and found that it is set to 1 when the sensor is active and 0 otherwise (sleep or playback mode *). Entering the rec menu did not affect the variable though, so maybe it's not the best choice. Perhaps some of the other imager related variables could work better...?

edit:
* also 0 in recreview (and recreview hold)
« Last Edit: 24 / April / 2018, 14:58:37 by srsa_4c »

 

Related Topics