--[[@title Motion Detect Plusrem Version 0.2.1 - June 25, 2012 - 2:25pmrem by Andrew Hazeldenrem email: andrewhazelden@gmail.com rem blog: [url=http://www.andrewhazelden.com/]www.andrewhazelden.com/[/url]rem This script adds a repetitive shot mode and isrem based upon the standard "motion.lua" scriptrem Make sure to disable Review Mode in the Canon menus.rem Standard sensitivity threshold levels: 12=Sun 24=Cloudy 36=Dawn/Duskrem If the camera to takes photos continuously increase therem threshold setting level for a reduced motion detectionrem responsiveness. rem (a higher motion threshold number = lower responsiveness)rem Version Historyrem ---------------rem Version 0.2rem Created June 25, 2012rem Added a "Motion Threshold" parameterrem Version 0.1rem Created on Feb 26, 2012rem Initial Release of Motion Detect Plus@param x Motion Threshold@param y Start Delay (min)@param z Start Delay (sec)@param g Draw Grid 0=No 1=Yes@param a Grid Columns@param b Grid Rows@param i Region 0=No 1=In 2=Out@param j Start Column@param l End Column@param k Start Row@param m End Rowrem default delay values@default y 0@default z 3rem default motion threshold@default x 24rem default grid values@default g 1@default a 3@default b 3rem enabled grid cells@default i 0@default j 0@default k 0@default l 0@default m 0--]]-- make sure the start column is smaller then the end columnif j>l then j=lend-- make sure the start row is smaller then the end rowif k>m then k=mend--make sure the region number is validif i>2 then i=0end-- Motion detection variables-- a=6 -- columns to split picture into -- b=6 -- rows to split picture into c=1 -- measure mode (Y,U,V R,G,B) U=0, Y=1, V=2, R=3, G=4, B=5d=300000 -- timeout (mSec) e=200 -- comparison interval (msec) - less than 100 will slow down other CHDK functions-- f=5 -- threshold (difference in cell to trigger detection)-- g=1 -- draw grid (0=no, 1=yes) h=0 -- not used in LUA - in uBasic is the variable that gets loaded with the number of cells with motion detected-- i=0 -- region masking mode: 0=no regions, 1=include, 2=exclude-- j=0 -- first column-- k=0 -- first row-- l=0 -- last column-- m=0 -- last rown=0 -- optional parameters (1=shoot immediate)o=2 -- pixel stepp=0 -- triggering delay (msec) -- Other variablesq=0 -- the number of shots taken -- r=get_tick_count() -- beginning of script timer value-- Start the delay timercls()print("Typical Motion Threshold")print("12=Sun 24=Cloudy 36=Dawn")if y>0 then print( y .. " min " .. z .. " sec to start...")else print( z .. " sec to start...")endsleep( (z*1000)+(y*1000*60) )-- Start the motion detection loopcls()print("Starting Motion Detection")play_sound(3) --plays the self timer sound effectrepeat zones = md_detect_motion( a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) --check if the zones value is nil due to pausing the script if( zones ~= nil) then if( zones > 0 ) then shoot() cls() q=q+1 -- Increment the shots taken counter print(q .. " Shots Taken") end end until ( false )
--[[@title Motion Detect Plusrem Version 0.3 - August 20, 2012rem by Andrew Hazeldenrem email: andrewhazelden@gmail.com rem blog: [url=http://www.andrewhazelden.com/]www.andrewhazelden.com/[/url]rem This script adds a repetitive shot mode and isrem based upon the standard "motion.lua" scriptrem Make sure to disable Review Mode in the Canon menus.rem Standard sensitivity threshold levels: 12=Sun 24=Cloudy 36=Dawn/Duskrem If the camera takes photos continuously increase therem threshold setting level for a reduced motion detectionrem responsiveness. rem (a higher motion threshold number = lower responsiveness)rem Version Historyrem ---------------rem Version 0.3rem Aug 20, 2012rem Improved motion threshold settingsrem Version 0.2rem Created June 25, 2012rem Added a "Motion Threshold" parameterrem Version 0.1rem Created on Feb 26, 2012rem Initial Release of Motion Detect Plus@param f Motion Threshold@param y Start Delay (min)@param z Start Delay (sec)@param g Draw Grid 0=No 1=Yes@param a Grid Columns@param b Grid Rows@param i Region 0=No 1=In 2=Out@param j Start Column@param l End Column@param k Start Row@param m End Rowrem default delay values@default y 0@default z 3rem default motion threshold@default f 24rem default grid values@default g 1@default a 3@default b 3rem enabled grid cells@default i 0@default j 0@default k 0@default l 0@default m 0--]]-- make sure the start column is smaller then the end columnif j>l then j=lend-- make sure the start row is smaller then the end rowif k>m then k=mend--make sure the region number is validif i>2 then i=0end-- Motion detection variables-- a=6 -- columns to split picture into -- b=6 -- rows to split picture into c=1 -- measure mode (Y,U,V R,G,B) U=0, Y=1, V=2, R=3, G=4, B=5d=300000 -- timeout (mSec) e=200 -- comparison interval (msec) - less than 100 will slow down other CHDK functions-- f=5 -- threshold (difference in cell to trigger detection)-- g=1 -- draw grid (0=no, 1=yes) h=0 -- not used in LUA - in uBasic is the variable that gets loaded with the number of cells with motion detected-- i=0 -- region masking mode: 0=no regions, 1=include, 2=exclude-- j=0 -- first column-- k=0 -- first row-- l=0 -- last column-- m=0 -- last rown=0 -- optional parameters (1=shoot immediate)o=2 -- pixel stepp=0 -- triggering delay (msec) -- Other variablesq=0 -- the number of shots taken -- r=get_tick_count() -- beginning of script timer value-- Start the delay timercls()print("Typical Motion Threshold")print("12=Sun 24=Cloudy 36=Dawn")if y>0 then print( y .. " min " .. z .. " sec to start...")else print( z .. " sec to start...")endsleep( (z*1000)+(y*1000*60) )-- Start the motion detection loopcls()print("Starting Motion Detection")play_sound(3) --plays the self timer sound effectrepeat zones = md_detect_motion( a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) --check if the zones value is nil due to pausing the script if( zones ~= nil) then if( zones > 0 ) then shoot() cls() q=q+1 -- Increment the shots taken counter print(q .. " Shots Taken") end end until ( false )
--[[@title Motion Detect Plusrem Version 0.3.1 - Sept 16, 2012rem Build 27rem This file is a CHDK LUA script and should have the name "motionp.lua"rem by Andrew Hazeldenrem email: andrewhazelden@gmail.com rem blog: [url=http://www.andrewhazelden.com]www.andrewhazelden.com[/url]rem This script adds a repetitive shot mode and isrem based upon the standard "motion.lua" scriptrem Make sure to disable Review Mode in the Canon menus.rem Standard sensitivity threshold levels: 12=Sun 24=Cloudy 36=Dawn/Duskrem If the camera takes photos continuously increase therem threshold setting level for a reduced motion detectionrem responsiveness. rem (a higher motion threshold number = lower responsiveness)rem Version Historyrem ---------------rem Version 0.3.1rem Sept 16, 2012rem Changed the zones variable to avoid a naming conflict.rem Added a "Number of Shots" variable that takes a burst of photosrem during a motion detection event.rem Version 0.3rem Aug 20, 2012rem Improved motion threshold settingsrem Version 0.2rem Created June 25, 2012rem Added a "Motion Threshold" parameterrem Version 0.1rem Created on Feb 26, 2012rem Initial Release of Motion Detect Plus@param f Motion Threshold@default f 24@range f 0 100rem Script start delay values@param y Start Delay (min)@default y 0@param z Start Delay (sec)@default z 3rem default number of shots taken during a motion detection event@param w Number of Shots@default w 1@param g Draw Grid 0=No 1=Yes@default g 1@range g 0 1@param a Grid Columns@param b Grid Rows@default a 3@default b 3@param i Region 0=No 1=In 2=Out@default i 0@range i 0 2rem Enabled grid cells@param j Start Column@param l End Column@param k Start Row@param m End Row@default j 0@default k 0@default l 0@default m 0--]]shots=0 -- photos taken counter-- make sure number of shots is positiveif w<0 then w=1endnum_shots = w-- make sure the start column is smaller then the end columnif j>l then j=lend-- make sure the start row is smaller then the end rowif k>m then k=mend--make sure the region number is validif i>2 then i=0end-- Motion detection variables-- a=6 -- columns to split picture into -- b=6 -- rows to split picture into c=1 -- measure mode (Y,U,V R,G,B) U=0, Y=1, V=2, R=3, G=4, B=5d=300000 -- timeout (mSec) e=200 -- comparison interval (msec) - less than 100 will slow down other CHDK functions-- f=5 -- threshold (difference in cell to trigger detection)-- g=1 -- draw grid (0=no, 1=yes) h=0 -- not used in LUA - in uBasic is the variable that gets loaded with the number of cells with motion detected-- i=0 -- region masking mode: 0=no regions, 1=include, 2=exclude-- j=0 -- first column-- k=0 -- first row-- l=0 -- last column-- m=0 -- last rown=0 -- optional parameters (1=shoot immediate)o=2 -- pixel stepp=0 -- triggering delay (msec) -- Other variables-- r=get_tick_count() -- beginning of script timer value-- Start the delay timercls()print("Typical Motion Threshold")print("12=Sun 24=Cloudy 36=Dawn")if y>0 then print( y .. " min " .. z .. " sec to start...")else print( z .. " sec to start...")endsleep( (z*1000)+(y*1000*60) )-- Start the motion detection loopcls()print("Starting Motion Detection")play_sound(3) --plays the self timer sound effectrepeat md_zone = md_detect_motion( a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) cls() --check if the md_zone value is nil due to pausing the script if( md_zone ~= nil) then if( md_zone > 0 ) then --shoot multiple photos in a burst using (Number of Shots) if(num_shots>0) then burst = num_shots repeat shoot() cls() shots=shots+1 -- Increment the shots taken counter burst=burst-1 -- update the photo burst counter until ( burst==0 ) print(shots .. " Shots Taken" ) sleep(250) end end enduntil ( false )
Started by pyst AllBest's Builds
Started by caculo Creative Uses of CHDK
Started by lapser LUA Scripting
Started by geocrasher « 1 2 3 » Script Writing
Started by Kestrel1978 General Help and Assistance on using CHDK stable releases