looks like you want to be pointed south (at least in the northern hemisphere)
What is the best way to capture a dark frame? My camera (G12) doesn't have a lense cap...
--[[@title Shoot photo + dark frame pairby fudgey 2010/11/16Shoots a RAW photo and a RAW dark frame.The dark frame will be shot using the same exposure parameters as the actual photo, but it is not shot using Canon's automatic dark frame feature (instead,a second photo is taken -- therefore you also get a useless(?) JPEG of the dark frame).The photo will use whatever exposure parameters the camera would normally use without the script, i.e. Canon's manual exposure or autoexposure and CHDK exposure overrides should work as expected if they are active. Focus shouldn'tmake a difference if the mehcanical shutter is between lens and sensor. SimilarlyND filter state shouldn't affect results.The script requires native calls to be enabled in your CHDK build. They are notenabled in CHDK autobuilds by default. Set OPT_LUA_CALL_NATIVE=1 in builconf.incand rebuild to enable them.The script assumes all vxworks cameras to have InitializeAdjustmentFunctioneventproc, and it to register CloseMShutter eventproc. For dryos, it assumesMecha.Create eventproc to register CloseMechaShutter eventproc. If neither is nottrue for your camera, the script will fail to work. It will most likely eitherexit due to an error before shooting, or warn about the shutter close commandand shoot two normal RAW+JPG photos instead of a photo + dark frame pair.--]]propcase=require("propcase")-- Register shutter control event procs depending on os and define functions -- openshutter() and closeshutter() to control mechanical shutter.function init() -- check for native call interface: if (type(call_event_proc) ~= "function" ) then error("your CHDK does not support native calls") end local bi=get_buildinfo() if bi.os=="vxworks" then closeproc="CloseMShutter" openproc="OpenMShutter" if (call_event_proc("InitializeAdjustmentFunction") == -1) then error("InitAdjFunc failed") end elseif bi.os=="dryos" then closeproc="CloseMechaShutter" openproc="OpenMechaShutter" if (call_event_proc("Mecha.Create") == -1) then error("Mecha.Create failed") end else error("Unknown OS:" .. bi.os) end -- close mechanical shutter function closeshutter() if (call_event_proc(closeproc) == -1) then print("closeshutter failed") end end -- open mechanical shutter function openshutter() if (call_event_proc(openproc) == -1) then print("openshutter failed") end end -- test for still photo rec mode: rec,vid=get_mode() if rec ~= true then error("Not in REC mode") elseif vid == true then error("Video not supported") endend -- init()-- store current exposure params (to be called during half shoot, after autoexposure has finished)function get_exposure_params() print("remembering exposure") --tv96=get_tv96() -- exposure time --sv96=get_sv96() -- ISO tv96=get_prop(propcase.TV) -- exposure time sv96=get_prop(propcase.SV) -- ISO if get_nd_present() ~= 1 then -- aperture if camera has iris --av96=get_av96() av96=get_prop(propcase.AV) endend-- set previously saved exposure params (to be called during half shoot, after autoexposure has finished)function set_exposure_params() print("overriding exposure") --set_tv96_direct(tv96) -- exposure time --set_sv96(sv96) -- ISO set_prop(propcase.TV,tv96) -- exposure time set_prop(propcase.SV,sv96) -- ISO if get_nd_present() ~= 1 then -- aperture if camera has iris --set_av96_direct(av96) set_prop(propcase.AV,av96) endend--[[ Exposure parameter controlled shoot: if argument dark==false, function stores Tv, Av, Sv from this shot and shoots a real photo. If dark==true, function overrides camera exposure parameters to match previously stored ones and shoots a dark frame. Obviously one must always call this function with false before it can be called with true.--]]function expcontrol_shoot(dark) -- half shoot and wait for autoexposure (if disabled, it'll finish real fast) press("shoot_half") repeat sleep(1) until get_shooting() == true if dark == true then -- if dark frame set_exposure_params() -- set overrides closeshutter() -- close shutter sleep(1) -- wait for shutter to close (don't know if this is required) end -- take the photo press("shoot_full") sleep(1) if dark ~= true then -- normal photo, store exposure params get_exposure_params() end release("shoot_full") sleep(1) release("shoot_half") repeat sleep(1) until get_shooting() ~= true end-- script starts hereinit()-- store user raw mode and dark frame reduction settingsrawmode=get_raw()dfrmode=get_raw_nr()set_raw(1) -- enable RAW or DNGset_raw_nr(1) -- disable Canon's dark frame reductionprint("Shooting RAW+JPG")expcontrol_shoot(false) -- shoot a photo, store its exposure paramsprint("Shooting dark frame")expcontrol_shoot(true) -- shoot dark frame using stored exposure parameters-- restore user raw mode and dark frame reduction settings:set_raw(rawmode)set_raw_nr(dfrmode)
Dark frame should be done after every 10 frames but lua programming is not my strong side
I'll give it a shot - but its looking to be cloudy here this weekend. Grrrr....
You can use any box to cover the lens or you can use Fudgey Dark frame script but you must have native calls enabled.http://forum.chdk-treff.de/viewtopic.php?
I think I read somewhere that the German CHDK experimental versions have native calls enabled? Do you know if the download from this link would work?
I think I read somewhere that the German CHDK experimental versions have native calls enabled?
Quote from: blackhole on 18 / October / 2012, 12:58:55Dark frame should be done after every 10 frames but lua programming is not my strong side I'll give it a shot - but its looking to be cloudy here this weekend. Grrrr....
--[[@title Dark Frame Shooter for Meteors2010/11/16 original script by fudgey 2012/10/18 modified by waterwingz to shoot continuously and record dark frame periocally@param n Number of Shots@default n 1000@param r Raw On/Off (1=On/0=Off)@default r 1@param s Shots per Dark Frame@default s 50@param t exposure in seconds (0=auto)@default t 25--]]propcase=require("propcase")-- Register shutter control event procs depending on os and define functions -- openshutter() and closeshutter() to control mechanical shutter.function init() set_console_layout(5, 0, 40, 14) -- check for native call interface: if (type(call_event_proc) ~= "function" ) then error("your CHDK does not support native calls") end local bi=get_buildinfo() if bi.os=="vxworks" then closeproc="CloseMShutter" openproc="OpenMShutter" if (call_event_proc("InitializeAdjustmentFunction") == -1) then error("InitAdjFunc failed") end elseif bi.os=="dryos" then closeproc="CloseMechaShutter" openproc="OpenMechaShutter" if (call_event_proc("Mecha.Create") == -1) then error("Mecha.Create failed") end else error("Unknown OS:" .. bi.os) end -- close mechanical shutter function closeshutter() if (call_event_proc(closeproc) == -1) then print("closeshutter failed") end end -- open mechanical shutter function openshutter() if (call_event_proc(openproc) == -1) then print("openshutter failed") end end -- switch to record mode if necessary if ( get_mode() == false ) then print("switching to record mode") sleep(1000) set_record(1) while ( get_mode() == false) do sleep(100) end end -- test for still photo rec mode: rec,vid=get_mode() if rec ~= true then error("Not in REC mode") elseif vid == true then error("Video not supported") end -- make sure we are in P mode capmode=require("capmode") if ( capmode.get_name() ~= "P") then error("Not in Program mode!") end -- check that flash is disabled if ( get_flash_mode() ~= 2) then error("Flash not disabled!") end -- nasty hack to turn seconds into tv96 values tv96set=0 if (t>=10) then tv96set=-320 end if (t>=15) then tv96set=-384 end if (t>=20) then tv96set=-416 end if (t>=25) then tv96set=-448 end if (t>=30) then tv96set=-480 endend -- init()-- store current exposure params (to be called during half shoot, after autoexposure has finished)function get_exposure_params() if( t>=10 ) then set_prop(propcase.TV,tv96set) -- exposure time end tv96=get_prop(propcase.TV) -- exposure time sv96=get_prop(propcase.SV) -- ISO if get_nd_present() ~= 1 then -- aperture if camera has iris --av96=get_av96() av96=get_prop(propcase.AV) print("remembering tv=",tv96,"sv=",sv96,"av=",av96) else print("remembering tv=",tv96,"sv=",sv96) endend-- set previously saved exposure params (to be called during half shoot, after autoexposure has finished)function set_exposure_params() --set_tv96_direct(tv96) -- exposure time --set_sv96(sv96) -- ISO set_prop(propcase.TV,tv96) -- exposure time set_prop(propcase.SV,sv96) -- ISO if get_nd_present() ~= 1 then -- aperture if camera has iris --set_av96_direct(av96) set_prop(propcase.AV,av96) print("overriding tv=",tv96,"sv=",sv96,"av=",av96) else print("overriding tv=",tv96,"sv=",sv96) endend--[[ Exposure parameter controlled shoot: if argument dark==false, function stores Tv, Av, Sv from this shot and shoots a real photo. If dark==true, function overrides camera exposure parameters to match previously stored ones and shoots a dark frame. Obviously one must always call this function with false before it can be called with true.--]]function expcontrol_shoot(dark) -- half shoot and wait for autoexposure (if disabled, it'll finish real fast) press("shoot_half") repeat sleep(10) until get_shooting() == true if dark == true then -- if dark frame set_exposure_params() -- set overrides closeshutter() -- close shutter sleep(10) -- wait for shutter to close (don't know if this is required) end -- take the photo press("shoot_full") sleep(10) if dark ~= true then -- normal photo, store exposure params get_exposure_params() end release("shoot_full") sleep(10) release("shoot_half") repeat sleep(10) until get_shooting() ~= true end-- restore user raw mode and dark frame reduction settings:function restore() set_raw(rawmode) set_raw_nr(dfrmode)end-- store user raw mode and dark frame reduction settingsrawmode=get_raw()dfrmode=get_raw_nr()-- script starts hereinit()set_raw(r) -- enable RAW or DNGset_raw_nr(1) -- disable Canon's dark frame reductionj=sfor i=1,n do print("shooting RAW+JPG", i, "of",n) expcontrol_shoot(false) -- shoot a photo, store its exposure params if j >= s then j=0 print("shooting a dark frame") expcontrol_shoot(true) -- shoot dark frame using stored exposure parameters else j=j+1 endendprint("shooting final dark frame")expcontrol_shoot(true) restore()print("done")
Started by diegorodriguez Script Writing
Started by ProjectHaxor General Discussion and Assistance
Started by dutchie Creative Uses of CHDK
Started by Intheswamp Creative Uses of CHDK
Started by csengeri Script Writing