Categories
3d graphics opengl programming video

Augmented Reality with NyARToolkit, OpenCV & OpenGL

arHi
I have been playing around with NyARToolkit’s CPP implementation in the last week, and I got some nice results. I tried to keep it as “casual” as I could and not get into the crevices of every library, instead, I wanted to get results and fast.
First, NyARToolkit is a derivative of the wonderful ARToolkit by the talented people @ HIT Lab NZ & HIT Lab Uni of Washington. NyARToolkit however was ported to many other different platforms, like Java, C# and even Flash (Papervision3D?), and in the process making it object oriented, instead of ARToolkit procedural approach. NyARToolkit have made a great job, so I decided to build from there.
NyART don’t provide any video capturing, and no 3D rendering in their CPP implementation (they do in the other ports), so I set out to build it on my own. OpenCV is like a second language to me, so I decided to take its video grabbing mechanism wrapper for Win32. For 3D rendering I used the straightforward GLUT library which does an excellent job ridding the programmer from all the Win#@$#@ API mumbo-jumbo-CreateWindowEx crap.
So let’s dive in….

Categories
graphics programming vision

Porting Rob Hess's SIFT impl. to Java

beavers_siftThis is a Java port of Rob Hess’ implementation of SIFT that I did for a project @ work.
However, I couldn’t port the actual extraction of SIFT descriptors from images as it relies very heavily on OpenCV. So actually all that I ported to native Java is the KD-Tree features matching part, and the rest is in JNI calls to Rob’s code.
I wrote this more as a tutorial to Rob’s work, with an easy JNI interface to Java.
You can find the sources here: https://www.morethantechnical.com/extupload/code/JavaSIFT.zip
Here’s how to use it:

Categories
graphics gui programming vision work

Combining Java's BufferedImage and OpenCV's IplImage

java_opencv_imgHi
I recently did a small project combining a Java web service with a OpenCV processing. I tried to transfer the picture from Java environment (as BufferedImage) to OpenCV (IplImage) as seamlessly as possible. This proved a but tricky, especially the Java part where you need to create your own buffer for the image, but it worked out nicely.
Let me show you how I did it

Categories
graphics programming video work

iPhone camera frame grabbing and a real-time MeanShift tracker

i_can_has_meanshiftHi
Just wanted to report on a breakthrough in my iPhone-CV digging. I found a true realtime frame grabber for the iPhone preview frame (15fps of ~400×300 video), and successfully integrated this video feed with a pure C++ implementation of the MeanShift tracking algorithm. The whole setup runs at realtime, under a few constraints of course, and gives nice results.
Update: Apple officially supports camera video pixel buffers in iOS 4.x using AVFoundation, here’s sample code from Apple developer.
So lets dig in…

Categories
3d graphics programming school

Tracing wild rays

Hi
I havn’t published in a while. I was back up with work on a project for uni., work and my writing…
But the good thing with keeping busy, is that after a while – you have something to show for! So here’s what i’ve been working on for Comp. Graphics course – A Ray Tracer.

Categories
graphics Recommended tips Website work

Beef up your presentations with word clouds

friendshipThere’s nothing like a good visualization to deliver your ideas over a presentation. Concise points and breakdowns can only go a certain distance before they become weary, and finally confuse your audience. It’s better to keep them on their toes by spicing up the boring slides every 5 or so page turns.
I found that Word Clouds, a kind-of new visualization concept, have a good trait of focusing the attention over a single word’s associative space. You bold your main word, center it, and scatter the associative words around it. This creates a powerful effect.
I found a nice tool to create these word coulds on-the-fly: Wordle.
The way I did was, get the Wikipedia value of my word, for example “Friendship“, and go to the Edit tab. Copy all the textarea’s contents, and paste it into Wordle’s word cloud creator. Press “GO” and the results are immediate.
You can eliminate the “outliers” – those unrelated words that appear too many times, and layout the cloud as you like to fit your slide.
The down-side with Wordle is that it has no export ability, so I had to take an Alt-PrintScreen screenshot to get my cloud as a picture.
Enjoy!
Roy.

Categories
ffmpeg graphics gui linux programming qt video

Showing video with Qt toolbox and ffmpeg libraries

I recently had to build a demo client that shows short video messages for Ubuntu environment.
After checking out GTK+ I decided to go with the more natively OOP Qt toolbox (GTKmm didn’t look right to me), and I think i made the right choice.
So anyway, I have my video files encoded in some unknown format and I need my program to show them in a some widget. I went around looking for an exiting example, but i couldn’t find anything concrete, except for a good tip here that led me here for an example of using ffmpeg’s libavformat and libavcodec, but no end-to-end example including the Qt code.
The ffmpeg example was simple enough to just copy-paste into my project, but the whole painting over the widget’s canvas was not covered. Turns out painting video is not as simple as overriding paintEvent()…
Firstly, you need a separate thread for grabbing frames from the video file, because you won’t let the GUI event thread do that.
That makes sense, but when the frame-grabbing thread (I called VideoThread) actually grabbed a frame and inserted it somewhere in the memory, I needed to tell the GUI thread to take that buffered pixels and paint them over the widget’s canvas.
This is the moment where I praise Qt’s excellent Signals/Slots mechanism. So I’ll have my VideoThread emit a signal notifying some external entity that a new frame is in the buffer.
Here’s a little code:

Categories
graphics

DIY: Cow skin pattern for your GIMPed cows

I wanted to share with you a (very simple and short) method for creating cow-skin patterns, totally random each time, for your GIMPin needs.
This can actually work the exact same way in GIMP, PS or Paint.NET.
I will demonstrate with GIMP, but it is so simple you can do it in any of the aforementioned programs.
So here goes:

Categories
graphics

Paint.NET is cool

Today I stumbled upon Paint.NET.
It seems like an awesome tool for quickly drawing stuff.

I also read that some compare it to The GIMP (which I adore…). I found Paint.NET is easier for simpler tasks that the GIMP can drive you nuts while trying to do them.
In the GIMP i find myself using the select tool A LOT. You want to draw a circle? select and fill. You want a simple rectangle? select and fill…
Sometimes I wish GIMP was more like plain ol’ Paint…

Here I think Paint.NET really excels. It keeps the simplicity of Paint, but adding the open-sourceness and variety of GIMP.