OpenCV slideshow

Posted on 23 July 2010 by Paolo Bernardi

Do you ever get, while giving a presentation, that uncanny feeling that something’s missing? Well, of course, you just need my color-powered slide changer!

Thanks to this gimmick you can change slide just by showing a green object to your computer’s webcam. My program will detect the specified kind of green and it will simulate the SPACE key pressure, used by any serious presentation tool to advance to the next slide.

The green that should be detected is determined by three parameters, adjustable at run time using slider controls:

  • minimum green level (0-255);
  • minimum green/red ratio;
  • minimum green/blue ratio;

I suggest to calibrate the program by following this procedure:

  1. start the program;
  2. show to the webcam the green object that you intend to use;
  3. lower down to zero each slider;
  4. raise the minimum green level until most of the detected green is located on your object;
  5. raise the other two sliders in order to remove the environmental noise (e.g. green detected outside your object); this might lower the quantity of green detected on your object to a bare minimum, but as far as there is any the program will work as expected.

Caveat: in order to avoid uncontrolled slide advancing the program will wait 2 seconds after detecting the green object before restarting the detection again; you can use these two seconds to remove your green object from the webcam sight, after changing slide.

This toy works surely on Linux, I didn’t bother trying it on other platforms; anyway it should work anywhere there is OpenCV and Xorg.

I used this program to do my master degree dissertation and it worked quite well; in that occasion the green object was a green dot in the middle of a black glove.


Get in touch

Thank you for contacting me, I will be in touch with you as soon as possible.
There was an error while trying to send the comment, please try again later.