| 1 | @title mddemov1 |
|---|
| 2 | |
|---|
| 3 | @param a Columns |
|---|
| 4 | @default a 8 |
|---|
| 5 | |
|---|
| 6 | @param b Rows |
|---|
| 7 | @default b 6 |
|---|
| 8 | |
|---|
| 9 | @param c Threshold (0-255) |
|---|
| 10 | @default c 10 |
|---|
| 11 | |
|---|
| 12 | @param d compare Interval (millisecs) |
|---|
| 13 | @default d 80 |
|---|
| 14 | |
|---|
| 15 | @param e Begin Triggering Delay(secs) |
|---|
| 16 | @default e 20 |
|---|
| 17 | |
|---|
| 18 | @param f Detect Timeout (seconds) |
|---|
| 19 | @default f 30 |
|---|
| 20 | |
|---|
| 21 | @param g pix step(speed/accuracy adj) |
|---|
| 22 | @default g 8 |
|---|
| 23 | |
|---|
| 24 | @param h reg mode(0-no,1-incl,2-excl) |
|---|
| 25 | @default h 2 |
|---|
| 26 | |
|---|
| 27 | @param i measure mode(1-Y,0-U,2-V) |
|---|
| 28 | @default i 1 |
|---|
| 29 | |
|---|
| 30 | |
|---|
| 31 | if a<1 then let a=1 |
|---|
| 32 | if b<1 then let b=1 |
|---|
| 33 | if c<0 then let c=0 |
|---|
| 34 | if g<1 then let g=1 |
|---|
| 35 | if f<1 then let f=1 |
|---|
| 36 | |
|---|
| 37 | let f=f*1000 |
|---|
| 38 | let e=e*1000 |
|---|
| 39 | |
|---|
| 40 | |
|---|
| 41 | print_screen 1 |
|---|
| 42 | |
|---|
| 43 | print ">[";a;",";b;"] threshold: ";c |
|---|
| 44 | |
|---|
| 45 | for z=0 to 10000 |
|---|
| 46 | |
|---|
| 47 | let t=0 |
|---|
| 48 | |
|---|
| 49 | rem /--/-columns, rows to split picture into |
|---|
| 50 | rem | | |
|---|
| 51 | rem | | measure mode (Y,U,V R,G,B) - U-0, Y-1, V-2, 3-R, 4-G, 5-B |
|---|
| 52 | rem | | | |
|---|
| 53 | rem | | | timeout |
|---|
| 54 | rem | | | | comparison interval (msec) |
|---|
| 55 | rem | | | | | threshold ( difference in cell to trigger detection) |
|---|
| 56 | rem | | | | | | draw_grid (0-no, 1-yes) |
|---|
| 57 | rem | | | | | | | return variable. number of cells with motion detected |
|---|
| 58 | rem | | | | | | | | |
|---|
| 59 | rem | | | | | | | | VVVVVV OPTIONAL PARAMETERS: VVVV |
|---|
| 60 | rem | | | | | | | | |
|---|
| 61 | rem | | | | | | | | region (masking) mode: 0-no regions, 1-include, 2-exclude |
|---|
| 62 | rem | | | | | | | | | region first column |
|---|
| 63 | rem | | | | | | | | | | region first row |
|---|
| 64 | rem | | | | | | | | | | | region last column |
|---|
| 65 | rem | | | | | | | | | | | | region last row |
|---|
| 66 | rem | | | | | | | | | | | | | parameters- 1-make immediate shoot, 2-log debug information into file. OR-ed values are accepted |
|---|
| 67 | rem | | | | | | | | | | | | | | pixels step - speed vs. Accuracy adjustments (1-use every pixel, 2-use every second pixel, etc) |
|---|
| 68 | rem | | | | | | | | | | | | | | | number of milliseconds to wait before begin triggering - can be useful for calibration with "draw_grid" option |
|---|
| 69 | rem | | | | | | | | | | | | | | | | |
|---|
| 70 | rem V V V V V V V V V V V V V V V V |
|---|
| 71 | md_detect_motion a, b, i, f, d, c, 1, t, h, 2, 2, a-1, b-1, 0, g, e |
|---|
| 72 | |
|---|
| 73 | rem <minimal variables set> |
|---|
| 74 | rem md_detect_motion a, b, i, f, d, c, j, f |
|---|
| 75 | |
|---|
| 76 | rem if t>0 then shoot |
|---|
| 77 | |
|---|
| 78 | if t>0 then print "detected cells:",t else print "Timeout" |
|---|
| 79 | |
|---|
| 80 | next z |
|---|
| 81 | |
|---|
| 82 | |
|---|
| 83 | end |
|---|