Creating Augmented Reality

In case you want to create some augmented reality application(example), you need a library which provides you with geometry information for a given video stream based on some kind of markers.

Luckily there is already a library, which uses quite obvious, yet easy to use markers and was actually a pioneer in this area: ARToolkit. Unluckily the developers decided to continue the development closed source as ARToolkit4. So the last freely available version is ARToolkit2, whose core recognition routines have not been touched since 2006. Nevertheless the SVN of the branch still shows some activity, so it seems to be at least maintained.

But even before the library went closed source, several forks of it were created:

  • ARToolkitPlus: uses an improved algorithm and claims to have better performance. No longer developed
  • OSGART: wraps ARToolkit and combines it with Open Scene Graph
  • NyARToolkit: seems to me like an overengineered rewrite in C++. Pointless.

Comparing the available choices, ARToolkitPlus is the most advanced one, although it was not updated since 2006 (but neither was the core of ARToolkit) and it even does not compile on a current GCC. But looking at the code it is still much more solid than ARToolkit, that is why I decided to pick up the development. I spent several hours to make it compile again and ported the build system from qmake to scons. You can see the results at launchpad. By using launchpad there is now even a bug-tracker and a question system, so you are welcome to join me there.

Currently ARToolkitPlus lacks the camera and rendering support to be feature complete with ARToolkit and give users an easy start. So this is obviously the next on the Todo list.

bzr is really great

I just moved the code hosting of YouAmp from garage.maemo.org to launchpad and thus also moved the source code management from svn to bzr. And I must say bazaar is really great. I have already had some experience with git before, but I could never really wrap my head around it, but I got the workflow if bazaar in just about 5 minutes.

I do not want to start another VCS war here, since there are already enough of them ongoing – instead I just want to mention some things bzr got right:

  • it lets you accomplish your task without getting in your way: if you want just to publish your code on a public repository, it just does that instead of trying to teach you the concept of decentralised VCS
  • if you try to do something which requires knowledge of  the concept decentralised VCS, it points you directly to some instructions to what you have to do and why
  • it is really greatly integrated with launchpad: you can have the translations on launchpad synced up with the ones in your repository automatically 😀
  • it displays only the basic(mostly used) commands as default so you can quickly find the right one

In other news YouAmp now uses launchpad for the hosting, which means you can start help translating it there. Since I have not posted about YouAmp for some time, here is the current status:

  • it was ported to Tracker, currently waiting for the 0.7 release to take real advantage of it
  • it also uses GtkBuilder now so you can easily change the interface
  • there is basic Playlist support, but it has to be reworked
  • once the Playlist rework is done, there will be a new release
  • and a backport to Maemo4 using the new codebase

First usable open-source phone arriving

Have you ever dreamed of to ssh into your phone and install Gnome stuff with apt-get? Well at least some have and thus created OpenMoko but sadly they only managed to produce two prototypes with unusable software. Well you can still install android on them, but then you basically use Java instead of the traditional Linux software stack. This is also the “problem” which you get most of the current Android phones. Well of course apart from being locked in to google.

But there is hope! It seems like Nokia is finallay putting Maemo on a real phone. See this photo for the looks. In case you have missed the Maemo up to now: it is a Gnome based desktop for MID – just like Ubuntu MID, but better designed. And the best news is that it will use a Clutter based interface for the next release – just like Moblin. This makes Maemo look really slick.

Besides of the looks it uses all the Gnome internals which Ubuntu uses (at least Karmic): Telepathy for Messaging, Firefox as the browser an evolution based Mail client. I currently use it on my N800 and it is really great; want to try out Fennec instead of the pre-installed browser? One click automatically adds a new apt repository.

This probably reads like a straight advert, but I really waited for a phone like this.

As a sidenote: clutter seems to have quite a momentum this days: Moblin, Maemo, Gnome3 …

Why are we using C again?

It has been a while already since I last ranted about the main programming language used for Gnome. Mostly because you are not forced to use it and so I did not. But recently there were some posts on Planet Gnome which reminded me how inherently broken the core of Gnome is. I mean we have all this nice libraries like GTK, Glib etc. and they are easy to use and generally well designed, but when you want to hack on the core of them you have to use C.

I understand that back then when the Gnome project started C++ was in a very high flux with uncertain design bad compilers and so Gnome was written in C instead.

But looking at C++ today especially at the modernizations coming with C++0x (which are mostly already available in gcc4.4 btw.) it is really hard to understand why C is still used.

Just look at the linked examples; since C does not provide any build-in concept of iterators and the language is not flexible enough to provide them as library even experienced Glib developers iterate over lists in O(2^n) instead in O(n). How braindead is that? Instead of re-using the object concept and the syntactic sugar provided by C++ we are re-inventing the wheel with Glib. Luckily the community lately noticed that the syntax using Glib is so fucked up so you are not being productive any more. And what was decided as a solution? Reinvent the compiler by writing Vala – WTF?? There is already a compiled language which is compatible with our old code and which looks almost identical to vala; C++.

And I am not the only one who thinks that C++ is generally preferable over C. Here is a presentation discussing writing GCC in C++ which eventually happened. And these people are writing compilers so they should know if the language switch is worth it…

I thought the great thing about OSS is that you dont have to reinvent the wheel, but simply can use the well tested ones. Sometimes I really question the sanity of the Gnome developers…

Thunderbird GNOME Integration

