Second Try on Augmented Reality

8 03 2011

The previous code i had used was too unstable, it crashes more often than it runs. So searched for a better version of toolkit code and started a code from the scratch rather than using the simplar code. This time the code was much more stable and was able to display more files than the previous version.

[kml_flashembed publishmethod=”static” fversion=”8.0.0″ movie=”” width=”400″ height=”300″ targetclass=”flashmovie”]

Get Adobe Flash player


The Marker is available here

Update: Fixed problem which prevented the model from displaying in web server. Now a torus should be visible once the marker is shown.

A try with Augmented Reality

6 03 2011

Augmented Reality had always been a field of interest. The ability to combine various technologies and to get a outcome which is more intuitive has what that attracts me to the field. Alast after long weeks of thinking of working, and not working coz of laziness :), Decided to give a try.  The easiest method was to use the flartook kit.

It already had its framework to communicate with the camera and get data. Which left only the modeling and the marker part to implement. This reduced loads of work. Very good for lazy ppl like me :).  First work was to get an idea of the code and its working. after few experiments and few crashes it was time to implement some code, but wanted some good 3D models. Being too lazy to start and draw a model, had the lazy man’s best friend at my side “The Google” :D. googled for few models and atlast came up with the same model which we used for our animation project.

Now that reminded me, i already should be having the source files of the Animation projects. A quick search revealed i have misplaced tat too 😀 . So thanks to Dinesh who actually had the copy the source files and was not lazy. So got the code up and running and here is what i ended up with.

The maker is available here

Rather than printing the marker and then showing in front of the camera, Upload the marker to your smartphone or ipods and then just flash the smartphone in front of camera. Saves the time of printing :).

One Too Many

8 01 2011

The number of programming languages that are available in the world now is astounding. WikiPedia counts the number of programming languages currently available in the world at more than 700 and that too without counting the numerous versions of the same language in the market. Even with all these programming languages, the end result of such programming languages are to compile it and get the output.

When it comes to programming, all programming language have the same property. They all follow a similar software design. The software design is so similar that it can be literally converted to any of the programming language with some work. Its just they syntax used in the programming  languages changes. With the companies wanting to establish their own proprietary version of the software, rather than trying to support the existing system, this language flood happens. If all programming languages are taken in account, they all have a conditional statement, a looping statement, functions. Where in higher level programming language also add the concept of OOPS to the list. So take any programming language and break it down to its system design, we can fill it up with the basic rules and statements like the above.

This becomes a problem when programmers are given tasks which are to be completed in programming languages not familiar to the programmer. Even though the programmer would be able to entirely come up with the design and can even make the code work in the language the programmer is familiar with. The worst part would be the growing of new programming languages. Its more like the programmers would have to keep learning new programming languages. This is more of a redundant task of learning new syntax for the same system design.

With too many programming languages already taken its strong roots in the community, its not easy to make a change to unify the programming language and make a single powerful language. But its still possible to make a programming language which can have a wrapper to all possible languages. Of-course now all programming languages have the same feature to allow them to be coded on a single programming language. This can be taken care by making the language smart enough to detect functions which are allowed on the required result specified.

This would free the programmers from learning new languages every time a new language comes to the market. Rather they would be able to concentrate on trying to sharpen their skills. Every new programming language that comes out just needs its own wrapper written to be able to work with the unified language.

Waiting for the day when some one would come up with such a product rather than add one more the existing language list.

Unity3D does stand upto its name.

8 01 2011

After the a happy life of doing the Masters. Its the time to for the job hunting. With many interview comes the exposure to many different kinds of interview, and also comes exposure to the kind of projects the companies work on. With singapore motivating for people to become entrepreneur , There are loads of start up companies which tons of creative ideas to implement. Getting to know such companies and the ideas they are planning to commercialize.

During my hunting we had couple of opportunity to attend such companies. One such company is the 3rdplanet .Of-course there would be nothing in the home page yet, other than a coming soon page. The ideas the companies working on are very interesting. This provided us with the opportunity to learn about a totally cool game engine Unity3D.

The main feature that was impressive about the product was that it can run on literally any platform, may it be Mac, PC, Andriod , iOS devices , Xbox , PS3, Wii, any browser. Now you can see that it can run on almost of the popular device that is out there in the market. Another feature of interest is the development enviroment. Unlike other products which support development for multiple environment, the environment need not be pre-configured before starting the projects. Instead create a project and develop it as it would be done normally. Once all the development is finished jus need to specify the device when building the final product. This provides with a very consistent development environment, and also provides with a consistent project over all the platforms.

