Need help in Zoom Burst script (Zoom during Exposure) - Script Writing - CHDK Forum  

Need help in Zoom Burst script (Zoom during Exposure)

  • 10 Replies
  • 3277 Views
Need help in Zoom Burst script (Zoom during Exposure)
« on: 25 / July / 2012, 16:57:11 »
Advertisements
I am trying to use the Zoom Burst script (see below) from an older thread.
I am running the script on Ixus 115 HS.

I am having a difficulty which I'm unable to solve.
The zoom level starts changing before the camera opens the shutter (starts the exposure).
It first focuses and then opens the shutter.
By this way only a little change in zoom in felt by the sensor. Hence the zoom burst effect isn't 'effective'.

I suppose, after the press("shoot_half") till until get_shooting() == true camera should wait and should shoot only when it's ready to open the shutter.
But it's kind of not happenning.

Please Help!

You'll have to get into script writing a bit to actually do the kind of shot you desire. But below is a quick example script that demonstrates a way to do it. It first zooms to wide angle, then starts taking a photo and after 100ms of exposure it starts zooming to full tele.

I tried it with Tv mode about 1,5 s exposure and it appears to work.

Code: (Lua) [Select]
--[[
Test zooming during long exposure.

1) Set camera to shoot a very long exposure (either M or Tv mode or
CHDK Tv override).

2) run the script
--]]

max_zoom = get_zoom_steps() - 1

if get_zoom() ~= 0 then
  set_zoom(0)
  sleep(5000)
end

press("shoot_half")
repeat
  sleep(1)
until get_shooting() == true
press("shoot_full")
sleep(100)
set_zoom(max_zoom)

repeat
  sleep(1)
until get_shooting() ~= true

release("shoot_full")
release("shoot_half")

Ixus 115 HS / firmware 1.01c

Re: Need help in Zoom Burst script (Zoom during Exposure)
« Reply #1 on: 25 / July / 2012, 18:59:28 »
That script assumes you have setup the camera to take a long exposure ( or  "B"ulb or "M"anual) exposure using the Canon setup menus.   

Its possible to do the same thing in the script but you will have to add some code to do so.

Ported :   A1200    SD940   G10    Powershot N    G16

Re: Need help in Zoom Burst script (Zoom during Exposure)
« Reply #2 on: 26 / July / 2012, 09:55:58 »
That script assumes you have setup the camera to take a long exposure ( or  "B"ulb or "M"anual) exposure using the Canon setup menus.

I had already set the exposure to 5s using CHDK override.

But this is what happens
Time (sec.)||Zooming?||Exposure?||
1YesNo
2YesNo
3YesYes
4NoYes
5NoYes
Ixus 115 HS / firmware 1.01c

*

Offline msl

  • *****
  • 1263
  • A720 IS, SX220 HS 1.01a
    • CHDK-DE links
Re: Need help in Zoom Burst script (Zoom during Exposure)
« Reply #3 on: 26 / July / 2012, 16:31:33 »
This script is difficult to control. It cannot be guaranteed that the script always works.

Measure the zoom time. That's the basis for the exposure time. Choose the exposure time not too short, e.g. zoom time is 2.2 s, choose not 2.5 s but 3.2 s.

Play also with the time in line 22.

msl
CHDK-DE:  CHDK-DE links


Re: Need help in Zoom Burst script (Zoom during Exposure)
« Reply #4 on: 26 / July / 2012, 18:47:29 »
Measure the zoom time. That's the basis for the exposure time. Choose the exposure time not too short, e.g. zoom time is 2.2 s, choose not 2.5 s but 3.2 s.
msl
Yes, I tried it from 0.5 s to 10 s, but not much difference. The problem persists. Zoom is too fast and shutter lags behind it. I'm going to try set_zoom_speed. let's see what happens.

Play also with the time in line 22.
Thanks for the idea msl! I'll try this. :)
Ixus 115 HS / firmware 1.01c

*

Online philmoz

  • *****
  • 3136
    • Photos
Re: Need help in Zoom Burst script (Zoom during Exposure)
« Reply #5 on: 26 / July / 2012, 19:06:07 »
Measure the zoom time. That's the basis for the exposure time. Choose the exposure time not too short, e.g. zoom time is 2.2 s, choose not 2.5 s but 3.2 s.
msl
Yes, I tried it from 0.5 s to 10 s, but not much difference. The problem persists. Zoom is too fast and shutter lags behind it. I'm going to try set_zoom_speed. let's see what happens.

