Research Group for Applied Software Engineering
Forschungsgruppe für Angewandte Softwaretechnik

OpenCV Playground

As our Course in Sarntal will be something about "Rapid Prototyping" and "Ultra Exreme Programming" and lots of other BuzzWords (TM), lets start to do some finger exercises with XCode, Objective-C and all those fancy libraries. I just started with programming on Macs so feedback is highly recomended. Also feel free to add custom Levels or BonusLevels.

 

Level 1: (I'm too young to die)

  • Getting the OpenCV libraries linked 
  • For Mac-People: Copy the OpenCV-Framework into the Library/Frameworks folder of your homedirectory. (Note: You might not have a Frameworks folder. In that case just generate a folder of that name (Note The Upper Case At Beginning Of Foldername!)).

 

Level 2: (Not too rough)

  • Bleeding Edge: The Sobel-Operator.
    • I actually tried to comment the code in human readable form! If it isn't sufficient complain now or the next levels will be the same!
    • Usage: Throw image into image area. Klick Sobel. Enjoy edges. Try different kernel sizes (3, 5, 7).
    • If it doesn't compile, back to level 1.
    • Note: Does Objective C do garbage collection? If it doesn't, someone plz fix that Memory Leak. (Each klick on "Sobel" generates a new NSImage without disposing the old one. Same for new Images dragged onto the App...)
  • UPDATE!!! Try Updated Level 2. Changes:
    • Works with Framework only! Make sure to download the framework and put it into the Library/Frameworks folder of your home!
    • Compiled with "Deployment" style. Binary in "build" folder should work out of the box!

 

Level 3: (Hurt me plenty)

  • Visions: Spinning Beach^H^H^H^H Tree ...
    • Complete Level 1 & 2 to unlock this level.
    • Some Cocoa mixed with C, C++ and pascal-callback-functions. Nice if served iced...
    • I tried to comment all steps. Only the OpenGL part is a little short on details, but OpenGL is easy anyway ;-)...
    • Make sure, your iSight is plugged in BEFORE you start the App.
    • We use QuickTime to get Images from ISight, OpenCV to do some realtime Sobel filtering and finally OpenGL to display some graphics. (The video gets mapped on a rotating tricolored triangle. Looks like a christmas tree on steroids...).
    • If there is any "stylish" (i.e. Object-Oriented) way to use QuickTime or any other way to get Images from iSight, let me know.
    • Capturing Images is very CPU intensive!
  • UPDATE!!! Try Updated Level 3. Changes:
    • Works with Framework only! Make sure to download the framework and put it into the Library/Frameworks folder of your home!
    • Compiled with "Deployment" style. Binary in "build" folder should work out of the box!

 

Level 4: (Ultra-Violence)

  • Had some differences with my iSight...
    • Actually a refined version of Level 3.
    • Caution:
      • Folder has same name as Level 3!
      • even less documentation
      • lots of low-level speed-hacks
      • no UML-Diagrams or particular Design... 
    • Reason: It's half past one in the night.
    • Usage:
      • Plug in iSight
      • Start App
      • Under "Adjustments" Set everyting from "Auto" to "Off" or "manual". Else the Camera will adjust several internal settings and the algorithm will fail!
      • Position camera. No particular nice background needed. Static Background strongly recommended.
      • Get out of the way!
      • "Get Back"(ground).
      • Will take some 3-4 Seconds, screen will fade to black.
      • If everything goes well, you can no try to wipe the screen "clean". Maybe the update-rate will need some adjustment to you cleaning-skills 
      • (Remark: If you do not move for 3 Seconds, i.e. you are in some asana, the algorithm should segment the Yogi)
    • Technical Detail:
      • iSight is very noisy. So the images are smothed locally (via Gaussian filter) and temporaly (gliding mean) hence the 3 seconds delay till complete semegmentation.
      • Somewhere there is a nasty bug, as the App randomly locks up. My personal assumption is, that the iBook cannot keep up with the timer-interrupts needed by the low-level grabbing routines. On the other hand, there the code might just be stupid... feel free to correct.
    • Good Night.
  • UPDATE!!! Try Updated Level 4. Changes:
    • Works with Framework only! Make sure to download the framework and put it into the Library/Frameworks folder of your home!
    • Compiled with "Deployment" style. Binary in "build" folder should work out of the box!
    • Updated folder names, as they were very irritating. Sorry.

 

Level 4,5: (TV)

  • If you're feeling blue...
    • Actually Level 4, with some cleanups and a few comments.
    • Really more stable background elemination. (Keep the scene well lit!)
    • Background Elemination got addaptive, so slow changes in illumination should be no problem. (Think of rising sun... ;-))
    • Lower Resolution, and more speed hacks -> Realtime (for the moment)
    • Added functionality: Bluescreening. Just drag an image of choice in to the background hole on the left...
  • Update (V2)
    • Offloaded Bluescreening to OpenGL * more CPU-cycles for background elemination * much higher resolution for background-image
    • Some stability tweaks to elemination algorithm
    • Finally found out how to disable Automatic Camerasettings. Unfortunately One has to hit (Adjustments -> Image -> Tune) for the camera to select inital Settings. Else the image might be so dark of to light.
    • Framerate limited to 10 fps.
    • uses about 50% CPU on my iBook G3-700
  • Update (V3)
    • Added support for the OpenCV framework provided by Christoph. Make sure to get the binaries and copy them into the "/Library/Frameworks" folder of your home folder. You might have to create that folder first. Else the dynamic linker won't find the framework!
    • Upgraded the heuristic background finding algorithm to a statistic one. Performance is still acceptable 
  • Update (V4)
    • Removed the "old" library. I.e. it now only needs the Framework 
    • Found evil hack to get rid of evaluation of exponential function in the ME1 - Skript  Kudos to Prof Niemann. (Instead of p(background) < x, it now uses ln(p(background)) < x'. Looks strange, but looking at the formulas, one realizes, that precomputing one ln() saves countless exp()... blubb).
    • Recompiled the OpenCV framework with settings that are optimal for iBook (I hope)...
    • Usefull results with less then 50% CPU utilisation :-)))
  • UPDATE!!! Try Updated Level 4,5. Changes:
    • Stupid Division by zero bug squashed. Thanks to Sebastian.
  • Final Version of TV-App

 

 

Level 5: (Nightmare!)

  • Locked