Does auto focus lock also lock exposure - LUA Scripting - CHDK Forum supplierdeeply

Does auto focus lock also lock exposure

  • 28 Replies
  • 12782 Views
Does auto focus lock also lock exposure
« on: 01 / April / 2017, 08:49:35 »
Advertisements
Hi,

I have a script written by the kind experts here, which enables me to shoot images using Arduino and USB as the sequencer. I am using a Canon Ixus 95 with it, to capture 8mm film frames.

I used to have a Canon Ixus 55, and it worked fine. It now seems to me that when the script starts and does an auto focus lock, it also locks the exposure.

Does this really happen, or am I doing something wrong, as the images are not evenly exposed, but some under and some overexpose.

Is there a way to govern exposure in Lua?

I'll post the Lua code from my laptop soon.

Re: Does auto focus lock also lock exposure
« Reply #1 on: 01 / April / 2017, 09:59:35 »
AF lock does not lock exposure. But you can control exposure with a script.  Without looking at your actual script, it's hard to say anything more about your exposure issues.
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Does auto focus lock also lock exposure
« Reply #2 on: 01 / April / 2017, 10:21:40 »
Here's the code:


--[[
@title Remote AFL V3
@chdk_version 1.3
--]]
shots=0


text_size = 2
xpos2 =  get_gui_screen_width()==480 and 140 or 80   -- shot count
ypos2 =  180
clr1 = 258
clr2 = 259
set_console_layout(0, 1, 48, 6)




sleep(1000)
set_config_value(121,1)      -- make sure USB remote is enabled
set_record(1)                -- switch to shooting mode
sleep(2000)


print("press Func/Set to focus")
print("press Menu to enable shooting")
repeat
 wait_click(10)
 if is_key('set') then       -- reset AFL
   set_aflock(1)
   print("locking focus")
 end
until is_key('menu')
sleep(1000)
print("shooting")
print("press menu to halt")
press('shoot_half')
repeat sleep(10) until get_shooting()
    repeat
    wait_click(10)
    if is_key('remote') then 
        press("shoot_full_only")
        repeat sleep(50) until(get_exp_count()~=ecnt)
        release("shoot_full_only")
        shots=shots+1
    end
    string2 = "shots:"..shots
    draw_string(xpos2, ypos2,string2, clr1, clr2, text_size)     
until is_key('menu')
release('shoot_half')
sleep(500)
set_aflock(0)
set_config_value(121,0)      -- make sure USB remote is enabled


There are two issues.


  • I would like to have it do a check for exposure before actually shooting
  • the current frame counter here counts many multiples during one frame shoot, sometimes as many as eight per frame. In the old version with Ixus 55, it counted just one frame per actual trigger of the switch to Arduino, but with the 95, the counter goes haywire.
So maybe there is something in the code that is actually dependent on the type of the camera, but I can't find it.


Waterwingz, many thanks again, you're a rock star!

*

Offline reyalp

  • ******
  • 14082
Re: Does auto focus lock also lock exposure
« Reply #3 on: 01 / April / 2017, 15:41:02 »
I used to have a Canon Ixus 55, and it worked fine. It now seems to me that when the script starts and does an auto focus lock, it also locks the exposure.
AF Lock shouldn't lock exposure, but exposure normally only updated on half shoot. Since your script holds down half shoot and repeatedly clicks full only, exposure will be the same for every shot. I would be very surprised if this wasn't true on the ixus55 as well, though it's a very old camera so it's possible there is some difference.

Quote
the current frame counter here counts many multiples during one frame shoot,
If you mean that get_exp_count() increases by more than when for a single shot, this is probably a bug in the port.
Don't forget what the H stands for.


Re: Does auto focus lock also lock exposure
« Reply #4 on: 02 / April / 2017, 02:43:36 »
Yes, this is the case - the counter updates in a burst and gets to a thousand frames when Arduino has counted only 100. The counter is not vital, so let's not worry about that.

The 55 had no issues with exposure, I just started the script and it took 2000 frames with good exposure and colors (then the SD was full).

The new one takes up to 12 000 images at the rate of five images in three seconds, almost double the old one, but when the scene changes in the 8mm film, the images are grabbed with the same exposure as the first scene, resulting in over or underexposure.

So, is it possible to change the script to do a full shoot every time? I can slow down the Arduino, speed is not important here, but if that would fix the exposure, I'd be very happy.


Re: Does auto focus lock also lock exposure
« Reply #5 on: 02 / April / 2017, 06:52:17 »
IIRC, your original script was written to shoot as quickly as possible with the focus and exposure locked. This was done using the "trick" that is causing the exposure count problem on your newer camera.  If you are now okay with somewhat slower shooting, locked focus,and no exposure lock then you really only need a very simple script. I'll see what i can dig up - I'm traveling now so it might be a couple of days.
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Does auto focus lock also lock exposure
« Reply #6 on: 02 / April / 2017, 08:04:47 »
You're right, it was just the way then. Now I have 3D printed a new lens holder, and a 16GB memory card works fine.

