Alternative to adaptive thresholding

As cool as it is, adaptive thresholding generates too much redundant data. The only alternative implemented before seems to be the method called automatic thresholding, suggested by ARToolKitPlus folks:

ARToolKitPlus can do dynamic thresholding by looking at the marker content (pattern) and taking the average between the darkest and brightest pixels. If no marker is found the threshold value is randomized.

From this description alone, it is clear that there will be frames with marker undetected even though it is clearly visible in the image, so I thought, until now, that this method has to be quite bad. It turns out, however, that this method actually works very well and the number of lost frames is very small. In practice, you don’t even have to find pixel values range, it suffices to assume that current good threshold value lies close to last known one.

On code side, you no longer need to write or import some fancy filter classes, all you have to do is to modify your fixed thresholding main loop just a bit:

private var threshold:Number = 0.5;
private var confidence:Number = 0, confidenceThreshold:Number = 0.5;
private function onEnterFrame (e:Event):void {
	videoSnapshot.draw (video);

	if (confidence < confidenceThreshold) {
		// randomize threshold
		threshold *= 0.8;
		threshold += 0.2 * Math.random ();
	}

	confidence = 0;
	if (detector.detectMarkerLite (raster, 255 * threshold)) {
		confidence = detector.getConfidence ();

		detector.getTransformMatrix (result);
		stuff.setTransformMatrix (result);
	}

	scene.render ();
}

If you’re sandy fan, you can play with this method using this stub code.

Augmented reality based on blob detection

It’s long time no post now, so I thought why not post something :) So, here goes this little augmented reality experiment. Let me warn you first, it is not impressive at all, nothing fancy on 3D side, and tracking – to be fair – sucks. This is in part because it does not use any solid technology such as FLARToolKit, just something hastily hacked in haXe, for a change. In other part, it uses very simple fixed threshold filter, that can (and does) harm tracking. To save me some typing, I have made this short video explaining what this experiment is about:

Continue reading ‘Augmented reality based on blob detection’

FLARToolKit adaptive filter experiment sources

For those who asked about sources of my little experiment from last week, here they are. Make sure you are using FLARToolKit revision 2570 with these.

If you wasnt reading FLARToolKit mailing list, here is short summary: FLARToolKit converts color image to ”binary” image before doing any magic on it, using fixed threshold filter. In fact, this threshold is simply hard-coded to be 80 in many examples, and you will need to write more code to detect good values for threshold if you want your application to run regardless of lighting settings. The filter in this experiment avoids the problem by using local average brightness as a threshold for every pixel; the downside is that it enables FLARToolKit to “see” far more details, thus wasting even more CPU time. As a work-around, I tried to narrow down search area in the image using last detected square, but this only helps when marker motion is limited.

Well, check it out, play with it, and let me know what you think.

FLARToolkit and Alternativa3D, anyone?

Shortly after FLARToolkit was married to Sandy, I arranged it a secret date with Alternativa3D. The date was quite fruitful, and in a week this baby was born:


This is modified ”Ballance” game released by Alternativa3D team in november, with FLARToolkit used to control camera instead of mouse. Unfortunately, due to GPL2 section 2 clause B I cannot distribute stuff including both FLARToolkit and Alternativa3D for free, so no SWF for you to play with atm, sorry. But, if anyone is interested in sponsorship to enable this thing to go online, contact me.

Continue reading ‘FLARToolkit and Alternativa3D, anyone?’

Three-dimensional Pythagoras tree

In 1942, Albert Bosman was busy drawing 1st Pythagoras tree instead of building submarines for Germany. Yesterday, I was busy programming 1st three-dimensional version of this fractal instead of doing real work. Today I had another go at that, increasing the number of squares and replacing view rotation with anaglyph mode. So, go get your 3D glasses and check out some of renderings it produced:

3D Pythagoras tree

And this is Pythagoras tree, too

Yet another 3D Pythagoras tree

As you can see, addition of third dimension somewhat reduces density of the tree, because squares get small faster; it does, however, greatly increase diversity of results. Note that my code generates only small subset of possible 3D Pythagoras trees – there is certainly much more land to explore.

Next Page »


Old stuff

July 2009
M T W T F S S
« Jun    
 12345
6789101112
13141516171819
20212223242526
2728293031  

Oh, btw…