This is the first product we have seen that does not restrict the user to do the coding on the proprietary language. Instead Unity supports Javascript , C# and also Boo Scripts. I have no idea how they managed 3 totally different languages to interact with each other seamlessly.  With multiple device support , multiple language support for coding, multiple platform support for project development, Man! this is one serious product to watch out for.

We had a run of the product on our Mac, to complete one of the assignment provided to us. It runs smooth on the macbook pro. No problems at all.

As seen from the above screenshot, the interface is pretty simple. With all the advanced features neatly arranged into the menus and drop-down boxes. Those who are familiar with the 3D tools already available in the market should find this in the same territory . The coding part of the Unity3D seem a little weird to common method of programming. When it comes to animating a object, the code does not take the object , the kind of transformation to make as parameters. Instead the code is made generic, as in the code can be written and then attached to any required object to execute for the particular object. This makes the animation work for with animations with better options than transformations like using curves, linear curves etc to to define the animations. Also combined with the language to code on. Its pretty hard to get the head around it, if someone is not familiar with the language and also the structure. It would have been much better if there were more sample codes provided for the functions.


This is a third party plugin for Unity3D which takes care of all the basic animations with no need to program. This is pretty easy to use and also have loads of options for pretty much any animations that is required.



We tried to work on the Unity3D using some 20 texture files of around 4000×4000 pixel resolution each. Even that was crashing Unity3D on the mac computer. Even when the computer was running on its max performance more. Not sure if Unity3D requires even higher end configurations to work.

On the whole this one product which takes the idea of unification of multiple platforms into a single development API.


Encoding of images to videos and Upload to web using PHP

29 12 2010

Web programming was never my cup of coffee. Its been always a black-box, which works just some how and should not be tested how :D. As part of my assignments, i was given the “black-box” task of converting a set of images into video, as if that is not enough also have to connect some how to youtube and upload the the account of the users choice.

The best part being all of this needs to be done in Silverlight. This was the first time i was getting to know we could even do programming in silverlight :D. So with the task assigned it was time to execute the unknown. After a bit of consultation with the programmers best friend “the Google”, figured out its easier to use PHP for this process rather than Silverlight. Also Silverlight does integrate with well with PHP .

The encode i chose for the my assignment was the FFMPEG. The advantage of this program other than it being free is that, its cross platform compatible and also all the features of the program can be accessed and manipulated via command line. This is the feature i plan to use as i dint have much time to go into actual video encoding programming. In-order to make sure the images are read in the correct sequence to make into video, the images get named in a specified sequence. Mostly numbers starting from 0, 1 and so on. This is easier to be read from ffmpeg command line method.

The following code can be used to convert images to videos

ffmpeg -r 10 -b 1800 -i %03d.<image_extension> <video_name>.<video_extension>

Where 10 specifies the frame rate , 1800 denotes the bit rate and the images are read in the sequence of 000.jpg or 000.png etc to 001.jpg , 002.jpg etc. This simple one line code would provide with the video in the folder in the same folder.

Next was the video uploading part.  Zend framework provides excellent support when it comes to Video processing with YouTube. The installation of the frameworks is also pretty straightforward.


Step 1: Download Zend Framework

Step 2: Add the path of the Zend library to the “php.ini”

Step 3: Enable openssl.dll in “php.ini”

Step 4: Restart server.

And that would be only step up required to install Zend. The samples present along with the Zend provide the code for video upload to YouTube.


A try on Mobile Game Programming

5 04 2010

The assignments get interesting day by day. And this time it was out of the animation and into mobile game development.  This was part of the course project for Mobile game development course. It was a last minute decision to get into the course and i shall be happy i did.

As the other assignment had it , this also came up as a team project and teamed up with some geeks to make my work easy 😉 . This time it was actually a team of four. Myself , Viv , Ship and Keer  Programming in JME was way more complex than i had first imagined. Expected the JME programming to be exact copy of normal hava programming with jus specifying the screen size to make it work on mobile . Sadly when I was introduced to JME in the first class it reminded me more of the assembly level programming that we did in my bachelors than the java programming.  Still no thrill in trying to work on something we already know 🙂 . With a totally crazy team to work with this was a fun assignment.