There's no rush, I just broke my Arduino, so at your convenience will be just fine.

*

Offline reyalp

  • ******
  • 14082
Re: Does auto focus lock also lock exposure
« Reply #7 on: 02 / April / 2017, 15:03:02 »
The 55 had no issues with exposure, I just started the script and it took 2000 frames with good exposure and colors (then the SD was full).
I don't understand this. If half press is held down, exposure should not change between shots. AFAIK this is true on every CHDK supported camera.

I understand the script was "working" on your old camera, but since it appears to be doing something impossible it might be a good idea to figure out what is actually happening. Is the ixus55 really running the same script? Is the shutter speed (or ISO) actually changing? What are the CHDK remote settings?

Quote
Yes, this is the case - the counter updates in a burst and gets to a thousand frames when Arduino has counted only 100. The counter is not vital, so let's not worry about that.
Looking at the script, the version you posted has a bug: "ecnt" is never set. That explains the wildly incrementing counter, because the if is always true, but suggests your cameras aren't running the same script.

The inner code should probably be something like
Code: [Select]
    if is_key('remote') then
        ecnt = get_exp_count()
        press("shoot_full_only")
        repeat sleep(50) until(get_exp_count()~=ecnt)
        release("shoot_full_only")
        shots=shots+1
    end
This would affect the rest of the script behavior significantly.
Don't forget what the H stands for.


Re: Does auto focus lock also lock exposure
« Reply #8 on: 03 / April / 2017, 06:06:29 »
Okay, here are the two files as used in 55 & 95:



--[[
@title Remote AFL V3
@chdk_version 1.3
--]]
shots=0


text_size = 2
xpos2 =  get_gui_screen_width()==480 and 140 or 80   -- shot count
ypos2 =  180
clr1 = 258
clr2 = 259
set_console_layout(0, 1, 48, 6)




sleep(1000)
set_config_value(121,1)      -- make sure USB remote is enabled
set_record(1)                -- switch to shooting mode
sleep(2000)


print("press Func/Set to focus")
print("press Menu to enable shooting")
repeat
 wait_click(10)
 if is_key('set') then       -- reset AFL
   set_aflock(1)
   print("locking focus")
 end
until is_key('menu')
sleep(1000)
print("shooting")
print("press menu to halt")
press('shoot_half')
repeat sleep(10) until get_shooting()
    repeat
    wait_click(10)
    if is_key('remote') then 
        press("shoot_full_only")
        repeat sleep(50) until(get_exp_count()~=ecnt)
        release("shoot_full_only")
        shots=shots+1
    end
    string2 = "shots:"..shots
    draw_string(xpos2, ypos2,string2, clr1, clr2, text_size)     
until is_key('menu')
release('shoot_half')
sleep(500)
set_aflock(0)
set_config_value(121,0)      -- make sure USB remote is enabled




And then the one from the 95:





--[[
@title Remote AFL V3
@chdk_version 1.3
--]]
shots=0


text_size = 2
xpos2 =  get_gui_screen_width()==480 and 140 or 80   -- shot count
ypos2 =  180
clr1 = 258
clr2 = 259
set_console_layout(0, 1, 48, 6)




sleep(1000)
set_config_value(121,1)      -- make sure USB remote is enabled
set_record(1)                -- switch to shooting mode
sleep(2000)


print("press Func/Set to focus")
print("press Menu to enable shooting")
repeat
 wait_click(10)
 if is_key('set') then       -- reset AFL
   set_aflock(1)
   print("locking focus")
 end
until is_key('menu')
sleep(1000)
print("shooting")
print("press menu to halt")
press('shoot_half')
repeat sleep(10) until get_shooting()
    repeat
    wait_click(10)
    if is_key('remote') then 
        press("shoot_full_only")
        repeat sleep(50) until(get_exp_count()~=ecnt)
        release("shoot_full_only")
        shots=shots+1
    end
    string2 = "shots:"..shots
    draw_string(xpos2, ypos2,string2, clr1, clr2, text_size)     
until is_key('menu')
release('shoot_half')
sleep(500)
set_aflock(0)
set_config_value(121,0)      -- make sure USB remote is enabled

*

Offline reyalp

  • ******
  • 14082
Re: Does auto focus lock also lock exposure
« Reply #9 on: 03 / April / 2017, 13:07:07 »
Okay, here are the two files as used in 55 & 95:
What you posted is identical, but it's really very unlikely (basically impossible, IMO) that the ixus 55 adjusts exposure while half press is held. So we have a mystery...

Both have the bug in the get_exp_count() logic, which makes that entire line just a sleep(50).

Did you compare the remote settings page on each camera?

FWIW, when posting scripts, you can use the attachment option on the forum.
Don't forget what the H stands for.

 

Related Topics