CHDK Wiki
mNo edit summary
(Adding categories)
(12 intermediate revisions by the same user not shown)
Line 1: Line 1:
  +
[[File:UltraHdr.png|thumb|left|316px]]
{{Attention|Page under construction.}}
 
[[File:Placeholder|right|300px]]<span style="font-size:13px;line-height:21px;">
+
{| align="right" style="border-collapse:collapse; font-size: x-small;"
  +
| __TOC__
This script </span><span style="font-size:13px;line-height:21px;">provides a complete HDR / Exposure Bracketing script.  It combines </span><span style="font-size:13px;line-height:21px;">various aspects of many existing HDR scripts.   The script will work on any CHDK equiped camera.  It has no embeded keyboard presses or fixed parameter set variables that would make it specific to a particular camera.</span>
 
  +
|}
   
  +
This script provides a complete HDR / Exposure Bracketing environment for use with CHDK.
==Script Description==
 
   
  +
It combines various aspects of many existing HDR scripts and will work on any CHDK equiped camera.  It has no embeded 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.
This script provides two modes of exposure bracketing - fixed exposure or  HDR.
 
   
 
==Script Description==
In fixed exposure mode, the script holds the exposure constant while varying the one of the three exposure parameter ( Tv, Av, Sv).   This produces images with the same exposure but different combinations of shutter, aperature and ISO settings.
 
   
In HDR mode,  the script varies one of the three 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.
+
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 aperature,  the script provides a means to use those cameras ND (Neutral Density) filter to vary exposure.
+
Note :  as many Canon P&S cameras do not have adjustable aperature. 
  +
  +
forum link > http://chdk.setepontos.com/index.php?topic=9557
   
 
==Script Operation==
 
==Script Operation==
   
  +
The UltraHDR script has five parameters that can be set.  These are :
Write the second section of your page here.
 
  +
#<span style="font-size:13px;line-height:21px;">HDR mode - choose better shutter (Tv),  Iris (Ev),  or ISO (Sv).</span>
  +
#Exposure Steps - this determines the number of photos taken at different exposures.
  +
#<span style="line-height:20.98958396911621px;">1/2 f-stops per step - the exposure adjustment made between shots</span>
  +
#<span style="line-height:20.98958396911621px;">Eposure offset -  allow you to shift the exposure of all shots up or down by a fixed amount.</span>
  +
#<span style="line-height:20.98958396911621px;">Raw - override current RAW setting (restored on script exit)</span>
   
   
   
==Lua Script - UltraHDR.lua==
+
==Lua Script==
  +
'''UltraHDR.lua''' : for CHDK v1.2.0 or greater (see note below)
   
  +
<syntaxhighlight lang="lua">
   
  +
