supplierdeeply

Time lapse with focus change

  • 10 Replies
  • 828 Views
Time lapse with focus change
« on: 18 / December / 2017, 05:23:56 »
Advertisements
Interesting time lapse in which the focus is changed from near to infinitely continuously (1:05, 1:40). The focus change was made in this video per hand.



Are there any scripts that do that?
Is it possible to change focus in continuous mode or in half press?

*

Offline reyalp

  • ******
  • 11513
Re: Time lapse with focus change
« Reply #1 on: 18 / December / 2017, 16:02:04 »
Are there any scripts that do that?
Is it possible to change focus in continuous mode or in half press?
IIRC (caveat: it was several years ago and I don't see anything in my notes), I tried changing focus and zoom in the hook_shoot where rawopint and fixedint wait between shots and it worked.

However, the camera would not normally expect focus to change at this point. I would rate this as fairly high up on the list of potentially hardware-damaging things you can do with CHDK, so I'd suggest experimenting on a camera you wouldn't feel too bad about losing.

Camera specific variation in focus override behavior should also be expected. Particularly, I would expect a better chance of success in MF or AF lock, even if the camera is normally able to override in AF.

Don't forget what the H stands for.

Re: Time lapse with focus change
« Reply #2 on: 21 / December / 2017, 04:48:03 »
However, the camera would not normally expect focus to change at this point.

Most cameras have a continuous mode where they do auto focus…

I would rate this as fairly high up on the list of potentially hardware-damaging things you can do with CHDK, so I'd suggest experimenting on a camera you wouldn't feel too bad about losing.
Yes of course…
But if I use my IXUS and it works, I can’t be sure that my G1x get damaged…


Camera specific variation in focus override behavior should also be expected. Particularly, I would expect a better chance of success in MF or AF lock, even if the camera is normally able to override in AF.
How can I test?
I would go into CHDKPTP:
Code: [Select]
=press("shoot_half")
After autofocus
Code: [Select]
=set_aflock(0) or =set_mf(0)
And then see if focus changes with
Code: [Select]
set_focus(nnn)

If I want to change the focus from 0.5m to 100m in 100 steps. How should the focus change? Probably not linear or?

*

Offline reyalp

  • ******
  • 11513
Re: Time lapse with focus change
« Reply #3 on: 21 / December / 2017, 16:11:43 »
However, the camera would not normally expect focus to change at this point.

Most cameras have a continuous mode where they do auto focus…
Only the higher end cameras, but even in that case, they probably don't do it at the same where the hook is.

OTOH, thinking about this more, CHDK has had focus bracketing long time. This is done in the raw hook, so doing the same in a script should be no riskier. I don't know how widely CHDK focus bracketing has been used.
Quote
But if I use my IXUS and it works, I can’t be sure that my G1x get damaged…
Of course, you can't be sure. But if it kills a cheap camera, I probably wouldn't try it on an expensive one...

Quote
How can I test?
I would go into CHDKPTP:
...
Normally, you should use set_mf or set_aflock before half press (a few cameras may require set_aflock() be inside half press). Since scripted key presses are reset between = calls, you have to do everything with half shoot held in one command, something like (untested off the top of my head)
Code: [Select]
=set_mf(true) press'shoot_half' repeat sleep(10) until get_shooting() local sd=500 while sd < 100000 do set_focus(sd) click'shoot_full_only' sd=sd*2 sleep(2000) end
Note that this would approximate the "quick" method, for cont mode you'd have to set up the raw hook and do it there.

Quote
If I want to change the focus from 0.5m to 100m in 100 steps. How should the focus change?
Not sure off hand. I'd probably just try linear e.g. sd_next = 1.05*sd and see if it look OK.
Don't forget what the H stands for.


Re: Time lapse with focus change
« Reply #4 on: 22 / December / 2017, 11:10:59 »
Note that this would approximate the "quick" method, for cont mode you'd have to set up the raw hook and do it there.
Yes of course, "quick" method is OK.

Code: [Select]
=set_mf(true) press'shoot_half' repeat sleep(10) until get_shooting() local sd=500 while sd < 100000 do set_focus(sd) click'shoot_full_only' sd=sd*2 sleep(2000) end

I’m missing a release’shoot_half’ on the end. Is this a problem?

My S110 crashes immediately after running without any noise

Code: [Select]
ASSERT!! FocusLensController.c Line 1059

The IXUS160 runs, but the effect is very small. Maybe it’s the depth of field of the small sensor. What about set_mf on the IXUS160? The IXUS160 has no MF Focus Mode.

I don't know how widely CHDK focus bracketing has been used.

I have looked at some focus bracketing scripts. The most do set_focus before a full shoot.

 

*

Offline reyalp

  • ******
  • 11513
Re: Time lapse with focus change
« Reply #5 on: 22 / December / 2017, 13:18:49 »
I’m missing a release’shoot_half’ on the end. Is this a problem?
No. CHDK script keys are released when the script ends. Each = command in chdkptp is a separate script, so all the keys are released when it ends. That's why you have to put everything in one = command.

Quote
My S110 crashes immediately after running without any noise

Code: [Select]
ASSERT!! FocusLensController.c Line 1059
Make sure things like continuous AF and servo AF are disabled in the Canon menu. You could also try moving the set_focus so the first is set before the first shot, and the rest are set after, like

Code: [Select]
=set_mf(true) local sd=500 set_focus(sd) press'shoot_half' repeat sleep(10) until get_shooting()  while sd < 100000 do  click'shoot_full_only' sd=sd*2 sleep(2000) set_focus(sd) end

Quote
The IXUS160 runs, but the effect is very small. Maybe it’s the depth of field of the small sensor. What about set_mf on the IXUS160? The IXUS160 has no MF Focus Mode.
set_mf works on some cameras that don't have MF in the canon UI. According to this https://chdk.setepontos.com/index.php?topic=11078.msg135482#msg135482 ixus160 should be one of them.

Quote
I don't know how widely CHDK focus bracketing has been used.

I have looked at some focus bracketing scripts. The most do set_focus before a full shoot.
CHDK has a subject distance option in the built in "bracketing in continuous mode".
Don't forget what the H stands for.

Re: Time lapse with focus change
« Reply #6 on: 22 / December / 2017, 14:26:16 »
Make sure things like continuous AF and servo AF are disabled in the Canon menu.
Yes of course. Everything think is switched of. Also, Safety shift.

You could also try moving the set_focus so the first is set before the first shot, and the rest are set after, like
The difference is, that the S110 made now one shoot and crashes than. Also, when I set the cam in MF on Canon menu the cam crashes.

If I set the cam in MF on Canon menu and do the following commands in chdkptp
Code: [Select]
=set_focus(500)
=set_focus(500000)
Then I see how the focus changes in Liveview. If I do a shoot in chdkptp than the cam crashes sometimes as well (1 from 10 shoots).



*

Offline reyalp

  • ******
  • 11513
Re: Time lapse with focus change
« Reply #7 on: 22 / December / 2017, 16:01:27 »
Then I see how the focus changes in Liveview. If I do a shoot in chdkptp than the cam crashes sometimes as well (1 from 10 shoots).
To be clear, it crashes if you
1) set mf in canon
2) Use set_focus, outside of shooting
3) shoot several times?

