CHDK Wiki
Advertisement
Ndfilter

This script uses the camera's neutral density (ND) filter to achieve two different exposure levels for the same scene.  Conventional HDR scripts vary exposure by changing shutter speed, lens aperture or ISO sensitivity setting - each of which changes the image somewhat between each shot (blur, DOF, grain).   Using the ND filter allows both shot to be at identical settings for better matching during image stacking.

The script should run on any CHDK equiped camera that has an ND filter.   It does not use key presses or propset values.  

The only adjustment available is an exposure offset.   The script first takes a picture with normal exposure settings and then inserts the ND filter and takes a second shot with the same exposure settings.   The second shot will always be darker than the first.  You might need to adjust the normal exposure level if this sequence does not work for you.

Info on ND filter :  http://chdk.wikia.com/wiki/ND_Filter

CHDK forum thread > http://chdk.setepontos.com/index.php?topic=9558

nd_hdr.lua[]

--[[
 @title ND Filter HDR
 
 @param e Exposure Offset (stops)
 @default e 0
 @range e -4 4

 --]]

 -- release AF lock on exit
 function restore()
    set_aflock(0)
    set_nd_filter(0)
 end

-- setup
 set_console_layout(1, 0, 45, 12)

 print("ND HDR started...")

 if (get_nd_present()==0) then
   print("Note : ND filter not present?")
 else

-- switch to shooting mode
   if ( get_mode() == false ) then
      sleep(1000)
      set_record(1)
      while ( get_mode() == false) do
         sleep(100)
      end
   end
   sleep(200)

-- check exposure and focus
   print("shoot half")
   press("shoot_half")
   repeat
      sleep(50)
   until get_shooting() == true
   set_aflock(1)
   release("shoot_half")
   repeat
      sleep(50)
   until get_shooting() == false
   av=get_av96()
   sv=get_sv96()
   tv=get_tv96()
   print( "start tv=", tv, "av=", av, "sv=", sv, "offset=",e*96 )

-- shoot twice
   print("shot 1 .. ND filter out")
   set_nd_filter(2)
   set_tv96_direct(tv+e*96)
   set_av96_direct(av)
   set_sv96(sv)
   shoot()

   print("shot 2.. ND filter in")
   set_nd_filter(1)
   set_tv96_direct(tv+e*96)
   set_av96_direct(av)
   set_sv96(sv)
   shoot()
 end
restore()
print("...done")
Advertisement