supplierdeeply

Motion Detection too slow?

  • 242 Replies
  • 100226 Views
  • Publish
    Re: Motion Detection too slow?
    « Reply #110 on: 06 / February / 2008, 16:29:30 »
    Advertisements
    it works as sleep command.
    sleep blocks execution of commands until timeout
    the same with md_detect_motion

    The whole line acts as a sleep command? It sits there sleeping for the duration of the timeout setting?

    Or does it sleep on that line during the timeout setting, and then if it detects motion it stops sleeping no matter what the timeout setting is?

    I can't figure it out from your hints.

    For the last 5 hours I've been trying various things by using my own sleep cycles instead of the ones you have built into that md command, thinking if I bypass yours then it'll finally make sense. But if I put the timeout to 0 or 1, then I get even longer delays. None of this is making sense. (literally months of people's time wasted in trying to write scripts, just because you won't fully explain it)


    It's not that difficult.
    The md_detect_motion function blocks execution of the statements that follow, and releases control in 2 cases
    1. if motion is detected
    2. if the time-out period (x) is exceeded
    and then the next lines of the ubasic code are executed.
    When md_detect_motion is called, for the duration of the Trigger Delay (e) it just sleeps,
    after drawing the grid, so you can move your camera around to get the grid in the right position.
    When you want to avoid continuous shooting using the Trigger Delay, you can just as well use
    a sleep command before calling md_detect_motion.

    Now, experience shows that the direct shooting option (j=1) is faster than shooting
    yourself (j=0) when the changes from mx3 of GrAnd are applied to the MD code.
    Using the `single' buffer or the '3' buffer approach did not make much difference for me,
    the last is more consistent in timing, but on average is not faster, and may
    give rise to `continuous' shooting. The shortest code is as follows

    @title MD LightningA
    @param a Columns
    @default a 6
    @param b Rows
    @default b 4
    @param c Threshold (0-255)
    @default c 10
    @param d Compare Interval (millisecs)
    @default d 0
    @param e Trigger Delay (0.1 secs)
    @default e 1
    @param f Time-out period (s)
    @default f 3600
    @param g Pix-Step(speed/accuracy adj)
    @default g 6
    @param i Measure Mode(1-Y,0-U,2-V)
    @default i 1
    @param j Direct Shoot (0=N 1=Y)
    @default j 1
    e=e*100
    print ">[";a;",";b;"] threshold: ";c
    x=f*1000
    while 1
      press "shoot_half"
      md_detect_motion a, b, i, x, d, c, 1, t, 0, 1, 1, a, 0, j, g, e
      if j=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

    When x is large enough there is no need to set or test for t, md_detect_motion only exits for case 1 above.
    Setting x=0 will not give you infinite time out, for that you need to modify the MD code.
    The testing of prop_id 205/206 is to check if shooting is finished, so Trigger Delay (e) can be choosen small.
    This takes care of the effects of exposure time etc, so those variations a accounted for. What is not taken
    care of is the viewport dynamics, e.g., setting the right amplification. For me .1s works in bright conditions,
    when there is not much light you need to increase e, but e should not have any influence on the delay between
    detection of motion and taking a picture. Between exiting and entering again of md_detect_motion (including the
    Trigger Delay period), you are not able to detect any motion. So keep e small.

  • Publish
    Re: Motion Detection too slow?
    « Reply #111 on: 06 / February / 2008, 17:01:40 »
    Hi everybody,
    I added mx3 changes to s3is and (kdb and viewport mod's).
    Found the following address by dumping
    void *vid_get_viewport_live_fb()
    {
       void **fb=(void **)0x54e8;
       return fb[ *((unsigned char*)0x54f8) ];
    //    return (void*)0;
    }

    Think Barney has a s3 so here is a link to the build (based on latest trunk)
    http://hem.passagen.se/fsmmal/CHDK/fingalo-s3is-100a-21.zip
    I tested with Barneys modded script with setting for Fast Shoot parameter setting, only some basic test, feels fast.
    Wasn't allowed to throw kids or what the standard test now was :)


  • Publish
    Re: Motion Detection too slow?
    « Reply #112 on: 06 / February / 2008, 17:07:24 »
    Deleted
    « Last Edit: 22 / April / 2008, 10:28:29 by Barney Fife »
    [acseven/admin commented out: please refrain from more direct offensive language to any user. FW complaints to me] I felt it imperative to withdraw my TOTAL participation. Nobody has my permission, nor the right, to reinstate MY posts. Make-do with my quoted text in others' replies only. Bye

  • Publish
    Re: Motion Detection too slow?
    « Reply #113 on: 06 / February / 2008, 17:12:28 »
    Fingalo, did you also do mx3's following changes? My A610 is now getting sub-100ms almost consistently. I think the S3 is faster so with those changes Barney should be laughing since he's already getting 60ms.

    my changes where

    kbd.c

    void md_kbd_sched_immediate_shoot(){
     kbd_int_stack_ptr-=1;// REMOVE MD ITEM

    // reversed
       kbd_sched_release(KEY_SHOOT_FULL);
       kbd_sched_delay(20);
      KBD_STACK_PUSH(SCRIPT_MOTION_DETECTOR); // it will removed right after exit from this function

    // not a stack operation... pressing right now
       kbd_key_press(KEY_SHOOT_FULL);

    }


    motion_detector.c

    void md_kbd_sched_immediate_shoot();


             if( ( motion_detector.parameters&MD_DO_IMMEDIATE_SHOOT ) !=0){
                //make shoot
    //            kbd_sched_shoot();
                md_kbd_sched_immediate_shoot();
             }




  • Publish
    Re: Motion Detection too slow?
    « Reply #114 on: 06 / February / 2008, 17:14:51 »
    Barney what have you got the "Trigger Flash Time" of the test app set to?

  • Publish
    Re: Motion Detection too slow?
    « Reply #115 on: 06 / February / 2008, 17:22:43 »
    Deleted
    « Last Edit: 22 / April / 2008, 10:28:54 by Barney Fife »
    [acseven/admin commented out: please refrain from more direct offensive language to any user. FW complaints to me] I felt it imperative to withdraw my TOTAL participation. Nobody has my permission, nor the right, to reinstate MY posts. Make-do with my quoted text in others' replies only. Bye

    *

    Offline fudgey

    • *****
    • 1705
    • a570is
  • Publish
    Re: Motion Detection too slow?
    « Reply #116 on: 06 / February / 2008, 17:50:15 »
    rem the next loop is endless if AE lock is activated, use 205 for DigiII
      do
        get_prop 206 p
      until p<>1

    Thanks anonymous, that indeed seems to stop exposure time from affecting the required trigger delay (a570is, Allbest #16, altered my own script).

    Changing from ISO 200 to ISO400 or higher or enabling RAW are still among things that require higher trigger delay. Forcing a high limit on auto ISO (like suggested here http://chdk.setepontos.com/index.php/topic,372.0.html would be quite useful here I think.

    But what does your warning "loop is endless if AE lock is activated" mean (I'm assuming AE is auto exposure, but is AE lock something found in other cameras?).

  • Publish
    Re: Motion Detection too slow?
    « Reply #117 on: 06 / February / 2008, 17:53:19 »
    Deleted
    « Last Edit: 22 / April / 2008, 10:29:14 by Barney Fife »
    [acseven/admin commented out: please refrain from more direct offensive language to any user. FW complaints to me] I felt it imperative to withdraw my TOTAL participation. Nobody has my permission, nor the right, to reinstate MY posts. Make-do with my quoted text in others' replies only. Bye


  • Publish
    Re: Motion Detection too slow?
    « Reply #118 on: 06 / February / 2008, 18:01:59 »
    I changed and took away the viewport mod only keeping kbd changes. Now it has faster response...
    http://hem.passagen.se/fsmmal/CHDK/fingalo-s3is-100a-22.zip.
    Confusing :blink:

  • Publish
    Re: Motion Detection too slow?
    « Reply #119 on: 06 / February / 2008, 18:11:57 »
    I changed and took away the viewport mod only keeping kbd changes. Now it has faster response...
    Same here.

    Either way, this is almost to the point of being perfect for lightning capture.

    Barney, I'm almost finished MD_TestV3. I need to know what you think about an Opengl version? I'm interested in disabling vsync to see what happens. Since I'm making the total time interval user-adjustable it may give better timing. But there's still the problem of the camera needing enough time to get a visible exposure of the bars.

     

    Related Topics