Time Lapse and Motion Detection combined? - Script Writing - CHDK Forum supplierdeeply

Time Lapse and Motion Detection combined?

  • 8 Replies
  • 6882 Views
Time Lapse and Motion Detection combined?
« on: 02 / March / 2011, 05:43:04 »
Advertisements
Hi,

Is there already existing a script which combines time lapse and motion detection?
Purpose is that I would like to observe what happens in my summer cottage during winter.
Camera would take picture once in ten minutes and also if it detects motion.
(I use eye.fi card to upload pictures to my ftp-server => I will need means to automatically delete older pictures..)

Any ideas?

T:Nipo

Re: Time Lapse and Motion Detection combined?
« Reply #1 on: 02 / March / 2011, 17:56:45 »
I'm also interested.
I would use it for making timelapse vids of t-storms and caputre lightnings at the same time.

Re: Time Lapse and Motion Detection combined?
« Reply #2 on: 02 / March / 2011, 19:39:52 »
Is there already existing a script which combines time lapse and motion detection?

No.
The motion-detection feature would need modifying to take photos at regular intervals.
Interesting idea, may play around with it.

Quote
I will need means to automatically delete older pictures..)

Earlier Eye-fi cards required the camera to be reset.
After an SDM tester complained about this they are meant to have fixed that 'problem'.

Apparently there are still problems.

I cannot find the testers email of a few days ago it seems to have been deleted and bounced.

I will contact him.


*

Offline fudgey

  • *****
  • 1705
  • a570is
Re: Time Lapse and Motion Detection combined?
« Reply #3 on: 03 / March / 2011, 12:52:32 »
Should be a very easy modification -- just set MD timeout to 10 minutes and add a shoot command in the end of the MD loop so that the camera shoots after each MD timeout before re-arming MD.


Re: Time Lapse and Motion Detection combined?
« Reply #4 on: 04 / March / 2011, 10:11:46 »
I'm also interested.

What cameras and firmware versions do you both have ?


*

Offline Edgel

  • *
  • 22
Re: Time Lapse and Motion Detection combined?
« Reply #5 on: 04 / July / 2011, 05:26:45 »
I've modified the mdfb-080914 script so that the camera shoots after each MD timeout, as suggested by fudgey. It seems to work as intended. It would be nice to also have shutter speeds longer than 1s at night but I don't know exactly how to do this. Combining yass02 with the MD script gives no success. Any suggestions? Anyway, here is a version of the MD script where the camera takes a picture every ten minutes and also if it detects motion ( added a shoot command in the "fast_md_loop"):

Code: [Select]
rem Fudgey's Fast/Slow/Video Motion Detector with masks. For models with no video button.
rem See MDFB-080914.txt for documentation.
rem Trunk autobuild 509 or higher (or compatible) required.
@title Fast MD 110703

@param a Columns
@default a 6
@param b Rows
@default b 4
@param c Threshold (0-255)
@default c 10
@param g Burst/Review/Video time (s)
@default g 0
@param d Compare Interval (ms)
@default d 7
@param h Pixel Step (pixels)
@default h 6
@param f Channel (0U,1Y,2V,3R,4G,5B)
@default f 1
@param n Timeout (10s of seconds)
@default n 60
@param e Trigger Delay (0.1 sec)
@default e 5
@param i Masking (0=No 1=Mask 2=Use)
@default i 0
@param j -      Mask Columns Left
@default j 0
@param k -      Mask Columns Right
@default k 0
@param l -      Mask Rows    Top
@default l 0
@param m -      Mask Rows    Bottom
@default m 0
@param o Shoot fast=0,slow=1,test=2
@default o 0

if a<1 then a=1
if b<1 then b=1
if i<0 then i=0
if i>2 then i=2
if j<0 then j=0
if k<0 then k=0
if l<0 then l=0
if m<0 then m=0
if j>a then j=a
if k>a then k=a
if l>b then l=b
if m>b then m=b
if g<0 then g=0
if f<0 then f=1
if f>5 then f=1
if f=0 then print "Channel: U chroma"
if f=1 then print "Channel: Luminance"
if f=2 then print "Channel: V chroma"
if f=3 then print "Channel: Red"
if f=4 then print "Channel: Green"
if f=5 then print "Channel: Blue"
if n<1 then n=1
e=e*100
g=g*1000
n=n*10000

P=get_video_button
if P=1 then goto "VideoButtonError"

P=get_mode
if P=1 then goto "PlayModeError"
rem get_mode returns 2 if a we are in video mode (and the camera has no video button)
if P=2 then p=1 else p=0

P=get_flash_mode
if P=2 then goto "SkipFlashWarning"
  print "WARNING: Flash is not"
  print "disabled. May cause  "
  print "odd behavior.        "
