pageauc / track-inout

Windows, Unix, Raspberry Pi program uses opencv and python to track moving objects that enter and leave camera view and cross a vert or horz trigger center line. Can be configured to take an image and log data to a csv file. Includes a standalone web server for viewing image files. At this point it is a demo since it would need more work but the basic operation is functional.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NameError: global name 'LIGHT_TIMER' is not defined

markusvankempen opened this issue · comments

inout.py ver 1.11 Track Enter and Leave Activity using python and OpenCV
Logging to Console per Variable VERBOSE=True
Initializing Pi Camera ....
Press ctrl-c to Quit
Start Tracking Enter Leave Activity ....
Traceback (most recent call last):
File "./inout.py", line 587, in
track()
File "./inout.py", line 405, in track
light_timer = LIGHT_TIMER
NameError: global name 'LIGHT_TIMER' is not defined

Thanks for the feedback. My lack of testing. I modified the code a while back to setup a small student demo for a red/green LED and a servo gate. This was setup as an option since it uses GPIO pins. I have moved the DEVICE_CONTROL_ON vars to config.py and fixed the code and tested, although not with the DEVICE_CONTROL_ON = True setting.
This was just written as a demo for another idea for using motion tracking.

Let me know if you still have problems.
Your Feedback is Appreciated.
Claude ...

Works now .... thank you ... i think we may need to lines to make sure people are entering vs maybe turning around .... anyway very good stuff ... thank you

Actually there are kind of two lines. X_BUF and Y_BUF variables are setup at approx line 133 (webcam and picamera) default is 1/10th of camera width/height. These are used in crossed_x_centerline or corssed_y_centerline depending on orientation of centerline. The value is hard coded to divide by 10 but this could be changed to a variable to be a larger value. Eg divide by 4. Try playing around with this setting. I will change code a little to make divisor a variable. See latest github commit 1.3. Changed from 10 to 5. Motion must pass centerline and then continue past buffer value before timeout before object is counted.

My next project will be to store data in a sqlite3 database, similar to speed-camera. Today I was working with gnuplot to create graphs of hourly counts for the speed camera. Got it working but needs more work to implement into speed camera. sqlite3 could be useful for track-inout.

I will keep your suggestions in mind. The more opencv processing that is done the slower the detection loop gets unless you post process images in a different thread.