pygame is
Simple DirectMedia Layer is
Site Swing
AR example

AR example - 0.5-frog-knows

slmgc (slmgc)



AR example is a simple augmented reality example written in python using pygame library.
Linux only. Added win32 support out of the box with VideoCapture by Markus Gritsch.


  1. Take an object of simple shape and solid color.
  2. Switch the color mode with [1][2][3].
  3. Target the object and fixate it's color by pressing [space].
  4. Calibrate the object's color with the color picker using [q][w][e] and [a][s][d]. Only the targeted object should be visible on the screen.
  5. When done, switch from the calibration mode to the tracking mode [enter].
  6. Switch on/off the tracking frame with [1].
  7. If the result is not good enough, switch back to the calibration mode [enter] and repeat the steps above.

P.S. if you have any questions or suggestions, please drop me a line.


A new, higly experimental, version of AR example.


Home Page:


click to view original size


AR example - 0.4.0 - Jun 19, 2014
AR example - 0.3.1 - Sep 9, 2012
AR example - 0.5-frog-knows - Sep 8, 2012 account Comments

If you wish to leave a comment with your account, please sign in first.

September 2, 2010 7:32am - slmgc - nickname: (slmgc)
It was my first python program ever (C programmer here), but I've tried to make the code as readable as possible. The passive state is the callibration mode, when there are no algorithmic calculations, and the active state is the opposite, in this mode beggins to work the program's bouncing and interface code. As for the full-screen mode... maybe I should default the program to the windowed mode or just make an on-screen instruction?
September 2, 2010 1:25am - Xandar Kablandar - nickname: (eternalcheesecake) - 4/5
Very neat! This is the first time that I looked at the code to work with webcams with Pygame and your example shows how simple it is. It took me awhile to memorize the instructions because when the example goes full-screen, I couldn't switch back. So I wound up just tinkering until I got it, but was surprised at how well it kept up. In the code, I didn't understand the difference between the active & passive state, though.

our projects welcomes all python game, art, music, sound, video and multimedia projects. If they use pygame or not.
recent releases
Feb 21, 2017

Jan 31, 2017

Jan 24, 2017

Jan 18, 2017

Jan 7, 2017

Dec 30, 2016

Dec 8, 2016

Nov 28, 2016

Nov 27, 2016

... more!
for pygame related questions, comments, and suggestions, please see help (lists, irc)