The IXUS 115 has only 10 positions of the zoom stepper motor and a fairly short zoom range so it's not surprising that it can go from one end of the zoom range to the other quickly.

You could try a loop from 1 to max_zoom instead of lines 22 & 23 - you can then vary the sleep delay in the loop for each step and also the loop increment amount to control the zoom timing. If you make these parameters to the script then you can play with the values without constantly editing the script.

Phil.
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)

*

Offline msl

  • *****
  • 1263
  • A720 IS, SX220 HS 1.01a
    • CHDK-DE links
Re: Need help in Zoom Burst script (Zoom during Exposure)
« Reply #6 on: 27 / July / 2012, 07:18:20 »
I've updated an older script based on fudgey's zoom shoot script. You can measure the zoom time and set the exposure time via script. Play with the parameter 'wait shoot'. This is the wait time in 1/10 s between start shutter and zoom.  I think, this is dependent of the camera.

The script works fine for me, tested with the A720 (7 zoom steps).

I think however that this script is not suitable for super-zoom cameras!!!

Code: (lua) [Select]
--[[
@title Z-Shoot
@param a wait shoot x 0,1 s
@default a 1
@param b zoom time x 1 s
@default b 5
]]

function get_zoom_time()
    local time1 = get_tick_count()
    set_zoom(max_zoom)
    local time2 = get_tick_count() - time1 + 250
    set_zoom(0)
    return time2
end

function zoom_shoot(tv)
    set_tv96_direct(tv)
    press("shoot_half")
    repeat sleep(10) until get_shooting() == true
    press("shoot_full")
    sleep(wait)
    set_zoom(max_zoom)
    release("shoot_full")
    release("shoot_half")
    repeat sleep(10) until get_shooting() ~= true
    set_zoom(0)
end

function print_tv(nn)
    local tv_output = {"64","50","40","32","25","20","15","13","10","8","6","5","4",
    "3.2","2.5","2","1.6","1.3","1.0","0.8","0.6","0.5","0.4","0.3","1/4","1/5",
    "1/6","1/8","1/10","1/13","1/15","1/20","1/25","1/30","1/40","1/50","1/60",
    "1/80","1/100","1/125","1/160","1/200","1/250","1/320","1/400","1/500",
    "1/640","1/800","1/1000","1/1250","1/1600","1/2000","1/2500","1/3200",
    "1/4000","1/5000","1/6400","1/8000","1/10000"}
    if (nn +19) > table.getn(tv_output) or (nn +19) < 1 then
        return "n/a"
    else
        return tv_output[nn +19]
    end
end

function restore()
    cls()
    set_zoom(0)
    set_console_autoredraw(1)
end

if a < 1 then a = 1 end
wait = a*100
if b < 1 then b = 1 end
zoom_time = b*1000
finish = 0
tv = -160/32
max_zoom = get_zoom_steps()-1
set_console_autoredraw(0)

if get_mode() == true then
    if get_zoom() ~= 0 then
        set_zoom(0)
        sleep(zoom_time)
    end
    repeat
        cls()
        print("[\26]        get zoom time")
        print("zoom time:",zoom_time,"ms")
        print("[SET]      zoom shoot")
        print("[\18]       ", print_tv(tv))
        print("[MENU]     end")
        console_redraw()
        wait_click(0)
        if is_pressed("right") then
            zoom_time = get_zoom_time()
        elseif is_pressed("set")  then
            zoom_shoot(tv * 32)
        elseif is_pressed("up") then
            tv = tv - 1
        elseif is_pressed("down") then
            tv = tv + 1
        elseif is_pressed("menu") then
            finish = 1
        end
    until finish == 1
else
    print("no record mode")
    sleep(2000)
end

restore()

msl
CHDK-DE:  CHDK-DE links

Re: Need help in Zoom Burst script (Zoom during Exposure)
« Reply #7 on: 28 / July / 2012, 16:04:57 »
I've updated an older script based on fudgey's zoom shoot script. You can measure the zoom time and set the exposure time via script. Play with the parameter 'wait shoot'. This is the wait time in 1/10 s between start shutter and zoom.  I think, this is dependent of the camera.

The script works fine for me, tested with the A720 (7 zoom steps).

I think however that this script is not suitable for super-zoom cameras!!!

Code: (lua) [Select]
--[[
@title Z-Shoot
@param a wait shoot x 0,1 s
@default a 1
@param b zoom time x 1 s
@default b 5
]]

function get_zoom_time()
    local time1 = get_tick_count()
    set_zoom(max_zoom)
    local time2 = get_tick_count() - time1 + 250
    set_zoom(0)
    return time2
end

function zoom_shoot(tv)
    set_tv96_direct(tv)
    press("shoot_half")
    repeat sleep(10) until get_shooting() == true
    press("shoot_full")
    sleep(wait)
    set_zoom(max_zoom)
    release("shoot_full")
    release("shoot_half")
    repeat sleep(10) until get_shooting() ~= true
    set_zoom(0)
end

function print_tv(nn)
    local tv_output = {"64","50","40","32","25","20","15","13","10","8","6","5","4",
    "3.2","2.5","2","1.6","1.3","1.0","0.8","0.6","0.5","0.4","0.3","1/4","1/5",
    "1/6","1/8","1/10","1/13","1/15","1/20","1/25","1/30","1/40","1/50","1/60",
    "1/80","1/100","1/125","1/160","1/200","1/250","1/320","1/400","1/500",
    "1/640","1/800","1/1000","1/1250","1/1600","1/2000","1/2500","1/3200",
    "1/4000","1/5000","1/6400","1/8000","1/10000"}
    if (nn +19) > table.getn(tv_output) or (nn +19) < 1 then
        return "n/a"
    else
        return tv_output[nn +19]
    end
end

function restore()
    cls()
    set_zoom(0)
    set_console_autoredraw(1)
end

if a < 1 then a = 1 end
wait = a*100
if b < 1 then b = 1 end
zoom_time = b*1000
finish = 0
tv = -160/32
max_zoom = get_zoom_steps()-1
set_console_autoredraw(0)

if get_mode() == true then
    if get_zoom() ~= 0 then
        set_zoom(0)
        sleep(zoom_time)
    end
    repeat
        cls()
        print("[\26]        get zoom time")
        print("zoom time:",zoom_time,"ms")
        print("[SET]      zoom shoot")
        print("[\18]       ", print_tv(tv))
        print("[MENU]     end")
        console_redraw()
        wait_click(0)
        if is_pressed("right") then
            zoom_time = get_zoom_time()
        elseif is_pressed("set")  then
            zoom_shoot(tv * 32)
        elseif is_pressed("up") then
            tv = tv - 1
        elseif is_pressed("down") then
            tv = tv + 1
        elseif is_pressed("menu") then
            finish = 1
        end
    until finish == 1
else
    print("no record mode")
    sleep(2000)
end

restore()

msl

Thanks msl!
but I got error while running the script. Please tell me how to solve that? :(



Ixus 115 HS / firmware 1.01c


Re: Need help in Zoom Burst script (Zoom during Exposure)
« Reply #8 on: 28 / July / 2012, 16:15:33 »
The IXUS 115 has only 10 positions of the zoom stepper motor and a fairly short zoom range so it's not surprising that it can go from one end of the zoom range to the other quickly.

You could try a loop from 1 to max_zoom instead of lines 22 & 23 - you can then vary the sleep delay in the loop for each step and also the loop increment amount to control the zoom timing. If you make these parameters to the script then you can play with the values without constantly editing the script.

Phil.

Thanks Phil! I will try that.

Now the status is:
I am using zoom out script by changing the initial and final zoom position in the original script.
My problem was that the photos were overexposed. I had kept flash on.
I thought that I had actually found the solution to the problem. So I turned off the flash, and got into  a new problem. When flash was on, the shutter speed override was working correctly; but after turning off the flash, the shutter takes forever! No matter what shutter speed have you set, the shutter either takes 15-20 seconds or the camera freezes and I have to remove the battery.
Is that a bug?
What's really happening here? :'(
Ixus 115 HS / firmware 1.01c

*

Offline msl

  • *****
  • 1263
  • A720 IS, SX220 HS 1.01a
    • CHDK-DE links
Re: Need help in Zoom Burst script (Zoom during Exposure)
« Reply #9 on: 29 / July / 2012, 07:02:26 »
but I got error while running the script. Please tell me how to solve that? :(

Your description is not very helpful. What error? Got you an error message?

Btw, you can edit and shorten long quotes. It's a pain to read everything twice. ;)

msl
CHDK-DE:  CHDK-DE links

 

Related Topics