Wikia

CHDK Wiki

UBASIC/Scripts: an ultra fast HDR bracketing script for A6xx

Talk10
577pages on
this wiki

< UBASIC

HDR_bracketing Edit

For A640Edit

Written for/on: A640
Also works on: A6xx and probably all digicII
Required CHDK build: Fingalo's special buid v106 and later (set_prop, get_prop needed)

You MUST use Fingalo's CHDK build available here. These scripts do NOT work with current "Autobuild" 0.9.9. If you know a newer version please post it.

Documentation/Help (save as a small "HDR_bracketing.txt" file to your /CHDK/SCRIPTS/ folder)


The user can either select P, AV or Tv mode and the script does the job : a set of exposure bracketed pictures is captured in a very very fast way !

parameters are :

a : EV distance between two shots expressed in 1/3 step (eg. a=3 will do 1 full step)
b : the scripts takes 2b+1 pictures : b underexposed ones, 1 correctly exposed, b overexposed

with the defaults values, a=3, b=2, you get 5 pictures (-2, -1, 0, +1, +2)

To be really fast the script does the following :

- switch to NO FLASH
- try to focus
- switch to MF
- takes the 5 pictures using EV corrections with the "properties" rather than with button presses ...
- resets the camera to its original state (flash, EV ...)

Script Code (save as "HDR_bracketing.bas" to your /CHDK/SCRIPTS/ folder)


rem Author ~Aeropic~
rem For A6xx cameras
rem May work on others digicII
rem See documentation

@title HDR bracketing
@param a delta en 1/3
@default a 3
@param b (nb images-1)/2
@default b 2

rem test input consistency
if b<1 then b=1 
if a<1 then a=1
if a>6 then a=6
if b >6 then b = 6

rem get the dial mode 
rem if <> P, Tv, Av exit
get_prop 0 i
if i = -32764 then goto "ok"
if i = -32765 then goto "ok"
if i = -32766 then goto "ok"
print "P, Tv ou Av ..."
goto "lend"

:ok
rem test if flash set
get_prop 16 f
if f = 2 then goto "ok2"
print "flash OFF ..."
set_prop 16 2

:ok2
rem get Exp compensation value
get_prop 25 i

rem  nb steps diaph computation
a=a*32

rem start EV computation
s=i-b*a 
b=b*2 

:ok3
rem try to focus
press "shoot_half"

rem wait for focus (prop 67)
p = 0
do
 p = p +1
 get_prop 67 j
 if p = 100 then 
   print "focus impossible"
   release "shoot_half"
   goto "ok3"
 endif
until j = 1

rem switch to manual focus
sleep 500
click "down"
sleep 500
release "shoot_half"
sleep 300

rem data take loop based on prop 205
rem initial set of 25 & 26 for the first shot
set_prop 25 s
set_prop 26 s
for n=0 to b
 click "shoot_full"
 do
  get_prop 205 w
 until w=1
 s=s+a
 set_prop 25 s
 set_prop 26 s
 do
  get_prop 205 w
 until w<>1 
next n 

rem switch back to auto focus
sleep 1000
click "down"

rem reset initial values for EV and flash
set_prop 25 i
set_prop 26 i
set_prop 16 f
sleep 300
:lend
end

--82.252.222.198


For A610Edit

Written for/on: A610
Also works on: A6xx and probably all digicII
Required CHDK build: Fingalo's special buid v106 and later (set_prop, get_prop needed)

I adapted this script to work with PS A610 and added some new features

1. A new parameter, c, allow to do repetitions of shoot, it means that if c=2, 2 shoots at each exposure will be made, it can be helpful to remove moving objects, or reduce noise.
2. The program detects if already made a manual focus, and will keep it
3. When the focus is impossible in normal focus mode, it will switch automatically to macro mode to try again, and vice versa.
4. At the end, the initial focus mode are recovered

All other features are the same as in the initial version of the program

Documentation/Help (save as a small "HDR_bracketing.txt" file to your /CHDK/SCRIPTS/ folder)


The user can either select P, AV or Tv mode and the script does the job : a set of exposure bracketed pictures is captured in a very very fast way !

parameters are :

a : EV distance between two shots expressed in 1/3 step (eg. a=3 will do 1 full step)
b : the script takes 2b+1 pictures : b underexposed ones, 1 correctly exposed, b overexposed
c : each exposure shoot is repeated c times

with the defaults values, a=3, b=1, c=1 you get 3 pictures (-1, 0, +1)

To be really fast the script does the following :

- switch to NO FLASH
- detects if MF already done, if yes got to shoots, if not...
- ...try to focus in the current focus mode (standard or macro). If impossible...
- ...switch to the other focus mode (standard or macro) and try to focus again
- switch to MF
- takes the 5 pictures using EV corrections with the "properties" rather than with button presses ...
- resets the camera to its original state (flash, EV ...)

Script Code (save as "HDR_bracketing.bas" to your /CHDK/SCRIPTS/ folder)

(tested with Allbest build 16 on a PS A610)
rem Author ~SuperManu~ inspired by ~Aeropic~
rem For A610 camera
rem May work on others digicII
rem See documentation

@title HDR bracketing
@param a delta en 1/3
@default a 3
@param b (nb images-1)/2
@default b 1
@param c repetitions
@default c 1

rem test input consistency
if b<1 then b=1 
if a<1 then a=1
if a>6 then a=6
if b>6 then b = 6
if c<1 then c=1

j=0

rem get the dial mode 
rem if <> P, Tv, Av exit
get_prop 0 i
if i = 2 then goto "ok"
if i = 3 then goto "ok"
if i = 1 then goto "ok"
print "P, Tv ou Av ..."
goto "lend"

:ok
rem test if flash set
get_prop 16 f
if f = 2 then goto "ok2"
print "flash OFF ..."
set_prop 16 2

:ok2
rem get Exp compensation value
get_prop 25 i

rem  nb steps diaph computation
a=a*32

rem start EV computation
s=i-b*a 
b=b*2 

rem check focus mode
get_prop 12 y
get_prop 11 x
let v=y
let u=x
sleep 50
if y = 1 then goto "shoot_it"

:ok3
rem try to focus
press "shoot_half"

rem wait for focus (prop 67)
p = 0
set_prop 67 0
do
 p = p +1
 get_prop 67 j
 if p = 100 then 
   print "focus impossible"
   release "shoot_half"
   get_prop 11 x
   if x=0 then set_prop 11 1 else set_prop 11 0 endif
   print "change focus mode"
   goto "ok3"
 endif
until j = 1

rem switch to manual focus
do
 sleep 500
 click "down"
 sleep 500
 get_prop 12 y
until y=1
release "shoot_half"
sleep 300

:shoot_it
rem data take loop based on prop 205
rem initial set of 25 & 26 for the first shot
z=1
set_prop 25 s
set_prop 26 s
for n=1 to (b+1)*c
  print "repetition " z "/" c
  click "shoot_full"
  do
   get_prop 205 w
  until w=1
  if z=c then
   s=s+a
   set_prop 25 s
   set_prop 26 s
   z=0
  else if z<c then z=z+1
  else if z>c then z=1
  endif
 do
   get_prop 205 w
  until w<>1
next n 

rem switch back to previous focus mode
do
 sleep 500
 click "down"
 sleep 500
 get_prop 12 y
 get_prop 11 x
until y=v and x=u
set_prop 11 u
set_prop 12 v

rem reset initial values for EV and flash
set_prop 25 i
set_prop 26 i
set_prop 16 f
sleep 300

:lend
let j=0
end

--SuperManu 09:42, 8 February 2008 (UTC)

Around Wikia's network

Random Wiki