From the Blog

Posted by gduhamel at 6:51 pm

After several attempts to detect gesture, relying on skin color, I tried object detection through the famous Viola & jones method. I used it as implemented in OpenCV library.

The experiment was about detecting a gesture used to select some displayed item. Among every possible hand movement, the opposite figure seemed the most intuitive and recognizable.

Picture Samples

Viola & Jones method is well known about efficiently detecting faces. But there is nothing about hands, even less for hands’ back. Software must be trained to identify this particular shape.

In order to compute the shape’s specific Haar-Like Deatures used by detection algorithm, many samples are required. A set of picture focused on the main object. And a set of random scenes, not containing the form to be detected.

Negative images are numerous on the internet. To industrially produce positive images, I wrote a little software. 

  • This software uses Webcam stream
  • A ten seconds countdown allows the user to fit an object into capture area.
  • By the end of the countdown, a snapshot is resized and saved.
  • Positive pictures are rectangular, it is not a problem.
  • Picture is then processed by an OpenCV utility (named createsamples), creating more images, slightly distorded. Modified contrast, scale or rotation, negative colours, …
  • For every supplied picture, 20 are created.

My 1500 positive images goal was worth 10 minutes.


Supervised learning

1500 positive images and 3500 negatives was enough for OpenCv to compute Haar-Like Features. OpenCV library provides the “haartraining” utility, doing the job for us.
The goal was to detect the shape with wide tolerances, allowing few false positives. It took the computer 8 hours to work out a 10 stages detector.

Below, some features involved in detection:



Results are quite interesting, regarding the short training duration. Initial shape is correctly and efficiently detected, while false positives seem to be rare.

Loading Video…

This shape recognition may be part of a detection process. Simply used to locate features for the software to investigate and identify a user interaction.


OpenC V Library documentation
Naotoshi Seo’s Tutorial on his blog

Posted by gduhamel at 7:12 pm

Outdoor, in urban or wild environments, you may be served by Global Positionning System, however, Indoor equivalent is quite rare. Some are focused on WIFI signal, others on RFID, trying (badly) to prove themselves as precise as GPS. Seeking a centimeter-accurate solution within closed space actually turned into assault course.

Initial Need

My first augmented environment prototype relied on stereoscopic vision using two webcams and an infrared marker. It was accurate but expensive (in both computing and cost). For more than a year I was working on an ultrasonic positioning system filling specific needs:

  • Passive localization (once set up, receiver just receives, no dialog with emitter)
  • Centimeter accuracy
  • Cheap (and scalable)
  • Fitting our everyday indoor spaces


The resulting system is similar to GPS :

  • Scattering of several emitters of known position
  • Every one broadcasting on different frequency
  • Receiver calculates emitter remoteness
Loading video…

For a room, you just need 3 ultrasonic emitters and a radio channel. Ultrasonic signals are broadcasted one by one using distinct frequencies, while a radio signal is a sign of exact emission time.

Knowing the moment of emission, Reciever can work out a distance for any received ultrasonic signals. As 3 distances are known, receiver is able to figure out receiver’s position by trilateration.


Tools involved in this demonstration are simple:

  • A Soundcard
    • -> 5.1 surround sound, means 6 available channels
    • 192 Khz sampling for microphone input
  • A few Piezo Tweeters
  • A radio emitter
  • A radio receiver
  • And a condenser microphone

In such circumstances, my microphone, for want of anything better (and much more expensive) was insufficient. A common microphone is not fitted for ultrasounds. Even my measurement microphone was limited to 20-22 Khz.


Acoustic pulse had to be played over multiple frequencies, but still being catch with high accuracy (travelling as fast as sound, a millisecond error brings you 0.34cm further). Bests results use frequency modulation, sound waves carrying the real synchronization pattern.

Repeated several times a second, each wave is recorded by receiver who analyses determined frequencies and estimates its position.


For this little experiment, 5.1 sound kit is plugged into the soundcard to amplify the signal. Four outputs are wired to three emitters (each).

Soundcard also broadcasts radio signal through a short range FM emitter.

The microphone is a condenser measurement microphone. It requires additional power supply and has a special plug.
To merge sound and radio, both microphone and radio receiver are linked up to the same soundcard input.