Motion Detection - page 2 - General Discussion and Assistance - CHDK Forum

Motion Detection

  • 24 Replies
  • 6304 Views
*

Offline philmoz

  • *****
  • 3332
    • Photos
Re: Motion Detection
« Reply #10 on: 18 / November / 2011, 14:34:17 »
Advertisements
The a550 does have vid_get_viewport_live_fb.

EXACTLY how is this location found on various cameras ?

Brute force mostly for the ones I've done.

The method that has given me the best results is to add code to the start of gui_draw_debug_vals_osd to search the RAM from 0x1900 to where CHDK starts looking for the viewport buffer address (from vid_get_viewport_fb).
I display the list of addresses found, although you could also write them to a file.

I then plug these address into vid_get_viewport_live_fb as the source of the live buffer and run MD tests using http://dataghost.com/chdk/md_meter.html. The one that gives the best results consistently is then used.

There should be a better way to find this; but I haven't figured out how it works in the firmware yet.

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
« Reply #11 on: 18 / November / 2011, 22:09:26 »
Brute force mostly for the ones I've done.

In that case, as you need to have the camera available, I will politely decline any testers who ask if it could be 'implemented' to speed-up motion detection.

David

Re: Motion Detection
« Reply #12 on: 18 / November / 2011, 22:23:33 »
In that case, as you need to have the camera available, I will politely decline any testers who ask if it could be 'implemented' to speed-up motion detection.
I can understand that.  Although it sounds like more of an SDM development model issue than a CHDK issue. You could always point them back to the CHDK forum where the original CHDK code for their cameras was developed and have them ask there ?

Ported :   A1200    SD940   G10    Powershot N    G16

Re: Motion Detection
« Reply #13 on: 02 / December / 2011, 10:41:44 »
Hello again!

Well, I've buyed the a550, that will work just fine to my purposes... I've installed the CHDK successfully, and tried the motion detection, loading it in the script menu. So far, so good. Only one problem now... When i load the script, i press the button to start, the script does start. And it keeps loaded until there is motion. But when there is motion, a photo is taken and the script finishes. Is it possible to the script to keep on going and take as much as photos as possible? Lets imagine that i leave the camera in the woods and a squirrel or a bird come to where i want... If the animal moves too quickly the photo wont get the animal in its frame, and the script will shut down. I wanted to start the script manually (with the button pressed) but not finished automaticly (would prefer to finish it by pressing the button again).

Thank you


Re: Motion Detection
« Reply #14 on: 02 / December / 2011, 11:37:39 »
Only one problem now... When i load the script, i press the button to start, the script does start. And it keeps loaded until there is motion. But when there is motion, a photo is taken and the script finishes. Is it possible to the script to keep on going and take as much as photos as possible?
What script are you using ?  There are many out there and most of them loop continuously just as you requested.

Ported :   A1200    SD940   G10    Powershot N    G16

Re: Motion Detection
« Reply #15 on: 02 / December / 2011, 13:08:30 »
How can i see that?

I load a motion.lva, from the directory: A/CHDK7SCRIPTS/4PACK/LUA

Can you indicate me a script that loop continuously?

Thank you

Re: Motion Detection
« Reply #16 on: 02 / December / 2011, 13:33:09 »
I load a motion.lva, from the directory: A/CHDK7SCRIPTS/4PACK/LUA

Can you indicate me a script that loop continuously?

Here's the same script with a loop added. Save it as motion2.lua on your SD card :
Code: [Select]
--[[
@title 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=300000    -- 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=0         -- triggering delay (msec)

repeat
zones = md_detect_motion( a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p)

if( zones > 0 ) then
shoot()
end
until ( false )


Other links :

http://chdk.setepontos.com/index.php?topic=471.0
http://chdk.wikia.com/wiki/UBASIC/Scripts:_Multipurpose_Motion_Detection
http://chdk.wikia.com/wiki/UBASIC/Scripts:_Universal_motion_detection

etc etc etc

« Last Edit: 02 / December / 2011, 18:49:44 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Motion Detection
« Reply #17 on: 02 / December / 2011, 14:09:27 »
I just loaded that script, and after taking one pic, it ends the script not repeating...


Re: Motion Detection
« Reply #18 on: 02 / December / 2011, 18:51:41 »
I just loaded that script, and after taking one pic, it ends the script not repeating...
Fixed it - dumb C programmer error again.  Please copy from above and try again ?
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Motion Detection
« Reply #19 on: 02 / December / 2011, 19:33:55 »
Well, it starting to function... It repeats, but not when there's motion.

I start the script, it fires with motion detection and the first photo is taken. But then it takes photos continuously, even without MD. Is it possible to: motion - takes one photo - script continues until there's motion again - takes one photo - script continues until there's motion again, and so on?

Thank you for your time!

 

Related Topics