FractalNet
Home Software Music Other
Overview   Overview
Guitar Chord Explorer   GCE
Marble Challenge   Marble Challenge
ASCIIroids   ASCIIroids
Particle System Designer   PSD (Second Life)
Gravity Bubbles   Gravity Bubbles
FractalNet   FractalNet
EcoSim   EcoSim
Cosmic Dust   Cosmic Dust
LandMesh   LandMesh
Imagencrypter   Imagencrypter
Foxy Detector   Foxy Detector
MacDiff   MacDiff
Asteroid Belt   Asteroid Belt
Matrix Attack   Matrix Attack
Solar Swarm   Solar Swarm
Mac OS X Terminal guide   OS X Terminal
Tools   Tools
Names :-)   Names :-)
Foxy Detector

Foxy Detector

Foxy Detector (FD) is a motion detection program which I wrote from scratch in about 850 lines of Java.  It monitors the image from a webcam which is watching our garden, and plays an alert sound whenever it detects a moving object which might be our “Foxy”.  By leaving this program running all day, we can be alerted whenever Foxy visits our garden, without having to keep looking out of the window!


Motion detection

FD loads a new image from the webcam every 5 seconds, and then compares the current image (shown in the New tab) with the previous one (shown in the Old tab).  The difference between the two images is shown in the Diff tab – white indicates difference, black indicates no difference:

Foxy Detector - image differences

Several sensor areas are defined, in which FD will look for moving objects.  Each sensor area is divided into a grid of small square cells, and FD checks the amount of difference in each cell every 5 seconds.  If a cell’s difference is greater than a pre-defined threshold, it’s marked as active, and is drawn in red.

In the images below, Foxy walks into view between the previous and current images (1 and 2).  The difference is calculated (3), and the active cells are drawn in red (4).

Previous image Current image Difference Active cells
1. Previous image 2. Current image 3. Difference 4. Active cells

If the total number of active cells is between two user-defined limits, min cells and max cells, then an alert sound is played, and the event is recorded in the Log tab.  Here, Foxy has activated 32 cells, and since this number lies within the limits of 10 and 80 cells (min and max), the alert sound is played.


Settings

The min cells and max cells limits can be adjusted in the Settings tab:

Foxy Detector - settings

The min cells limit ensures that very small moving objects are ignored.  For example, in the images below, a jay is moving, activating 6 cells.  The jay does not trigger the alert sound, because the min cells limit has been set to 10.

Jay - previous image Jay - current image Jay - difference Jay - active cells


The max cells limit ensures that changes in sunlight brightness are ignored.  For example, in the images below, the sun suddenly goes behind a cloud, and the drop in brightness activates 495 cells.  This does not trigger the alert sound, because the max cells limit has been set to 80.

Sunlight - previous image Sunlight - current image Sunlight - difference Sunlight - active cells


The diff sensitivity control determines how sensitive FD is to differences between the previous and current images:

Difference - low sensitivity Difference - high sensitivity
Difference – low sensitivity Difference – high sensitivity


The contrast and brightness controls can be used to enhance the webcam images during the twilight periods of the day:

Twilight image - original Twilight image - contrast and brightness increased
Twilight image – original Twilight image – contrast and brightness increased


Sensor areas XML file

The sensor areas are defined in a simple XML file, which allows them to be easily modified:

<sensors>
    <sensor>
        <xleft>0</xleft>
        <ytop>330</ytop>
        <cellsacross>30</cellsacross>
        <cellsdown>15</cellsdown>
    </sensor>
    <sensor>
        <xleft>340</xleft>
        <ytop>30</ytop>
        <cellsacross>8</cellsacross>
        <cellsdown>13</cellsdown>
    </sensor>
    <sensor>
        <xleft>445</xleft>
        <ytop>120</ytop>
        <cellsacross>14</cellsacross>
        <cellsdown>7</cellsdown>
    </sensor>
</sensors>


Night vision

We own a camcorder which features a night vision mode with an infrared illumination lamp.  This allows us to obtain night-time pictures of our garden:

Garden with night vision

FD can use these night vision images to detect Foxy visiting our garden at night.


Automatic country lookup for comments powered by hostip.info
Comments

No comments yet.  Be the first to add a comment!


Add a comment

Contact me  –  Page last updated on 7th August 2008  –  Website hosted by 5quidhost (highly recommended!)
Michael Hogg