CHDK Wiki
No edit summary
No edit summary
Line 1: Line 1:
 
:'''Written for/on:''' Powershot S5 IS
 
:'''Written for/on:''' Powershot S5 IS
:'''Also works on:''' A540, A550, A570, A590, SX110IS, SX10IS so far (Edit me).
+
:'''Also works on:''' A540, A550, A570, A590, SX110IS, SX10IS, SD990 (Ixus 980IS) so far (Edit me).
 
:'''Doesn't works on:''' A720 IS and some others ; Update 7/02/2009 : With the latest version of CHDK ( autobuild ) , verison B for PowerShot S5IS it causes camera crash.
 
:'''Doesn't works on:''' A720 IS and some others ; Update 7/02/2009 : With the latest version of CHDK ( autobuild ) , verison B for PowerShot S5IS it causes camera crash.
   
Line 14: Line 14:
 
'''Script Code''' (save as "Lightning script.bas" to your /CHDK/SCRIPTS/ folder)
 
'''Script Code''' (save as "Lightning script.bas" to your /CHDK/SCRIPTS/ folder)
   
rem Author: fudgey - based on BarneyFive's MD Lightning6 and MLuna's Motion Detect scripts
+
rem Author: fudgey - based on BarneyFive's MD Lightning6 and MLuna's Motion Detect scripts
rem Tested on A570IS, Allbest build 16
+
rem Tested on A570IS, Allbest build 16
rem For bursts, set the camera in continuous shooting mode and set j>0
+
rem For bursts, set the camera in continuous shooting mode and set j>0
rem If j>0 in single shot mode, you will see your shot for j seconds on screen.
+
rem If j>0 in single shot mode, you will see your shot for j seconds on screen.
@title Fast MD with Burst/Preview 080205
+
@title Fast MD with Burst/Preview 080205
@param a Columns
+
@param a Columns
@default a 6
+
@default a 6
@param b Rows
+
@param b Rows
@default b 4
+
@default b 4
@param c Threshold (0-255)
+
@param c Threshold (0-255)
@default c 10
+
@default c 10
@param d Compare Interval (ms)
+
@param d Compare Interval (ms)
@default d 1
+
@default d 1
@param e Trigger Delay (0.1 sec)
+
@param e Trigger Delay (0.1 sec)
@default e 42
+
@default e 42
@param f Rows to Exclude
+
@param f Rows to Exclude
@default f 0
+
@default f 0
@param g Pix-Step(speed/accuracy adj)
+
@param g Pix-Step(speed/accuracy adj)
@default g 8
+
@default g 8
@param h Reg Mode(0-no,1-incl,2-excl)
+
@param h Reg Mode(0-no,1-incl,2-excl)
@default h 0
+
@default h 0
@param i Measure Mode (1-Y,0-U,2-V)
+
@param i Measure Mode (1-Y,0-U,2-V)
@default i 1
+
@default i 1
@param j Burst/Preview (sec,0=off)
+
@param j Burst/Preview (sec,0=off)
@default j 0
+
@default j 0
if a<1 then a=1
+
if a&lt;1 then a=1
if b<1 then b=1
+
if b&lt;1 then b=1
if c<0 then c=0
+
if c&lt;0 then c=0
if g<1 then g=1
+
if g&lt;1 then g=1
if f<1 then f=1
+
if f&lt;1 then f=1
if j<0 then j=0
+
if j&lt;0 then j=0
e=e*100
+
e=e*100
j=j*1000
+
j=j*1000
print ">[";a;",";b;"] threshold: ";c
+
print "&gt;[";a;",";b;"] threshold: ";c
x=30000
+
x=30000
if j>0 then goto "md_burst"
+
if j&gt;0 then goto "md_burst"
:md_singleshot
+
:md_singleshot
press "shoot_half"
+
press "shoot_half"
t=0
+
t=0
do
+
do
md_detect_motion a, b, i, x, d, c, 1, t, h, 1, 1, a, f, 0, g, e
+
md_detect_motion a, b, i, x, d, c, 1, t, h, 1, 1, a, f, 0, g, e
until t>0
+
until t&gt;0
click "shoot_full"
+
click "shoot_full"
goto "md_singleshot"
+
goto "md_singleshot"
:md_burst
+
:md_burst
press "shoot_half"
+
press "shoot_half"
t=0
+
t=0
do
+
do
md_detect_motion a, b, i, x, d, c, 1, t, h, 1, 1, a, f, 0, g, e
+
md_detect_motion a, b, i, x, d, c, 1, t, h, 1, 1, a, f, 0, g, e
until t>0
+
until t&gt;0
press "shoot_full"
+
press "shoot_full"
let X=get_tick_count
+
let X=get_tick_count
:contloop
+
:contloop
let U=get_tick_count
+
let U=get_tick_count
let V=(U-X)
+
let V=(U-X)
if V<j then goto "contloop"
+
if V&lt;j then goto "contloop"
release "shoot_full"
+
release "shoot_full"
 
