Wikia

CHDK Wiki

Ultra HDR Script

Talk0
577pages on
this wiki
UltraHdr

This script provides a complete HDR / Exposure Bracketing environment for use with CHDK.

It combines various aspects of many existing HDR scripts and will work on any CHDK equipped camera.  It has no embedded keyboard presses or fixed parameter set variables that would make it specific to a particular camera.  However, it is designed to run best with CHDK 1.2.0 or newer - see the bottom of this page for instructions on converting for CHDK 1.1.0.

Script DescriptionEdit

The script allows the user to vary one of the three camera exposure parameters (Tv, Av, Sv) while holding the other two fixed.  This results in several shots at different exposure settings,  suitable for creating HDR images in your computer.

Note :  as many Canon P&S cameras do not have adjustable aperture. 

forum link > http://chdk.setepontos.com/index.php?topic=9557

Script OperationEdit

  1. HDR mode - choose better shutter (Tv),  Iris (Av),  ISO (Sv), or Exposure Adjust (Ev)
  2. Exposure Steps - this determines the number of photos taken at different exposures.
  3. 1/2 f-stops per step - the exposure adjustment made between shots
  4. Exposure offset -  allow you to shift the exposure of all shots up or down by a fixed amount.
  5. Raw - override current RAW setting (restored on script exit)

Lua ScriptEdit

UltraHDR.lua : for CHDK v1.2.0 or greater (see note below)

--[[
 @title Ultra HDR v2
 
 @param m HDR Exposure Mode
    @default m 0
    @values m Shutter Iris ISO Ev_Adj
 @param n Exposure Steps
    @default n 3
    @range n 2 8
 @param a 1/2 f-stops per Step
    @default a 2
    @range a 1 10
 @param e Exposure Offset (stops)
    @default e 0
    @range e -4 4
 @param r Raw & DNG
    @default r 
    @values r Ignore Disable Enable
 --]] 
 
-- release AF lock & restore RAW state on exit
 function restore()
    if ( r>0 ) then set_raw(rawmode) end
    set_aflock(0)
 end
 
--setup
 set_console_layout(1, 0, 45, 12) 
 rawmode=get_raw()
 if( r>0 ) then set_raw(r-1) end
 print("Ultra HDR v2 started...")
 
-- switch to shooting mode
 if ( get_mode() == false ) then
    sleep(1000)
    set_record(1)
    while ( get_mode() == false) do
       sleep(100)
    end
 end
 sleep(100)
 
-- focus and take exposure
 press("shoot_half") 
 repeat
    sleep(50)
 until get_shooting() == true 
    release("shoot_half") 
 repeat
    sleep(50)
 until get_shooting() == false
   set_aflock(1)
   av=get_av96() 
   sv=get_sv96() 
   tv=get_tv96() 
   ev=get_ev()
 
-- configure the shots
   print( "start  tv="..tv, "av="..av, "sv="..sv, "ev="..ev)
   s=a*48
   s_offset=(n-1)*s/2+e*96
   tv_inc=0
   av_inc=0
   sv_inc=0
   ev_inc=0
   if(m==0) then
      tv=tv - s_offset
      tv_inc=s
   elseif ( m==1 ) then 
      av=av - s_offset
      av_inc=s
   elseif ( m == 2 ) then
      sv=sv - s_offset
      sv_inc=s
   elseif ( m == 3 ) then
      ev=ev - s_offset
      ev_inc=s
   end
 
--shoot
 for i=1, n, 1 do
   print(i, "tv="..tv, "av="..av, "sv="..sv, "ev="..ev)
   if ( m == 3 ) then
        set_ev(ev)   
   else
        set_tv96_direct(tv)
        set_av96_direct(av)
        set_sv96(sv)
   end
   shoot()   
   tv = tv + tv_inc
   av = av + av_inc
   sv = sv + sv_inc
   ev = ev + ev_inc
 end
 
restore()
print("...done")

Script NotesEdit

For CHDK versions 1.1 or earlier, change the header of the script to the following :

--[[
 @title Ultra HDR
 
 @param m Mode [Tv=0,Ev=1,Sv=2,Ev=3]
    @default m 0
    @range m 0 3
 @param n Exposure Steps
    @default n 3
    @range n 2 8
 @param a 1/2 f-stops per Step
    @default a 2
    @range a 1 10
 @param e Exposure Offset [stops]
    @default e 0
    @range e -4 4
 @param r Raw/DNG [0=auto,1=off,2=on]
    @default r 
    @range r 0 2
 --]]

Around Wikia's network

Random Wiki