Technology
 

Motion detection settings

From CHDK Wiki

Note: This information was taken out of context and copied from another thread to this page, it is referring to a script that was being tweaked for optimum speed. (A good idea, poorly implemented and can only cause further confusion.) A new script has since been created by "anonymous" that is even faster which makes the following information mostly irrelevent to the md_detect_motion command itself. This page is a work in progress. If you feel this page is needed, feel free to edit it, as the main Wikia editor has shown zero interest in doing further work on this page. This should only be considered as a temporary guideline of what needs to be addressed and clarified.


Contents

[edit] Motion Detection Settings

Scattered throughout the forum are numerous references to the Motion Detection Settings. Unfortunately one challenge of forums is that you can get pages and pages of results with numerous tangents. What I am setting up here is place where we can collectively deposit finalized settings for Motion Detection.


[edit] Script Settings

[edit] Hardware settings

[edit] Camera Mode

Auto -

TV -

AV -

Manual -

Shutter Speeds -

[edit] MD FAQ

  • "I start the script and take one shot (and it works great!) but then it keeps on taking more pictures even when nothing is going on!" - For the MD scripts the likely solution is the Trigger Delay. You want to set this number as low as possible, but not so much that the camera goes into a continous shooting cycle. If your camera is shooting continuously try bumping this number up. Values of 10-60 have proved to be effective in Manual Mode.
A new shooting routine was written/discovered by "anonymous" that now prevents most of this problem while allowing for fastest motion-detection time (as low as 45ms on some cameras). Here is an example of the loop that will help, which you can include in your own scripts:
e=e*100
f=f*1000
while 1
  press "shoot_half"
rem for get_prop use 205 for DigicII and 206 for DigicIII
  do
    get_prop 206 p
  until p=1
  md_detect_motion a, b, h, f, d, c, 1, t, 0, 1, 1, a, b, i, g, e
  if i=0 then click "shoot_full"
rem the next loop is endless if AE lock is activated, use 205 for DigiII
  do
    get_prop 206 p
  until p<>1
wend
end
Note that the get_prop 206 command (on two lines) will have to be edited depending on the type of camera you are using it on. For DigicII processor cameras change that 206 to 205.
This routine also assumes that you have also already defined all the other variable parameters properly. Variable f for example, needs to be set for a value of many seconds (here being defined as a multiple of 1000ms). While this prevents most occurrences of the MD routine continuously cycling, from the EVF/LCD display signal not settling down fast enough (when used with various camera modes, AUTO, P, Av, etc.), there might still be a problem if you define too many row and column detection areas (variables b and h in this example). Then you will have to increase the "Trigger Delay" (variable e in this script loop example) until the continuous-cycling problem stops. Refer to this post on the CHDK Forum for a more complete explanation of this loop and the script it is was initially used in.


Misc Tips

When first trying out the MD script(s) Start out with the suggested default settings. These should work well for most intents and purposes.

Each model reacts at different speeds to these routines. It will help others with the same camera as yours if you find some optimum settings.

[edit] Definitions

Definitions of terms used in MD lightnings script

Note the list here is derived from MD Lightning9 script as loaded on a Canon S3 under AllBest #16 Feb 8, 2008

  • Load Script From File -
  • Script Shot Delay -
  • Script Autostart -
  • Enable Remote (USB) -
  • Current Script -
  • Script Parameters -
  • Columns - Default=6 -
  • Rows - Default=4 -
  • Threshold (0-255) - Default=10 - This setting is for how sensitive you want it to detect changes in light levels. If your camera is triggering too often at minor changes in scene, increase this value.
  • Compare Interval (millisecs) - Default=1 -
  • Trigger Delay (0.1 secs) - Default=12 - setting is probably going to be the most important setting you'll have to change at times. Your target-number here is the lowest number you can get without the camera going into a continuous shooting cycle when there is no motion. This setting tells the MD routine to wait until your EVF/LCD display has settled down again after it has taken a shot. Changes in the EVF display from all its own automatic brightening and darkening as the camera shifts from taking an image and blacking out to showing your scene again. This delay also depends on what mode your camera is in.
Trigger Delay in full manual mode - If you have your camera in full Manual mode, manual everything, then the EVF screen will stabilize faster from shot to shot. If you are using Program mode then the camera will try to detect the right exposure again after it switches back from taking a shot, changing the brightness level in the EVF as it does so which requires a longer delay to account for all these automatic things happening. Values as small at 10 (1 second) or as high as 60 (6 seconds) may be needed.
  • Rows to Exclude - Default=0
  • Pix-Step (Speed/Accuracy Adjustment) - Default=4 - Pix-Step can also increase your cameras response time.
""How this works - If the md_detect routine has fewer pixels to sample it can do it faster. Also, some numbers sync better with the internal motion-detect code's need for a 30ms cycle time. You will have to experiment with these by trial and error. Settings of 4, 8 and 24 work well. NOTE: Keeping in mind that the larger the pix-step, the fewer pixels that are being sampled for changes. If you are trying to detect small objects then you'll want that setting lower so your subject's motion isn't changing between sampled pixel areas.
  • Reg Mode (0-no, 1-incl, 2-excl) - Default=0 -
You may want to also play with excluding rows of sample area. This too can speed things up if the routine has fewer cells to compare between frames. The defaults are set so the whole [FOV Field Of View] is being used. Set the "Reg Mode" setting to 2 (or 1) to exclude the number of "Rows to Exclude" setting from the sampling area. (Or to include, to use only those rows, if you use a Reg Mode value of 1).
  • Measure Mode (1-y, 0-U, 2-V) - Default=1 -
  • Fast Shoot (0=N 1=Y) - Default=1 -