Or is the crash only with the test code that uses set_focus() in half press?

You can try set_aflock() instead of set_mf(). I suspect it will be the same, but some cameras have different behavior in af lock vs MF.
Don't forget what the H stands for.


Re: Time lapse with focus change
« Reply #8 on: 23 / December / 2017, 02:48:47 »
To be clear, it crashes if you
1) set mf in canon
2) Use set_focus, outside of shooting
3) shoot several times?
Yes, that is what I did yesterday and it sometimes crashes..
I can’t reproduce it today. May be a combination of what I did before???

Or is the crash only with the test code that uses set_focus() in half press?
This crashes every time.

You can try set_aflock() instead of set_mf().
I tried it before and after half press. The camera didn’t crashes but the focus didn’t changes.

Update:
G1x works with half press...
« Last Edit: 23 / December / 2017, 04:34:00 by c_joerg »

Re: Time lapse with focus change
« Reply #9 on: 23 / December / 2017, 08:31:04 »
I made a small test script and it work very well on G1x. The weather is really bad so I have to made a test inside.
Not sure off hand. I'd probably just try linear e.g. sd_next = 1.05*sd and see if it look OK.
Good point to start with. But even 1.05*sd is a little bit to fast in near field.
Where would the right place be in rawopint for set_focus(sd)?



 

Related Topics