goto "md_burst"
 
goto "md_burst"
 
[[Category:Scripts]]
 
[[Category:Scripts]]

Revision as of 21:17, 1 July 2009

Written for/on: Powershot S5 IS
Also works on: A540, A550, A570, A590, SX110IS, SX10IS, SD990 (Ixus 980IS) so far (Edit me).
Doesn't works on: A720 IS and some others ; Update 7/02/2009 : With the latest version of CHDK ( autobuild ) , verison B for PowerShot S5IS it causes camera crash.

This is basically a very fast and responsive motion detection script. This will definitely solve your problems if you want to catch lightning (thus the title) or anything fast, however some objects will blur when the light conditions are insufficient. Enjoy this script!

Latest version? The version "080205" below seems outdated. See also version "080914" released in this forum thread...

See also:


Script Code (save as "Lightning script.bas" to your /CHDK/SCRIPTS/ folder)

rem Author: fudgey - based on BarneyFive's MD Lightning6 and MLuna's Motion Detect scripts 
  rem Tested on A570IS, Allbest build 16 
  rem For bursts, set the camera in continuous shooting mode and set j>0 
  rem If j>0 in single shot mode, you will see your shot for j seconds on screen. 
  @title Fast MD with Burst/Preview 080205 
  @param a Columns 
  @default a 6 
  @param b Rows 
  @default b 4 
  @param c Threshold (0-255) 
  @default c 10 
  @param d Compare Interval (ms) 
  @default d 1 
  @param e Trigger Delay (0.1 sec) 
  @default e 42 
  @param f Rows to Exclude 
  @default f 0 
  @param g Pix-Step(speed/accuracy adj) 
  @default g 8 
  @param h Reg Mode(0-no,1-incl,2-excl) 
  @default h 0 
  @param i Measure Mode (1-Y,0-U,2-V) 
  @default i 1 
  @param j Burst/Preview (sec,0=off) 
  @default j 0 
  if a<1 then a=1 
  if b<1 then b=1 
  if c<0 then c=0 
  if g<1 then g=1 
  if f<1 then f=1 
  if j<0 then j=0 
  e=e*100 
  j=j*1000 
  print ">[";a;",";b;"] threshold: ";c 
  x=30000 
  if j>0 then goto "md_burst" 
  :md_singleshot 
    press "shoot_half" 
    t=0 
    do 
     md_detect_motion a, b, i, x, d, c, 1, t, h, 1, 1, a, f, 0, g, e 
    until t>0 
    click "shoot_full" 
    goto "md_singleshot" 
  :md_burst 
    press "shoot_half" 
    t=0 
    do 
     md_detect_motion a, b, i, x, d, c, 1, t, h, 1, 1, a, f, 0, g, e 
    until t>0 
    press "shoot_full" 
    let X=get_tick_count 
  :contloop 
  let U=get_tick_count 
  let V=(U-X) 
  if V<j then goto "contloop" 
  release "shoot_full"   
  goto "md_burst"