logo Institut für Informatik, Universität Freiburg


Project5: MENSA people counter




Function:

The package has to provide functions for counting and predicting the traffic of people visiting a building (here the MENSA), based on data from a Laser Range Finder (LRF). The idea is to utilize an embedded system (a laptop and a LRF) that returns histograms of counted people via the World Wide Web. The students get
a library that provides function for accessing the LRF’s last N scans (30 scans per second with 500k Baud) and a GUI application (QT) that uses this library and visualizes the current scan in real time.
Furthermore we prepared a Kalman package for tracking objects that were extracted from a scan.


Getting started:
The software package for accesing and visualizing scans from the LRF can be downloaded from CVS repository by the following commands:

$>cvs co mensa
$>cd mensa
$>source env
$>make depend
$>make

This will build the code for visualizing the scan taken from the scanner. To get an idea about the scanner, simply copy the executable to the laptop which you connected to the scanner and type:
   
$>make distprak C=NAME , where NAME is the name of the laptop you connected with the scanner (e.g. vaio3).
   
Then you can execute the code on the laptop by exporting the laptops display to the computer you are working on. Suppose you are working at 'fernando' and the scanner is connected with 'vaio3', then type the following:

fernando>xhost +vaio3
vaio3>setenv DISPLAY fernando:0
vaio3>accSensor/praktikum/praktikum
  
For a documentation of the crystal interface see:
Crystal, the interface for the CS Freiburg Robots, manual




Part I - Object clustering

Function:
It is necessary to discriminate dynamic objects (e.g. people) from static objects (e.g. walls). Therefore the sensor has to be calibrated. Here calibration means to place the sensor in its working environment without dynamic objects and to press a button that causes the package to memorize the reflections (distance and angle) of objects situated in the area. With this information it is then possible to "clean" each scan during operation from static objects.
The next step is then to extract objects (here people) from the cleaned scan. Therefore it is necessary to implement a clustering function that reasonably merges reflections if they belong to the same person.

Implementation:
Implement the following functions for calibration and static object removal:
    void calibrate(Scan scan);
    void removeStaticObjects(Scan scan);

Implement the following function for the clustering of objects, similar as defined in scanner/objectmodeling.c:
    int extractHumanObjects(struct Scan *scan, struct SensorObject *objects);

Use the following data structure to store objects generated by your algorithm from a single scan:
typedef struct
{
   double posX;
   double posY;
   double posTh;
   double d;
   double th;
}SensorObject;

Use the following data structure to store objects generated by your algorithm from all recently (within 100ms) taken scans:
typedef struct
{
   SensorObject sensorObjects[MAX_NUM_SENSOR_OBJECTS];
   int numSensorObjects;
   struct timeval timestamp;
}SensorObjectSet;

Extend the update in scanner/main.cpp in order to draw the detected objects inside the crystal window.

Evaluation:
Demonstration of the approach with people walking on the RoboCup field.



Extension:
Improve the calibration mechanism in that way that it automatically recalibrates the sensor. This can be achieved by keeping a history of distances for each angle over time and counting the frequency of each distance. If the frequency for a distance exceeds a certain threshold, we assume that this is due to a static object and the data structure has to be changed.


Part II - Object tracking

Function:
You have probably seen from the results in part I, that there will be always new objects created after calling extractHumanObjects(). Therefore it seems to be necessary to find the correspondence of objects extracted from scan N with objects extracted from scan N-1. We name such a method 'tracking' since it tracks objects over time. A method which is usually utilized for such problems in robotics is the Kalman filter.


Approach:
Kalman Filter, see:

J.-S. Gutmann, T. Weigel, and B. Nebel. Fast, accurate, and robust self-localization in polygonal environments. In Submitted, 1999.

Kurt Konolige Robot Notes 2001

G. Welch and G. Bishop. An introduction to the kalman filter. Technical Report TR 95-041, University of North Carolina, Department of Computer Science, 1995.

Implementation:
Modify the given algorithm in the directory mensa/kalman in order to work properly with your problem domain. Draw all detected objects inside the crystal window with position, velocity vector and a different color and number if they are recognized as different objects.

Evaluation/Deliverables:
Demonstration of the approach with people walking on the RoboCup field.
Diagrams that indicates the error of counting students over time in the following situations:

  • Students stay without overlapping each other inside the field of view.
  • Students stay with overlapping each other inside the field of view.
  • Students continuously enter without overlapping each other from the left edge of the field of view and exit to the right edge of the field of view.
  • Students continuously enter with overlapping each other from the left edge of the field of view and exit on the right edge of the field of view.



Part III - A Web interface / Embedded system

Function:
Now we want to make use of the people counter for counting people entering a building. At this stage we want to make histograms indicating the traffic of people that were detected by the sensor during the past. The histograms have to be available on the web. Therefore it will be necessary to implement a method for memorizing the counted people at each time unit and methods for query these data with different temporal resolutions (e.g. the last 10 hours or the last 20 minutes).

Implementation:
Implement a thread that continuously updates a data structure that stores the people counted every 30 seconds (and also appends this data continuously to a file).
Implement the following functions to query this data structure:

    bool getFrequencyAt(struct timeval time, int &freq);
    bool getFrequencyAtInterval(struct timeval t1, struct timeval t2, int &freq);
    bool getHistogram(struct timeval start, struct timeval end, struct timeval step, int frequencies[]);

The functions should return true if the query was successful, otherwise false.

Prepare the linux system on the laptop for running a http server and install all necessary programs (php, phyton, ...).
Implement a simple web interface that uses the above functions for drawing histograms of the time interval selected by the user.



Part IV - Evaluation in the field

Now you should have an idea about what your people counter can do and what it can't do. This is important for utilizing the application in the field. Have a look the entrance area of the Mensa and decide for a good position which allows most reliably counting the amount of people entering this place.

Evaluation:         
Take the counted frequencies and compare them with frequencies manually counted during a period not shorter than four days.

Deliverables:
A diagram indicating the error from the evaluation


kleiner@informatik.uni-freiburg.de, 20. October 2003