After the native theming that thunderbird3 will have, another issue with GNOME integration has been cleared out. When you used Thunderbird/ Lightning as your calendar the rest of the GNOME desktop would not know about your dates. So for instance the gnome-clock-applet would not show them.

But now there is a add-on available which pushes the data from Thunderbird to EDS(Evolution Data Server), so that they will be displayed in th gnome-clock-applet.

Make sure that you have python-gnome2-desktop and evolution-data-server installed 🙂

Does anyone need Epiphany?

Now that Google Chrome is finally coming to Linux we have a simple and fast Webkit browser. It is also opensource and uses GTK. So where is the need for Epiphany? One may say that it might better integrate with the rest of GNOME, but currently Empiphany is about just as integrated as Chrome and I guess it would be easier integrating Chrome wih GNOME than making Epiphany a good browser…

4 Years Later

Nearly 4 years ago Jon Smirl, the author of the experimental Xegl server wrote a nice summary about the state of linux graphics. He did that after realizing that it take much more time than he could out into Xegl in order to fix the linux graphics, so it is a realistic summary.

The interesting thing is that in his vision he described an X server which would run without root privileges and use OpenGL for all its drawings. Number one on his todo list though was a memory manager for DRM, which would enable all the nice stuff.

Well it seems that coming with Karmic we will finally see that first step done; most of the users(Intel and AMD) should get a nice in kernel memory manager which will be visible by Kernel Mode Setting. So what can we expect next?

Linux Graphics Dependencies

This diagram shows the dependencies of the various features. (Source) Green is what we should get with Karmic. The graphics-memory manager in kernel allows moving mode setting there too, so the resolution is set only once during bootup (flicker-free). Since the graphics card is now controlled from one hand it also allows dynamic power management to be done and does not require root privileges for X, which results in better security. Memory management also allows giving 3D applications their private front buffer, so they dont conflict when rendering. (RDR, Redirected Direct Rendering) Which is basically the core of DRI2. It also allows supporting memory related OpenGL features like VBOs or FBOs(Vertex/Frame Buffer Object) which brings the compliance level of MESA up to OpenGL 1.5.

Theoretically everything up to OpenGL3 could be implemented now, but since of the old design of MESA everything would have to be implemented for each driver over and over again. That is why Gallium3D was created. It is a intermediate level API which abstracts from the hardware by just offering a  state tracking interface. On top of that it is possible to implement more sophisticated APIs like OpenGL, OpenCL or a Video Decoding API like VDPAU. These implementations can then be shared across all drivers which are built on the Gallium3D architecture.

Well it is still a way to go until we get these grey boxes, which Windows and Mac basically already had 4 years ago…

YouAmp 0.5.10

I just uploaded a new version of YouAmp to the YouAmp PPA. Note that this is the desktop version and thus will not work on the N8x0 devices. Actually there wont be any updates for the Maemo version until Frementale, since the codebase currently already depends on some of its features. (which are already available in Ubuntu 9.04)

You may wonder where the jump from 0.5.4 to 0.5.10 comes from – actually there were releases in between, but since it were only minor feature additions, I did not announce them explicitly.

So here are the new features from 0.5.4:

  • show notify-osd compatible notifications on song change
  • support multimedia keys
  • better status icon (minimise animations, tooltip)
  • gapless playback
  • Drag and Drop support (reordering, copy to from/to directory)
  • uses Tracker for Indexing

And the best news is that playlists are half way done already 🙂

Another linux jerk down

As you surley know linux is crap, cobbled together by some amateurs. Well at least many trolls on the internet know. Sounds like prejudice and intentional offense, right?

Well, you probably heard of Jörg Schilling and the desaster with cdrtools – if not you can read it up here. The problem back then was that he (the author of cdrtools) changed the license to an GPL incompatible one ignoring the objections of the users.

And here comes the next one; Debian just decided to replace glibc by eglibc, because the maintainer of glibc, Ulrich Drepper, is.. lets say very uncooperative when it comes to patches. (just read the bugzilla reports linked in the announcement)

It is intresting that this guy alone could cause that glibc had to be forked. I mean this is really the core of every linux OS.

Probably the trolls on the internet are not completely wrong after all – sometimes the GPL not only allows to create free community around a project, but allows to free the project from its “community”.

PyClutter and Garbage Collection

ever wondered why something like this wont work when using python-clutter?

import clutter

def add_effect(obj):
    tl = clutter.Timeline(fps=60, duration=1000)
    alpha = clutter.Alpha(tl, clutter.sine_inc_func)
    bhv = clutter.BehaviourOpacity(alpha=alpha, opacity_start=0, opacity_end=255)
    bhv.apply(obj)

    return tl

def main():
    re = clutter.Rectangle()
    tl = add_effect(re)
    tl.start()
    clutter.main()

The problem is that once the function add_effect finishes, the variables tl, alpha and bhv will get garbage collected by python because they get out of scope. But they are still needed by clutter, which results in the error. To solve this you have to keep a reference to the variables somewhere, like

import clutter

tl, alpha, bhv = None, None, None

def add_effect(obj):
    global tl, alpha, bhv

    tl = clutter.Timeline(fps=60, duration=1000)
    alpha = clutter.Alpha(t1, clutter.sine_inc_func)
    bhv = clutter.BehaviourOpacity(alpha=alpha, opacity_start=0, opacity_end=255)
    bhv.apply(obj)

    return tl

def main():
    re = clutter.Rectangle()
    tl = add_effect(re)
    tl.start()
    clutter.main()

of course this way you can only have one effect at a time, so using objects for encapsulating the references would is preferable.