Last active
December 15, 2015 13:49
-
-
Save michilehr/5270336 to your computer and use it in GitHub Desktop.
JimFlowCam with shoot on motion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--[[ | |
Copyright (C) [2013] [Michi Lehr] | |
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. | |
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. | |
You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>. | |
@title JimFlowCamMotion | |
--]] | |
require "disk" | |
a=6 -- columns to split picture into | |
b=6 -- rows to split picture into | |
c=1 -- measure mode (Y,U,V R,G,B) <96> U=0, Y=1, V=2, R=3, G=4, B=5 | |
d=300000 -- timeout (mSec) | |
e=200 -- comparison interval (msec) | |
f=5 -- threshold (difference in cell to trigger detection) | |
g=1 -- draw grid (0=no, 1=yes) | |
h=0 -- not used in LUA | |
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) | |
count = 1 | |
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 | |
local imageList = disk.filterImageFiles("IMG") | |
local fileCount = table.getn(imageList) | |
local i = 0 | |
while i ~= fileCount do | |
i = i + 1 | |
os.remove(imageList[i]) | |
end | |
shoot() | |
count = count + 1 | |
end | |
if (count % 10 == 0) then | |
poke(0xC0220018,0x44) | |
sleep(1000) | |
poke(0xC0220018,0x46) | |
sleep(5000) | |
end | |
until (false) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment