Motion Detection: What exactly does grid size do? - General Discussion and Assistance - CHDK Forum supplierdeeply

Motion Detection: What exactly does grid size do?

  • 5 Replies
  • 3788 Views
Motion Detection: What exactly does grid size do?
« on: 18 / January / 2013, 17:25:31 »
Advertisements
The default grid size is 3x3, and I understand how the grid can be used to exclude/include specific areas of the image for motion detection, but what I'm not clear about is if the grid size (number of columns and rows) has any affect at all on detection if I'm not using exclusion/inclusion. I see a good explanation of how to change the grid size, but not for why I might want to.

In other words, if I'm using the entire image area for motion detection, does the grid size itself have any impact on detection? If all other settings are the same, does a 3x3 grid behave any differently at all from a 6x6 or 9x9 grid? Is there any reason to not use a 1x1 grid? Why default to 3x3?

*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: Motion Detection: What exactly does grid size do?
« Reply #1 on: 18 / January / 2013, 18:25:16 »
The default grid size is 3x3, and I understand how the grid can be used to exclude/include specific areas of the image for motion detection, but what I'm not clear about is if the grid size (number of columns and rows) has any affect at all on detection if I'm not using exclusion/inclusion. I see a good explanation of how to change the grid size, but not for why I might want to.

In other words, if I'm using the entire image area for motion detection, does the grid size itself have any impact on detection? If all other settings are the same, does a 3x3 grid behave any differently at all from a 6x6 or 9x9 grid? Is there any reason to not use a 1x1 grid? Why default to 3x3?

One large cell won't necessarily capture motion as accurately.

The code calculates an 'average' value for each cell then compares the values to the previous iteration to detect changes.

One cell averages the entire image into a single value so the overall image value might not change even though something is moving in the frame. It will probably detect something new entering the image; but may not see movement of an existing object.

Lots of small cells can detect movement between cells; but takes slightly more time to compare the results and to draw the on screen grid.

Note: columns x rows must be <= 1024

Phil.
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)

Re: Motion Detection: What exactly does grid size do?
« Reply #2 on: 18 / January / 2013, 19:21:02 »
Thanks for the reply!

I think I understand now. So given the same threshold setting, using more cells will generally notice smaller movements and so the grid size does have a very direct impact on detection.

Is there any significant performance penalty for using larger grids? I'm guessing that there's more computational latency as the number of cells increases?

Re: Motion Detection: What exactly does grid size do?
« Reply #3 on: 18 / January / 2013, 19:59:46 »
Is there any significant performance penalty for using larger grids? I'm guessing that there's more computational latency as the number of cells increases?
Somewhere in the wiki or forum there is a note about the Comparison Interval parameter and how making it too short will degrade camera performance.  Certainly the number of grid cells affects performance too.  The pixel step size parameter matters as well. 

Unfortunately,  the MD scripting stuff gives lots of options so figuring out what's best for your situation can be tricky.

However, if you want your camera to detect motion, making other camera functions slow by boosting MD performance seems like a fair trade off.

So the short answer to your questions if probably "Try it and see. Its easy to experiment".

Don't know if you've had a moment to look at this :  http://chdk.wikia.com/wiki/Motion_Detection

and these threads :

http://chdk.setepontos.com/index.php?topic=7746.0
http://chdk.setepontos.com/index.php?topic=471.0
http://chdk.setepontos.com/index.php?topic=405.240



« Last Edit: 18 / January / 2013, 20:01:38 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16


Re: Motion Detection: What exactly does grid size do?
« Reply #4 on: 18 / January / 2013, 20:29:41 »
Thanks. Yes, I've seen the MD page in the wiki and I've been testing the motionp script for a couple days. My question about the grid size was prompted because I've been having to set the detection threshold to 1 or 2 to get it to trigger in sunlight, although the suggestion was that 12 should work well although for most of my tests I could walk right through the frame without triggering it! :blink: I've been trying to find a threshold where it is sensitive enough to trigger reliably yet not keep firing once it's been triggered. Increasing the number of cells is helping, I'm having some luck with a threshold of 5 in sunlight using a 9x6 grid. I didn't get from the wiki how the cells worked so now that I understand I'm having better results.

I'm very interested to try the fast MS scripts intended specifically for lightning, we haven't had any here in a few years so I'm hoping we're due for some this year! :)

Re: Motion Detection: What exactly does grid size do?
« Reply #5 on: 18 / January / 2013, 20:32:58 »
I've been trying to find a threshold where it is sensitive enough to trigger reliably yet not keep firing once it's been triggered.
I have a couple of ideas on how to improve the detection code - some sort of automatic gain control coupled with a different threshold detection algorithm.  Its on my list of things to play with - just haven't gotten to it yet.

Ported :   A1200    SD940   G10    Powershot N    G16

 

Related Topics