The problem is always the start. With no idea on where to start the example codes came to the rescue. Next was the plan on what our game is gonna be. Starting from blood and gore to baloons flying around. It was atlast decided to be a maze game , as we had more samples to refer on those. The coding was kinda tuff . As every part of the coding has more error than the number of lines coded 😀 .

After hours of brainstorming , and loads of creative debugging from team. It was done. The Buzz Home started to take shape. After adding some extra stuff to make it look good. As music ,  other stuff. It was time to test the game.  Then came the next big challenge. The game fails to run on the mobile, which is what its actually intended to work on. Man what a disaster! Again the team came to rescue and it was few clever dynamic initializations that made it working.

Ah well now for the formalities. I would like to thank my team for helping me out soo much with the project and also having the patience for my nagging :D. thnx all


And the game can be downloaded here

Game Details:

Resolution : 320 x 240

Controls : joystick

Levels: 6 (Working on more)

Game works on most mobiles which supports jar, Part of the splash screen usually gets cropped in mobile with smaler screen.

Tested on w995, n73 , c501, n79.

Comments welcome…..  🙂

Installing Image libraries in mac

7 01 2010

Mac does come with OpenGL and GLUT preinstalled, But when it comes to Image processing libraries , they rely on mac specific libraries. Since my project requires a cross platform structure, i had ignore the preinstalled libraries and search for cross platform libraries. When it comes to Image Procession the most popular library is OpenCV by intel


OpenCV logoOpenCV is very popular and it is has the similar features of image processing as Matlab Image Processing toolbox. Installation of OpenCV is pretty straight forward. There are few binary available in the net , but most of which work only for the sample program attached in the binary. So its better to compile the framework from the source.


Step 1: Download the Source from sourceforge

Step 2: Extract the package

Step 3: Remove the spaces present in the extracted folder name (ie rename the folder to some simple name , I use OpenCVsrc)

Step 4:Open Terminal and go to path where the OpenCV is extracted

>cd <path>/OpenCVsrc

then run the shell script


Step 5: Once this is done , a new folder is created under OpenCVsrc with the name OpenCV.framework. Copy this to the framework directory.This directory is under /Library/Frameworks.

And now the framework is available under xcode frameworks to add and compile. OpenCV for mac is available only in i386 architecture. So the architecture in Xcode needs to be changed before compilation. An alternative method to install OpenCV is to use cmake.


CImg LogoCImg is a opensource Library which provides simple classes and methods to Load/save various file formats, access pixel values, display, resize/rotate/mirror/filter and draw primitives. There are loads of classes , which makes programming with cImg easier. Buts its not as powerful as OpenCV.

CImg needs no installation, just needs ImageMagick to run. Image magick takes care of the behind the scene operations on CImg.

CImg can be downloaded , the header file can be directly used to in programs. No compilation necessary.

Program Compilation

>g++ -o <Executable name> <Program name> -O2 -L/usr/X11R6/lib -lm -lpthread -lX11


ImageMagick LogoImage Magic, another opensource image processing library . This is required by CImg for compilation. This has variety of features like

Format conversion, Transform , Resize , Transparency, Draw, Animation , Special effects etc.

The installation is as follows

Step 1: Download the Binaries from imagemagick or from the ftp site

Step 2:Create (or choose) a directory to install the package into and change to that directory, for example:

$magick> cd $HOME
Step 3:Next, extract the contents of the package. For example:
$magick> tar xvfz ImageMagick-x86_64-apple-darwin10.2.0.tar.gz
Step 4:Set the MAGICK_HOME environment variable to the path where you extracted the ImageMagick files. For example:

$magick> export MAGICK_HOME=”$HOME/ImageMagick-6.5.8″
Step 5:If the bin subdirectory of the extracted package is not already in your executable search path, add it to your PATH environment variable. For example:

$magick> export PATH=”$MAGICK_HOME/bin:$PATH”
Set the DYLD_LIBRARY_PATH environment variable:
$magick> export DYLD_LIBRARY_PATH=”$MAGICK_HOME/lib”
Step 6:Finally, to verify ImageMagick is working properly, type the following on the command line:
$magick> convert logo: logo.gif
$magick> identify logo.gif
$magick> display logo.gif
Program Compilation

g++ -o <Executable Name> <Program Name> `Magick++-config –cppflags –cxxflags –ldflags –libs`

OpenCV is in i386 architecture while CImg and ImageMagick are in x86 architecture. OpenCV is dependent on third party libraries like libjpeg etc for handling various file formats, so have a backup of the libraries before modifying these libraries.