3D VR Headtracking test

After the first successful test of my webcam marker tracking algorithm, it’s now time for the real deal.

The purpose of my experiment, is to be able to detect the position of my head in 3D space, by processing the webcam-captured frames, locating the 2 markers, and then performing an inverse projection from 2D space to 3D space. That information can be used to set the view-point of a 3D environment to follow the motions of the user’s head, thus increasing the user’s immersion in the 3D world considerably. Simple, natural motions of the user’s head, are carried along in the virtual world, making the screen act as a window into that 3D environment.

Of course the point tracking code from my previous test is the same. However, I modified my tracking program to accept local connections from client programs that need to use that tracking information (x, y normalized position of each marker). Then I wrote a test program, that renders a simple OpenGL “world” (a bunch of balls and a couple of coordinate grids), and uses the marker positions from the other program, to calculate the user’s head 3D position, and set up the virtual camera to coincide with that.

Once again, you may watch the result at youtube. There’s still some way to go, and some details to be ironed out… I’ll keep you posted on anything new with this experiment :)

Oh, and of course, the code is always available at my subversion repository:

webcam marker tracking program (server): svn://mutantstargoat.com/nuclear/compvis/cam_test
3D environment test (client): svn://mutantstargoat.com/nuclear/compvis/vr_test
my webcam library (used by cam_test): svn://mutantstargoat.com/nuclear/libwcam
Posted in hacks. 11 Comments »

First Headtracking Test

Finally, after some weeks of putting it off, I manged to sit down and write some code to talk to video4linux2 drivers, in order to get streaming video from a webcam.

My motivation for messing around with webcams and v4l ioctls, was a little experiment of mine. I wanted to write a program, that given video input from a webcam, is able to detect two “markers” attached to my head. This in turn is but a step in a slightly larger experiment I’m conducting, which I’m not going to go into right now.

So what this program does, is to detect the two markers in the video stream, and draw a blue rectangle around each marker. Check out this youtube video for a demonstration of my test program. Be warned: it’s rather silly :)

Also, I wrote a nice little v4l webcam library as part of this experiment. The code is available, as usual, in my subversion repository: svn://mutantstargoat.com/nuclear/libwcam. The test program is also available here: svn://mutantstargoat.com/nuclear/compvis/cam_test

Posted in hacks. 4 Comments »

Automatic Class Diagram Generation

Some time ago, I needed a widget toolkit that would be able to draw widgets in an existing OpenGL window. However, I also needed it to be independent of the underlying graphics library, or event system, so I could use it in conjunction to both OpenGL, and another nameless 3D graphics API, that I was forced to use at the time for reasons I won’t go into right now. Anyhow, to cut the long story short, I started writing one such toolkit from scratch.

I opted for a fully object-oriented design, such as I rarely do lately, because OOP really makes sense for widget toolkits, and used C++ for the implementation.

Before long, I wanted to show what I was doing, to the rest of the team working on the project, for which I was writing the toolkit. And decided I should visualize the class hierarchy, as a quick overview of the widgets and their relations.
Read the rest of this entry »

Posted in hacks. 2 Comments »

A blog? wtf!

Those of you who know me, might be a bit surprised that I’ve decided to start a “blog”. In fact, my stated opinion about blogs was that they are a useless, redundant medium, that helps fill the web with even more crap.
Read the rest of this entry »

Posted in boring. 6 Comments »
Design a site like this with WordPress.com
Get started