--[[
<span style="font-family:Helvetica,Arial,sans-serif;line-height:20.98958396911621px;white-space:normal;">​ --[[</span>
 
 
@title Ultra HDR
 
@title Ultra HDR
  +
@param m HDR exposure mode
+
@param m HDR Exposure Mode
@default m 0
+
@default m 0
@values m Shutter Iris ISO +ND -ND
+
@values m Shutter Iris ISO
@default e 0
 
@values e HDR Bracket
 
@param e Exposure Type
 
 
@param n Exposure Steps
 
@param n Exposure Steps
@default n 5
+
@default n 3
@range n 1 8
+
@range n 2 8
@param s 1/2 f-stops per step
+
@param a 1/2 f-stops per Step
@default s 4
+
@default a 2
@range s 1 10
+
@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 on exit
+
-- release AF lock & restore RAW state on exit
 
function restore()
 
function restore()
 
if ( r>0 ) then set_raw(rawmode) end
 
set_aflock(0)
 
set_aflock(0)
 
end
 
end
 
 
-- setup
+
--setup
set_console_layout(10, 0, 40, 14)
+
set_console_layout(1, 0, 45, 12)
  +
rawmode=get_raw()
props=require("propcase")
 
 
if( r>0 ) then set_raw(r-1) end
propset=get_propset()
 
 
print("Ultra HDR started...")
pTV=props.TV
 
  +
if( propset > 3) then pTV2=props.TV2 end
 
 
-- switch to shooting mode
print("Started...")
 
 
 
-- make sure we are in shooting mode
 
 
if ( get_mode() == false ) then
 
if ( get_mode() == false ) then
sleep(1000)
+
sleep(1000)
set_record(1)
+
set_record(1)
while ( get_mode() == false) do
+
while ( get_mode() == false) do
 
sleep(100)
 
sleep(100)
end
+
end
sleep(1000)
 
 
end
 
end
  +
sleep(100)
 
  +
-- timestamp the start
 
 
-- focus and take exposure
z = get_day_seconds()
 
 
press("shoot_half")
 
-- focus and get exposure
 
press("shoot_half")
 
 
repeat
 
repeat
sleep(50)
+
sleep(50)
until get_shooting() == true
+
until get_shooting() == true
 
release("shoot_half")
set_aflock(1)
 
  +
repeat
tv96val=get_tv96()-(n*(s/2))
 
 
sleep(50)
 
  +
until get_shooting() == false
-- take the shots as fast as possible
 
 
set_aflock(1)
  +
av=get_av96()
  +
sv=get_sv96()
  +
tv=get_tv96()
  +
  +
-- configure the shots
  +
print( "start","tv=", tv, "av=", av, "sv=", sv )
  +
s=a*48
  +
tv_inc=0
  +
av_inc=0
  +
sv_inc=0
  +
if(m==0) then
  +
tv=tv-n*s/2+e*96
  +
tv_inc=s
  +
elseif ( m==1 ) then
  +
av=av-n*s/2+e*96
  +
av_inc=s
  +
elseif ( m == 2 ) then
  +
sv=sv-n*s/2+e*96
  +
sv_inc=s
  +
end
  +
  +
--shoot
 
for i=1, n, 1 do
 
for i=1, n, 1 do
print("step=", i, "tv96=", tv96val)
+
print(i, "tv=", tv, "av=", av, "sv=", sv )
  +
set_tv96_direct(tv)
ecnt=get_exp_count()
 
  +
set_av96_direct(av)
set_prop(pTV,tv96val)
 
  +
set_sv96(sv)
if( propset > 3) then set_prop(pTV2,tv96val) end
 
  +
shoot()
press("shoot_full_only")
 
repeat
+
tv = tv + tv_inc
sleep(20)
+
av = av + av_inc
  +
sv = sv + sv_inc
until(get_exp_count()~=ecnt)
 
release("shoot_full_only")
 
tv96val = tv96val+s
 
 
end
 
end
  +
 
restore()
 
print("...done")
  +
</syntaxhighlight>
  +
  +
  +
==Script Notes==
  +
  +
For CHDK versions 1.1 or earlier, change the header of the script to the following :
  +
  +
<syntaxhighlight lang="lua">
  +
  +
--[[
  +
@title Ultra HDR
  +
  +
@param m Mode [Tv=0,Ev=1,Sv=2]
  +
@default m 0
  +
@range m 0 2
 
@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
  +
--]]
 
 
  +
</syntaxhighlight>
-- all done so cleanup
 
  +
[[Category:HDR]]
z = get_day_seconds() -z
 
  +
[[Category:Bracketing]]
print("...done in", z, "seconds")
 
restore()
 

Revision as of 03:52, 23 March 2013

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 equiped camera.  It has no embeded 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 Description

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 aperature. 

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

Script Operation

The UltraHDR script has five parameters that can be set.  These are :

  1. HDR mode - choose better shutter (Tv),  Iris (Ev),  or ISO (Sv).
  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. Eposure 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 Script

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

--[[
 @title Ultra HDR

 @param m HDR Exposure Mode
    @default m 0
    @values m Shutter Iris ISO
 @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 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() 

-- configure the shots
   print( "start","tv=", tv, "av=", av, "sv=", sv )
   s=a*48
   tv_inc=0
   av_inc=0
   sv_inc=0
   if(m==0) then
      tv=tv-n*s/2+e*96
      tv_inc=s
   elseif ( m==1 ) then 
      av=av-n*s/2+e*96
      av_inc=s
   elseif ( m == 2 ) then
      sv=sv-n*s/2+e*96
      sv_inc=s
   end

--shoot
 for i=1, n, 1 do
   print(i, "tv=", tv, "av=", av, "sv=", sv )
   set_tv96_direct(tv)
   set_av96_direct(av)
   set_sv96(sv)
   shoot()   
   tv = tv + tv_inc
   av = av + av_inc
   sv = sv + sv_inc
 end

restore()
print("...done")


Script Notes

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]
    @default m 0
    @range m 0 2
 @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
 --]]