:SkipFlashWarning

if o=0 and p=1 then goto "fast_video_md"
if o=1 and p=1 then goto "slow_video_md"
if o=1 and p=0 then goto "slow_md"
if o=2 then goto "test_md"

print "Fast react photo MD"
:fast_md_loop
  t=0
  do
    shoot
    release "shoot_half"
    press "shoot_half"
    do
      P=get_shooting
    until P=1
    md_detect_motion a, b, f, n, d, c, 1, t, i, j+1, l+1, a-k, b-m, 9, h, e
  until t>0
  let X=get_tick_count
   
  :contloop1
    let U=get_tick_count
    let V=(U-X)
    if V<g then goto "contloop1"
  release "shoot_full" 
  release "shoot_half"
  do
    P=get_shooting
  until P<>1
goto "fast_md_loop"

:slow_md
print "Slow react photo MD"
:slow_md_loop
  t=0
  do
    md_detect_motion a, b, f, n, d, c, 1, t, i, j+1, l+1, a-k, b-m, 0, h, e
  until t>0
  if g>0 then goto "contshoot2" else shoot
  goto "slow_md_loop"
  :contshoot2
  press "shoot_full"
  let X=get_tick_count
  :contloop2
    let U=get_tick_count
    let V=(U-X)
    if V<g then goto "contloop2"
  release "shoot_full"
  release "shoot_half"
  do
    P=get_shooting
  until P<>1
goto "slow_md_loop"

:fast_video_md
if g<1 then g=1000
print "Fast react video MD"
:fast_video_md_loop
  t=0
  do
    release "shoot_half"
    press "shoot_half"
    sleep 1000
    md_detect_motion a, b, f, n, d, c, 1, t, i, j+1, l+1, a-k, b-m, 9, h, e
  until t>0
  rem press "shoot_full" was done by md_detect_motion
  print "starting video record" 
  sleep 300
  release "shoot_full"
  let X=get_tick_count
  :fastvideowaitloop
    let U=get_tick_count
    let V=(U-X)
    if V<g then goto "fastvideowaitloop"
  click "shoot_full"
  print "ending video record"
  rem Need to wait or shoot_half won't work and loop will work like slow react loop:
  sleep 1000
goto "fast_video_md_loop"

:slow_video_md
if g<1 then g=1000
rem Focusing takes time => add a second to make length argument a bit more accurate.
g=g+1000
print "Slow react video MD"
:slow_video_md_loop
  t=0
  do
    md_detect_motion a, b, f, n, d, c, 1, t, i, j+1, l+1, a-k, b-m, 0, h, e
  until t>0
  press "shoot_full"
  sleep 300
  release "shoot_full"
  print "starting video record" 
  let X=get_tick_count
  :slowvideowaitloop
    let U=get_tick_count
    let V=(U-X)
    if V<g then goto "slowvideowaitloop"
  click "shoot_full"
  print "ending video record"
goto "slow_video_md_loop"

:test_md
  print "MD test, no shooting."
  N=0
:test_md_loop
  t=0
  do
    md_detect_motion a, b, f, n, d, c, 1, t, i, j+1, l+1, a-k, b-m, 0, h, e
  until t>0
  N=N+1
  print t, "cells, trigger ", N
goto "test_md_loop"

:PlayModeError
  print "MDFB script ERROR:"
  print "Not in REC mode, exiting."
end

:VideoButtonError
  print "MDFB script ERROR:"
  print "Incompatible camera! Try"
  print "MDFB VideoButtonModels"
  print "version."
end



Powershot A570IS

Re: Time Lapse and Motion Detection combined?
« Reply #6 on: 07 / July / 2011, 06:15:23 »
It would be nice to calculate, how long should be next timeout, if MD shot something.

For example if you like to shoot every 10 mins and 4 minutes after last timelapse shoot camera shoot as MD, next timeout should be 6 minutes, to keep 10 intervals between timelapse shoots. Of course in a case you need equal delays between timelapse shoots.

This could be done somehow by get_tick_count() or something.
if (2*b || !2*b) {
    cout<<question
}

Compile error: poor Yorick

*

Offline Edgel

  • *
  • 22
Re: Time Lapse and Motion Detection combined?
« Reply #7 on: 16 / July / 2011, 20:32:56 »
I thought the version of the script i posted did that, at least it seemed to work when I tested it. But feel free to improve the script.
Powershot A570IS


Re: Time Lapse and Motion Detection combined?
« Reply #8 on: 22 / August / 2011, 04:53:32 »
I have used a script called "carlapse" and it worked very well. Been over a year since i've used it. If memory serves me it was written for the pupose of doing a time lapse in car, and when he would stop at a stop light or similar situation where there was no movement, it would stop taking pictures until it sensed movement again.

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal