Motion Detection too slow? - page 15 - Script Writing - CHDK Forum

Motion Detection too slow?

  • 253 Replies
  • 201416 Views
Re: Motion Detection too slow?
« Reply #140 on: 09 / February / 2008, 05:54:30 »
Advertisements
Yeah sorry I misunderstood your app. You must have vsync disabled in drivers? And I wasn't checking frame rate but how fast the little blocks were being drawn. That is the part that must be fast to time the camera.

*

Offline GrAnd

  • ****
  • 916
  • [A610, S3IS]
    • CHDK
Re: Motion Detection too slow?
« Reply #141 on: 09 / February / 2008, 05:58:44 »
You must have vsync disabled in drivers?
Yes. The vsync is forced to be off in drivers. (I have not so fast video card (NV7600GS) to afford loosing fps in games :))
« Last Edit: 09 / February / 2008, 06:01:03 by GrAnd »
CHDK Developer.

Re: Motion Detection too slow?
« Reply #142 on: 09 / February / 2008, 06:04:03 »
It's ok I just switched off vsync on my crappy 8400gs and it takes only about a second to draw the whole window.

Really wish it was easy to get access to the v/hsync signals from within a Windows app.

*

Offline GrAnd

  • ****
  • 916
  • [A610, S3IS]
    • CHDK
Re: Motion Detection too slow?
« Reply #143 on: 09 / February / 2008, 06:10:20 »
how fast the little blocks were being drawn

4x-6x faster than 1ms. I used high frequency PerformanceCounter for syncing. On my computer it has the resolution 1/2,800,030,000s (as I have the 2.8GHz CPU).
« Last Edit: 09 / February / 2008, 06:34:37 by GrAnd »
CHDK Developer.

*

Offline fudgey

  • *****
  • 1705
  • a570is
Re: Motion Detection too slow?
« Reply #144 on: 09 / February / 2008, 06:56:26 »
About that lag and not being sure which lights it might be triggering on (initial flash or beginning of marquee lights), can you program them so that the first time around 1 is lit at a time, then 2, then 3, etc? Then you could determine how far into the sequence the event things have traveled. Or keep the first one lit the first cycle, then the first 2 remain lit the second pass, etc.

Or maybe I'm not quite understanding why you can't tell what is initiating the motion-detect from which to start taking the time measure.

You probably didn't but that's okay. :D My concern was that my "lightning" might be too puny to always trip the MD threshold, possibly giving a longer lag than a real lightning might. But I already pretty much verified this wasn't the case.

The "problem" I described could of course exist in jonnythe's program as well, but to a lesser extent since his flash is more pronounced than mine (entire screen flashing versus my two LEDs in a corner). I have 10 seconds between two flash sequences, there's no need to alter the sequence from run to run, they can't possibly be mixed up.

My point was that if the motion detection fails to notice the 55 ms (or 20 ms by default in jonnythe's program) flash, it will eventually notice the timing steps and start the process of shooting later. When shooting lightnings, it doesn't really make a difference what the reason for lag variations is (i.e. is it in speed of detection or shutter lag etc.), as long as the total lag is short enough.

But it's important to pinpoint where the lag is to verify which part of the code needs to be looked into the most and to fully understand how this will affect other situations apart from lightnings. Think about shooting something which actually only moves for a really short time like 30 ms. There will be no timing measurement bars or LEDs to trigger from if the motion detect fails to notice the twitch (I can think of setups where MD would be useful for detecting twitches too short to be photographed just to increment a counter on display... but you'd need to be able to rely on MD always detecting a twitch and to rely on it, it's limits need to be determined).

Re: Motion Detection too slow?
« Reply #145 on: 09 / February / 2008, 12:36:23 »
Deleted
« Last Edit: 22 / April / 2008, 10:32:26 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 GrAnd

  • ****
  • 916
  • [A610, S3IS]
    • CHDK
Re: Motion Detection too slow?
« Reply #146 on: 09 / February / 2008, 12:59:53 »
Hmm... I tried both 1.exe and 2.exe from GrAnd's sample programs and timed with a stopwatch, it takes 17 seconds for my computer to draw all 10 (10x10) grids.

1000/17 = 58.8. So, your monitor works on 60Hz. :)
Switch VSync off in your drivers and the rectangles should be drawn faster.
CHDK Developer.

Re: Motion Detection too slow?
« Reply #147 on: 09 / February / 2008, 13:58:19 »
Deleted
« Last Edit: 22 / April / 2008, 10:32:48 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

Re: Motion Detection too slow?
« Reply #148 on: 09 / February / 2008, 16:23:35 »
It won't break anything but it may cause tearing in some games and apps.

Usually the graphics card waits for the vertical retrace signal before updating the frame buffer. With vsync turned off the frame buffer can be updated at any time, even if the monitor is still drawing part of the previous frame. So you might get a situation where the top half of the screen is made up of the previous frame, while the bottom half is from the following frame. I always thought this didn't affect LCD monitors as much since they don't actually "refresh". But apparently it's worse since pixels are always on and it can be noticed more.

BTW Barney, what graphics card do you have in Franky? And driver version?
« Last Edit: 09 / February / 2008, 16:26:05 by jonnythe »

Re: Motion Detection too slow?
« Reply #149 on: 09 / February / 2008, 18:28:42 »
Deleted
« Last Edit: 22 / April / 2008, 10:33:09 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

 

Related Topics


SimplePortal © 2008-2014, SimplePortal