Motion Detection - Shoot after motion stops

  • 6 Replies
  • 2590 Views
  • Publish
    Motion Detection - Shoot after motion stops
    « on: 12 / July / 2012, 15:14:13 »
    Advertisements
    Hi Everyone!

    I'm working with the DIYBookScanner group. We need a script to watch for motion (i.e. the book pages being flattened against the platen) then shoot images when the motion stops for a second or two (i.e. pages are in place).

    Our book scanners look and operate like this:
    « Last Edit: 12 / July / 2012, 15:20:57 by mellow-yellow »

  • Publish
    Re: Motion Detection - Shoot after motion stops
    « Reply #1 on: 12 / July / 2012, 15:21:56 »
    ... and here is a rough example (not our group) of an interesting approach I'd like to try: Booksorber - Digitize your books (IndieGoGo campaign video)

    The Universal Motion Detection script is close but not quite what we need. Any thoughts on how to modify it or write a simpler version? I confess that I've done no programming in CHDK motion grids, though I can more or less understand what the scripts are doing. :-)

    I haven't tried this suggestion (http://chdk.setepontos.com/index.php/topic,1046.msg9260.html#msg9260) but would it work?

    Thanks in advance!
    « Last Edit: 12 / July / 2012, 15:35:01 by mellow-yellow »

  • Publish
    Re: Motion Detection - Shoot after motion stops
    « Reply #2 on: 13 / July / 2012, 10:47:32 »
    We need a script to watch for motion (i.e. the book pages being flattened against the platen) then shoot images when the motion stops for a second or two (i.e. pages are in place).

    So that's about nine lines of code if you want to do it the easy way. Unless you also want to eliminate false triggers / failure to fire.  You can ignore the former and wave your hand in front of the camera if the later occurs.   Or make the script a lot more sophisticated.

    Code: [Select]
    --[[
    @title Book Scanner Motion Detect
    ]]
    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=5
    d=1000     -- 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 row
    n=0         -- optional parameters  (1=shoot immediate)
    o=2         -- pixel step
    p=500       -- triggering delay (msec)
    repeat
        repeat
            zones = md_detect_motion( a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p)
        until ( zones > 0 )
        repeat
            zones = md_detect_motion( a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p)
        until ( zones == 0 )
        shoot()
    until ( false )

    There will likely be some tuning of the md_detect_motion parameters required regardless.

    Update : program logic changed - should work better this way
    « Last Edit: 13 / July / 2012, 13:15:21 by waterwingz »

  • Publish
    Re: Motion Detection - Shoot after motion stops
    « Reply #3 on: 21 / October / 2012, 23:12:46 »
    This would actually be a good idea for using the camera to take pictures of 8mm home movies. Once the film is advanced one frame, the camera would shoot.

    Now, if only to automate advancing the film frame by frame.  ;)
    « Last Edit: 21 / October / 2012, 23:15:29 by MeBeJedi »


  • Publish
    Re: Motion Detection - Shoot after motion stops
    « Reply #4 on: 22 / October / 2012, 00:12:00 »
    This would actually be a good idea for using the camera to take pictures of 8mm home movies. Once the film is advanced one frame, the camera would shoot.

    Now, if only to automate advancing the film frame by frame.  ;)
    While you could use motion detect,  I suspect that any hardware you could create to move an 8mm projector ahead "frame by frame" could add a USB remote shooting function almost trivially.


  • Publish
    Re: Motion Detection - Shoot after motion stops
    « Reply #5 on: 29 / October / 2012, 13:10:27 »
    I wrote a script for this exact thing four years ago.  Have a look at these:

    http://chdk.setepontos.com/index.php?topic=8303.0
    http://www.seanster.com/archdoco

    The script has all timings set by parameters so with a little trial and error you can fine tune the timing for your particular setup. The various debug modes allow you to do that easily. I can help you with it just let me know.

    --
    Sean
    --
    Sean

  • Publish
    Re: Motion Detection - Shoot after motion stops
    « Reply #6 on: 14 / July / 2013, 16:16:12 »
    I wrote a script for this exact thing four years ago.  Have a look at these:

    http://chdk.setepontos.com/index.php?topic=8303.0
    http://www.seanster.com/archdoco

    The script has all timings set by parameters so with a little trial and error you can fine tune the timing for your particular setup. The various debug modes allow you to do that easily. I can help you with it just let me know.
    I think you meant to the first link to point here :  http://chdk.setepontos.com/index.php?topic=2650

     

    Related Topics