Generic Tracking Patch
Create a standard output from Motion which is easy to interface to for a program that controls a PTZ type camera.
Description of Patch
The feature will at first be implemented using a combination of:
- Extended Conversion Specifiers
- Center X = %K (pixels from upper left corner)
- Center Y = %L (pixels from upper left corner - a bit odd)
- Motion area width %i (pixels)
- Motion area height %J (pixels)
- Generic tracking mode (4)
- on_motion_detected (new on_xxxx function)
The status is:
- Extended conversion specifiers are 100% implemented.
- Generic tracking mode 4 is implemented.
- on_motion_detected is implemented
These changes are released in 3.2.1!
The first external program to run with on_motion_detected will be for a PTZ-2N camera.
I have written a C program which can manually control the camera.
The next step will be to re-write this so that it turns the camera based on the coordinates received from
on_motion_detected motionptz %K %L %i %J
I still do not consider this closed because I will need to implement this so that I can connect real time between Motion and a tracker program. The shell execution will not be fast enough for all usage.
Installation of Patch
The development of this patch is a little stalled because the camera I got as a present has burned and will not turn right anymore. I will attempt to repair it. If I fail I will get a new camera.
- 26 Jun 2005
The way to communicate with an external program should be through a socket.
- Should Motion try and connect to the camera control program?
- Or should the camera control program connect to Motion?
I have not made up my mind yet.
I can imagine the latter as better since otherwise it may be difficult to get Motion started since everything else must be setup and ready.
It could be a simple matter of creating a port from which the client gets simple text lines of information when Motion is detected. If we make it very generic such an interface can be used for many things.
The advantage of Motion connecting to the tracking program could be security. We know who we connect to. With Motion having yet another open port we need to consider security.
- 13 Aug 2005
I'm not convinced security is a primary concern . . . motion detectors and camera drivers will be on the same network . . . IMHO motion should be the 'server' and arbitrary clients should be allowed to connect . . . easier for motion, wasier for the camera controller . . . simpler to restart the whole system . . .
I think all you need is motion center (x,y) and size . . . size lets you zoom the cam (is possible) . . .
next thing is to modify the x,y centre based on the 2 dimensional vector of motion . . . so that the cam is pointing at the cause of the motion, not the effect . . .
- 13 Aug 2005
I am very interested in your project. I have made a socket based deamon in perl to control the TrackerPod
Pan/Tilt platform. The idea beeing that the "camera" should do as told - be it from motion, the web or something else.
I made it under supervision of Derrick Parkhurst: http://hcvl.hci.iastate.edu/trackerpoddev/
Extract from README
Second, TrackerStream will open up the appropriate port on the
local or remote host for streaming piped commands.
The syntax for executing TrackerStream is:
where the options are:
-h host : host name
-p port : port number
Example: cat test.cmd | TrackerStream -h remote
Example: echo "Move 5 -15" | TrackerStream -h remote
Example: TrackerStream -h remote <<EOF # Move two TrackerPod's i(0 and 1)
Move 20.0 20.0 0
Move 20.0 20.0 1
# Control Compass Arrows
Led1 UP ON 0
Led1 RIGHT ON 0
Led1 DOWN ON 1
Led1 LEFT ON 1
# Relax the TrackerPod
NB! There has to be a transformation from observation coordinates to camera positioning coordinates. It will often not be the same.
Rgds (please reply - I would love to to have a talk)
Henrik Lassen, mail: hla at folkeferie dot dkdkdkdk as in denmark-dk
- 06 Sep 2005
I would like to have one wide angle camera that sees the entire area. It detects motion and then directs a PTZ camera to move to that area for a close-up shot.
- 12 Nov 2008