Friday, February 27, 2009

ImageJ LiveWire plugin updates

Well, it's been around a year... or two... :)
It was about time to update LiveWire to catch up with newer versions of ImageJ.
The new release is here: http://sourceforge.net/projects/ivussnakes
For a more updated documentation, one should check: http://imagejdocu.tudor.lu/doku.php?id=plugin:segmentation:livewire_plugin:start
I hope it is still useful. Please, write me back in case you've found some installation problems.
I'm also looking for someone who wishes to integrate it to the official tree of ImageJ.

Monday, January 26, 2009

In the middle of bits, PWMs, wires, resin, and electromagnetic waves, TORP (CP01) was born...


January, 25th, around 8:00 pm, during Campus Party 2009, that's when TORP was firstly fully assembled for the first time.
The project aimed at building the first humanoid open source robot in Brazil and it was called TORP (www.theopenrobotproject.org).
The idea was to create a robot that would work as a study platform whose modules would be able to be hot plugged and they could also be interchangeable, since it's hard to unplug a hand from one robot and to couple it to another because of the lack of standards.
Without prior support from public research funds, CP01 (the name of the first assembled version of TORP) was sponsored by several institutes and industries, namely: E3 Futura, Instituto Tecnológico de Aeronáutica, Universidade do Estado de São Paulo, Micropress, RIMA and Campus Party.
For more information about the project, I'd suggest taking a look at http://www.theopenrobotproject.org/ .
I'd really like to thank everyone from the team (please remind me if I've forgotten someone, specially contributers from Campus Party, whose names I couldn't take note):
Alan Morgensztern, Alexandre Simões, Esther Colombini, Guilherme Andrade, Jackson Paul Matsuura, Kauê Silva, Maira, Marcelo Franchin, Melissa Sanchez Freitas, Paulo Vitor Lima, Rafael Ribeiro da Silva, Rafael Toschi Chiafarelli, Ronaldo Carrion, Victor Nalin, and my girlfriend Kathy for all the support. Thanks for my bro and Dé for being there as well :)
And thank You, God, of course, for everything running smoothly :)

If there's anyone interested in the lecture about Computer Vision, here's a link to it (Portuguese only... in case you want it in English, please leave a comment):
http://www.slideshare.net/dannyxyz22/campus-party-computer-vision-presentation


I've tried to gather all news about the project here:
http://tecnologia.terra.com.br/interna/0,,OI3470641-EI12933,00.html
http://oglobo.globo.com/tecnologia/mat/2009/01/25/apresentado-na-campus-party-primeiro-robo-livre-do-mundo-754136596.asp
http://www.gluon.com.br/blog/2009/01/25/noite-de-premiacao-na-campus-party-2009/
http://colunistas.ig.com.br/tecnologia/2009/01/24/cp01-nasce-ao-vivo-na-campus-party/
http://www.ita.br/online/2009/noticias09/campusparty.htm
http://www.unesp.br/int_noticia_2imgs.php?artigo=4041

For photos:
http://www.flickr.com/photos/33142604@N00/tags/campus/

Please, leave your comment about TORP, we'd love to hear your feedback!

Thursday, January 15, 2009

TORP - The Open Robot Project

So, just in case some of you might be interested, here's a link to the official site of TORP - The Open Robot Project (http://www.theopenrobotproject.org/).
Make sure you'll check it out at Campus Party Brasil '09 :)

Tuesday, January 13, 2009

Compiling OpenCV for Gumstix

It's common sense that OpenCV is one of the best computer vision libraries available nowadays and it's certainly very useful to benefit from it in embedded environments. There's a trade-off between locally processing images and uploading them for remote processing, but some algorithms might as well run smoothly on embedded devices.

In order to compile OpenCV for Gumstix, firstly one needs to download it from:
http://sourceforge.net/project/showfiles.php?group_id=22870

The version I've testes was opencv-linux 1.1pre1, but I believe any other release will barely follow the same ideas provided here.
After the file has been extracted (tar -xzvf opencv-1.1pre1.tar.gz), one should configure the environment variables for the compiler:

export CC=/home/developer/gumstix/gumstix-oe/tmp/cross/bin/arm-angstrom-linux-gnueabi-gcc
export CXX=/home/developer/gumstix/gumstix-oe/tmp/cross/bin/arm-angstrom-linux-gnueabi-g++

$ ./configure --host=arm-linux --build=i686-linux --prefix=/home/developer/opencvgum --without-gthread --without-gtk --without-python --disable-apps

Notice that we've defined that the prefix=/home/developer/opencvgum is the place it will be installed when we type 'make install'. By the way, make sure you have created this directory.
Be sure to substitute the /home/developer path to your user path, as well as the /gumstix/gumstix-oe/ to your installed gumstix environment.
We've also disabled the gtk environment since we are not interested in running the GUI applications inside the gumstix. I've also disabled python and building the applications.
Now that configuration has been successful. Type:

$ make


And then:

$ make install

If everything went well, you'll have the binaries and samples installed to /home/developer/opencvgum
Now, it would be useful to try and compile the samples so that we are sure they will run in the Gumstix.
In order to build them, go to /home/developer/opencvgum/share/opencv/samples/c and edit the build_all.sh script.
Make it executable:

$chmod +x ./build_all.sh

And then change all gcc and g++ to its arm-likes. My build_all.sh ended up like this:

#!/bin/sh
export PKG_CONFIG_PATH=/home/developer/opencvgum/lib/pkgconfig/

if [[ $# > 0 ]] ; then
        base=`basename $1 .c`
        echo "compiling $base"
        /home/developer/gumstix/gumstix-oe/tmp/cross/bin/arm-angstrom-linux-gnueabi-gcc -ggdb `pkg-config opencv --cflags --libs` $base.c -o $base
else
        for i in *.c; do
            echo "compiling $i"
            /home/developer/gumstix/gumstix-oe/tmp/cross/bin/arm-angstrom-linux-gnueabi-gcc -ggdb `pkg-config --cflags opencv` -o `basename $i .c` $i `pkg-config --libs opencv`;
        done
        for i in *.cpp; do
            echo "compiling $i"
            /home/developer/gumstix/gumstix-oe/tmp/cross/bin/arm-angstrom-linux-gnueabi-g++ -ggdb `pkg-config --cflags opencv` -o `basename $i .cpp` $i `pkg-config --libs opencv`;
        done
fi

Notice that we've also defined the export PKG_CONFIG_PATH=/home/developer/opencvgum/lib/pkgconfig/ so that the correct includes and linked libraries are built correctly.
Run this command and you'll notice the executable files will be created. I think that if you don't disable the flag "--disable-apps" in the configure application and make this change to the build_all.sh earlier it might also work.

Well, now that OpenCV has been built, you should be able to copy it to your gumstix. There's a small problem though. If you compact the files, you'll notice it's very big, so, a good idea is to delete a couple files we are sure we are not going to use.
An advice would be to delete some of the haarcascades.

Choose some of them you are sure you won't use, like the haarcascade_profileface.xml inside the data sub-directory, for instance. Delete a couple others as well.
This way, you'll be able to create a .tar.gz of around 6.5MB.
When it's done, copy it to your gumstix through scp:

$scp opencvgum.tar.gz root@192.168.YOUR-GUM.IP:/tmp

Make sure you copy it to /tmp, because you'll probably be out of space copying it somewhere else.
Extract it and then try to run one of the demos that does not use windows... the  ./letter_recog application, for instance... it's located at:
/tmp/opencvgum/share/opencv/samples/c

Well, you might be able to see it running. Else, some libstdc++.so is missing error could also happen.
This means you don't have this library installed. One easy way to install it is through the command

$ipkg install libstdc++6

In case some other libraries are missing as well, repeat the procedure with their names. Notice that some packages have odd names.
For instance, if you had typed:
$ root@gumstix-custom-verdex:/usr/share$ ipkg install libstdc++

Then you'd have received the following message:

Nothing to be done
An error ocurred, return value: 4.
Collected errors:
Cannot find package libstdc++.
Check the spelling or perhaps run 'ipkg update'

Actually the name of the library is libstdc++6. Make sure you type the correct library name.

Well, in case libstdc++ is really installed, you might as well get some error like:

./letter_recog: error while loading shared libraries: libcxcore.so.2: cannot open shared object file: No such file or directory

It means the LD_LIBRARY_PATH is not pointing at your opencv libraries.
Simply type:

$ export LD_LIBRARY_PATH=/tmp/opencvgum/lib/

You will eventually be able to run your letter_recognition application.
Well, in case you want to run other applications, like the face recognition one, make sure you disable the GUI related functions and write your results to files.
We'll be able to see it working at Campus-Party Brasil
Make sure you'll be there!

Gumstix UVC drivers

This post describes gumstix uvc driver installation for a Logitech QuickCam Pro 9000. It follows this wiki page as a guideline.
It requires that the steps in this wiki have been performed.
Firstly check-out the old driver sources from:

 svn co svn://svn.berlios.de/linux-uvc/linux-uvc/trunk

After file checkout, one should change the Makefile.
Change the KERNEL_DIR var to point to your gumstix kernel path, as in:

KERNEL_DIR    :=
/home/developer/gumstix/gumstix-oe/tmp/work/gumstix-custom-verdex-angstrom-linux-gnueabi/gumstix-kernel-2.6.21-r1/linux-2.6.21/

Define the CROSS_COMPILE var:

CROSS_COMPILE   := /home/developer/gumstix/gumstix-oe/tmp/cross/bin/arm-angstrom-linux-gnueabi-

Change make lines so that they include your CROSS_COMPILE and ARCH=arm vars:
From:
       @(make -C $(KERNEL_DIR) M=$(PWD) CROSS_COMPILE=$(CROSS_COMPILE) modules)

to:

       @(make -C $(KERNEL_DIR) M=$(PWD) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) modules)

And from:
       @(make -C $(KERNEL_DIR) M=$(PWD) INSTALL_MOD_DIR=$(INSTALL_MOD_DIR) INSTALL_MOD_PATH=$(INSTALL_MOD_PATH) modules_install)
to:
       @(make -C $(KERNEL_DIR) M=$(PWD) ARCH=arm
INSTALL_MOD_DIR=$(INSTALL_MOD_DIR) INSTALL_MOD_PATH=$(INSTALL_MOD_PATH)
modules_install)

Now, type make uvcvideo
The file uvcvideo.ko is built. This file should be copied to /lib/modules/2.6.21/kernel/drivers/media/video/uvcvideo.ko

Nevertheless, if you type make, you'll notice a message like:

-------------------------------- WARNING ---------------------------------------
 The USB Video Class driver has moved to http://linuxtv.org/.
 Using the Berlios SVN repository is now deprecated.
 Please check http://linux-uvc.berlios.de/ for download instructions.
 If you really want to compile this historical version, run 'make uvcvideo'.
--------------------------------------------------------------------------------
which tells us that we are using deprecated files for the driver.
I've tried to use the latest drivers from the Mercurial clone repository, but I'm getting this error:

"/home/developer/uvc-new/uvcvideo-90c7dc24fb4d/v4l/cx18-driver.h:65:4: error: #error "This driver requires kernel PCI support." "

In order to build it, I've changed the root Makefile to:

CROSS_COMPILE   := /home/developer/gumstix/gumstix-oe/tmp/cross/bin/arm-angstrom-linux-gnueabi-

install:
        $(MAKE) -C $(BUILD_DIR) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) install

%::
        $(MAKE) -C $(BUILD_DIR) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) $(MAKECMDGOALS)

And the v4l/Makefile to:

OUTDIR ?= /home/developer/gumstix/gumstix-oe/tmp/work/gumstix-custom-verdex-angstrom-linux-gnueabi/gumstix-kernel-2.6.21-r1/image/lib/modules/2.6.21/build
SRCDIR ?= /home/developer/gumstix/gumstix-oe/tmp/work/gumstix-custom-verdex-angstrom-linux-gnueabi/gumstix-kernel-2.6.21-r1/image/lib/modules/2.6.21/source

I've tried to issue some "make -i" command, but I doubt it will work. If you've made any progress with the new drivers, feel free to comment.
The old drivers have worked pretty fine as well.


Thursday, December 04, 2008

Adobe Flex and Flash Face detection library

I'm interested in developing a flex or flash library that could be used for face detection or augmented reality. I haven't found any on the web so far.
Just wondering how many of you are also looking for it.
[]'s

Wednesday, September 17, 2008

EHCI 0.5 is now ready for PyCon Brasil 2008

Well, it was about time :)
Ehci 0.5 has just been released and it now features Python bindings.

It's pretty easy to use EHCI in Python. The following snippet shows how to do it in 6 lines:

import ehci

ehci
.ehciInit()

while(1):
ehci
.ehciLoop(1,0)
x
,y,width,height = ehci.getHeadBounds()
print "Coord (",x,",",y,") width ",width,"height ",height

These two videos give some idea of EHCI integration with Panda3D:





To download it, check http://code.google.com/p/ehci

Friday, August 29, 2008

EHCI Final Report

Official EHCI project site

Well, it's the end of Google Summer of Code, and I need to say that it was great to be with Natural User Interface Group and with Google support.

As one of the last features that was missing was the ability to browse through an image with the hands, I'd like to post this video here:





The most recent updates since last blog post are the windows binaries, as well as new hand interaction demo.

Windows binaries 6 degrees of freedom head tracking download. This version was compiled without OpenMP support, so it's running way slower than the source one compiled with OpenMP support. It means that it won't work as fine as in Linux.
UPDATE: This new version supports OpenMP

From the updated planning, the features in red have been completed since it was re-planned: (features in blue have been removed from project planning)

1st Month:

Hand and Head tracking. 3D head tracking class. Small OpenGL demos.

2nd Month:

Body tracking, and gesture recognition classes. Zoom and rotation features. Documentation of classes through tutorials, code documentation and demos

3rd Month:

Motion flow and 3d model wireframe tracking classes. Documentation. Project packaging through Google Summer of Code and Natural User Interface sites.
Packaging in Natural User Interface site is supposed to happen in September 3th.

In the end, most of the initially planned features have been implemented and documented.

I'd like to thank:
Everyone from OpenCV project (for creating this amazing library)
Pawel Solyga, NUI (for being such a great mentor)
Thomás Cavichioli Dias, ITA (for teaching me how to use OpenCV as well as for giving me depth information on how to use and create cascade classifiers)
Juan Wachs, BGU, Israel (for creating hand detection cascade)
Stefano Fabri, Sapienza - Università di Roma (for all the interesting papers, articles and attention)
Roman Stanchak, OpenCV (for all the help with Swig and Python interfaces)
Len Van Der Westhuizen (for creating and releasing the head model used throughout the project)
Vincent Lepetit, Computer Vision laboratory, EPFL (for the great survey and advices)
Mike Nigh (for the Irrlicht work)
Jared Contrascere, Bowling Green (for the OpenCV/Ehci/Windows work)
my professors at Instituto Tecnológico de Aeronáutica (for all the knowledge taught)
Johnny Chung Lee, Carnegie Mellon (for his great ideas with Wii)
everyone else that I'm unfortunately forgetting, and
my girlfriend Kathy, family and friends (for supporting me through the project),
and, of course, God, Who has given me the strength, love and support to carry this project!

Wednesday, August 06, 2008

EHCI Updates - Version 0.4 has just been released

(check project site at http://code.google.com/p/ehci)
EHCI (Enhanced Human Computer Interface) now features packaging through a tarball. Installation is supposed to be as simple as configure, make, make install. Besides easier installation, the new version has several features, like:

- New features:
  • Hand detection/tracking: now users can interact with the computer using their hands (notice that no accessory besides an ordinary web cam is being used).



The result can also be seen in a noisier environment in this video.


  • Enhanced lightning model/more robust algorithm: this video shows the new lightning model, as well as the 6 degrees of freedom head tracking in a noisy environment.
- New API:
  • EHCI's new API focuses simple functions, so that developers can completely abstract the OpenCV layer. Example functions:
while(1){
ehciLoop(EHCI2DFACEDETECT,0);
getHeadBounds(&upperX,&upperY,&headWidth,&headHeight);
}
- Installation procedure:
  • Autotools based installation is now available: a simple ./configure ./make ./make install should be enough to get developers able to use EHCI library
  • A distribution tarball is easily downloadable from ehci project site

- Updated documentation:
  • new demos (simple2d and simple3d)
  • cleaned up code (boxView3d and 6dofhead have been cleaned up)
  • tutorials have been posted on project wiki
  • the project now features doxygen documentation

- Robust algorithms:
  • 6 degrees of freedom now considers up to 200 feature points to track, which provides better tracking
  • Enhancements to the algorithm have been researched and are on the way and documented
- Lightning model working:
  • 6 degrees of freedom sample now considers normals for accurate lighting
  • Blending functions as well as a single glut layer have been added
- Tagged versions:
  • SVN tag directory is being updated accordingly
- Python bindings:
  • Python bindings are on the way. SWIG is being researched, as well as some drafts have been developed.

Friday, July 11, 2008

ITA Latex Users Society - ITALUS

Queria deixar um link para o projeto de uso de latex no ITA. Aqui vai uma breve descrição e o link:

http://code.google.com/p/italus

Este projeto visa difundir o uso de latex em teses do Instituto Tecnológico de Aeronáutica, tanto para alunos da graduação como para alunos do mestrado e doutorado. O trabalho hospedado neste site é composto por templates para geração das teses nos formatos requisitados pela instituição.
Conta-se com o apoio de todos os usuários, tanto na requisição de novas funcionalidades, como para atender a uma nova especificação do ITA, ou mesmo para "codificar" estas alterações.

Tuesday, July 08, 2008

Adding keywords to eclipse rcp preferences lookup (search text field)

One might need to add more words to eclipse preference search bar while developing an RCP application. By default, it only looks up for the preference page title. In order to add new keywords, one needs to add a keyword reference and a keyword extension point.
Supposing the plugin.xml has the following sample page:

<extension point="org.eclipse.ui.preferencePages">
<page class="testercp.preferences.SamplePreferencePage" id="testercp.preferences.SamplePreferencePage" name="Sample Preferences">
</page>
</extension>

Add a keyword reference through:

<extension point="org.eclipse.ui.preferencePages">
<page class="testercp.preferences.SamplePreferencePage" id="testercp.preferences.SamplePreferencePage" name="Sample Preferences">
<keywordreference id="marte.keywords.preferences">
</keywordreference>
</page></extension>

And then, add the keyword extension point as:

<extension point="org.eclipse.ui.keywords">
<keyword id="marte.keywords.preferences" label="velocity stopping point">
</keyword></extension>

Now, if anyone types velocity, stopping, or point it will bring the SamplePreferencePage.

There's also a way to add these extensions through the wizards.

Monday, July 07, 2008

EHCI Upate - 6 degrees of freedom head tracking



I'm posting here some updates of the Google Summer of Code EHCI project. This part of the project deals with head tracking with 6 degrees of freedom, a problem often referred as finding the pose of an object. Since no light is being generated from the head - as in some types of infra-red tracking - it needs to rely on natural features of the head. This implementation tries to follow the excellent work from Luca Vacchetti, Vincent Lepetit, and Pascal Fua, from the Computer Vision Laboratory of the Swiss Federal Institute of Technology (EPFL), "Fusing Online and Offline Information for Stable 3D Tracking in Real-Time". The paper is available here


There's a video on youtube showing current progress.

Details

The algorithm starts automatically looking for a head in the image, through the famous Viola Jones algorithm.

After finding the head position, a feature tracking algorithm is started. It uses cvFindGoodFeatures to track in the region of interest defined by the head width and height. When these features are discovered, they are mapped back to a head model (I'm currently using a cylindrical model, but I plan to use the excellent head model by Len Van Der Westhuizen, which is available here, thanks Len!).

When the head model 3d points are known, as well as its corresponding 2d image points, DeMenthon's POSIT algorithm is used to find the initial pose estimation.

After that, an optical flow algorithm by Lucas-Kanade is used is used to track the points along the frames. These points are mapped back to original 3d points and the pose matrix is updated.

The source code shows how to deal with several important OpenCV functions, such as cvGoodFeaturesToTrack, cvCreatePOSITObject, cvPOSIT, and cvCalcOpticalFlowPyrLK, as well as some interesting OpenGL features like loading custum Model View, and Projection matrixes through glLoadMatrix.

I'd really like to thank God and everyone that has helped me develop this work with invaluable tutorials, papers, 3d models, and e-mails,

Links

Posit tutorial: http://opencvlibrary.sourceforge.net/Posit

Explanation of the raw format: http://local.wasp.uwa.edu.au/~pbourke/dataformats/povraw/


The full report is available at http://code.google.com/p/ehci/wiki/6dofhead

Friday, June 27, 2008

ITA Cell Research and the Cell Ecosystem

Well, it's nice to have an opportunity to show ITA's progress with STI Cell research. In June, 23rd, 2008 we had the pleasure to receive the IBMer Ph. D. Robert M. Szabo, from Cell Ecosystem Development Systems and Mr. Flavio Carazato, from University Relations of IBM Brazil.
A presentation with ITA research is available here. Besides showing our work we have also received important Cell related information, as accessing a QS20/QS22 (double floating precision!) cluster at GaTech. A full report of the visit is available in our wiki at http://code.google.com/p/ps3hacking/wiki/2008BobReport. Thanks to Robert Szabo, Flavio Carazato, and all researchers and professors from ITA.

Thursday, June 05, 2008

EHCI Updates

This week I've been working on hand tracking. I've read some important paper about the subject and I've installed softwares that deal with it. Both of them are reported at http://code.google.com/p/ehci/wiki/HandTracking . Besides that I've made some small videos (http://www.youtube.com/watch?v=o1WNb0g0f9Q and http://www.youtube.com/watch?v=Rmh-mZFxWns) showing the behaviour of "Flock of Features" and Viola-Jones Haar Cascades. Both of them yield very good results, each one with a different goal.

While using the Viola-Jones Cascades, I've applied Juan P. Wachs xml training file. This file's been trained with more than 1000 images so that the A gesture (a closed hand pointing upwards) could be effectively recognized. Thanks to Juan for making the file available. Besides that I'd also like to thank Dr. Vincent Lepetit for great directions to follow.

I'm now studying Viola-Jones haartraining in more detail to see if the same approach for generating the closed hand feature can be used for detecting open hands, as well as detection in other directions. I'm also willing to test some 3d model tracking.

Some other minor updates are my faculty's and NUI Group's logos appearing in the front page of the project.

When I get hand detection finished, at least for two closed hands, zooming and rotating features will be able to be implemented, which are the goals of the first month.

Saturday, May 31, 2008

EHCI Update

This blog entry is about an update to GSoC project Enhanced Human-Computer Interface.

Updates:
Videos:



Tuesday, May 27, 2008

Enabling gnome-terminal shortcut under compiz

Just in case the shortcut you've set up for opening your terminal is not working under compiz, try to do the following:

  • Open gconf-editor (in case you don't have it, look for it in your application manager (apt-get,synaptic,yum,etc))
  • Go to apps->compiz->general->allscreens->options and then, look for command_terminal and write 'gnome-terminal' (quotes for clarity)
  • You should be all set :)
I hope that helps,
be with God

Monday, May 12, 2008

Gnuplot in Action - Book review

A great reference about gnuplot is Philipp Janert's Gnuplot in Action. This book explains straight to the point gnuplot concepts, like ploting funtions, reading from a file, selecting columns for plot, exporting plots as images, and creating macros, right in the beginning.
Interesting features, like plotting data that's not sorted as well as multi-line records are also covered.
Smoothing a line with bezier from data obtained from a file "text.txt" is explained to be as simple as:

plot "test.txt" smooth bezier

This book also shows how to create logarithmic plots using gnuplot, with sidebar explanations included.
A crazy example showing how to plot a unix password files is presented, so that some string related data can be shown. Hot keys and mouse are also covered.

There's an entire chapter dedicated to plot styles. Errorbars are covered in the same chapter.

Another very interesting chapter is the one that deals with 3D plots through surface plots (splot) and contour functions.
A nice explanation about terminals as well as macros, scripting and batch operations is done at the end.

Overall, Gnuplot In Action is a depth reference about gnuplot and everyone who needs a deep understanding of this great tool should have this book for handy reference.

In order to evaluate the book, one can get the freely available sample chapter Essential Gnuplot.
One can also get the software through http://www.gnuplot.info/ or by using one's preferred package manager.

Wednesday, April 30, 2008

Generating keypresses on Linux

I was trying to simulate keypress events for some javascript based webpage - actually it was typing the whole alphabet - and I came up with the following code, using Xlib:

#include X11/extensions/XTest.h
#define XK_LATIN1
#define XK_MISCELLANY
#define XK_XKB_KEYS
#include X11/keysymdef.h
#include X11/Xlib.h
#include stdio.h
#include stdlib.h
#include sys/time.h

//notice that libraries are lacking < > because of html tags
int main(int argc, char **argv)
{
Display* pDisplay = XOpenDisplay( ":0.0" );

KeySym key[] = { XK_a,XK_b,XK_c,XK_d,XK_e,
XK_f,XK_g,XK_h,XK_i,XK_j,
XK_k,XK_l,XK_m,XK_n,XK_o,
XK_p,XK_q,XK_r,XK_s,XK_t,
XK_u,XK_v,XK_w,XK_x,XK_y,
XK_z};

system("sleep 4");
int i;
for( i = 0; i < 26; i++ )
{
XTestFakeKeyEvent ( pDisplay, XKeysymToKeycode( pDisplay, key[i] ),
True, 0 );
XTestFakeKeyEvent ( pDisplay, XKeysymToKeycode( pDisplay, key[i] ),
False, 0 );
}

if( pDisplay == NULL ) return 1;

XCloseDisplay(pDisplay);
return 0;
}

In order to compile it, just run:


gcc generateKeys.c -lX11 -lXtst


I hope it helps!

Monday, April 21, 2008

Fisl 9.0



Fiquei na arena de programação, mais especificamente verificando as novidades de desenvolvimento Open Source para Internet Tablets e celulares da Nokia.
O sistema operacional para os modelos 770, N800, N810 e N810 WiMax é o Maemo e o gerenciador de janelas é o Matchbox. O toolkit para GUI é o Hildon, também usado no Ubuntu Mobile (http://live.gnome.org/Hildon , https://stage.maemo.org/svn/maemo/projects/haf/doc/api/index.html). Alguns screenshots do Hildon podem ser vistos aqui (http://test.maemo.org/screenshots.html).
No primeiro dia, a plataforma de desenvolvimento foi o N95 (http://en.wikipedia.org/wiki/Nokia_N95), cujo sistema operacional é o Symbian OS que roda exclusivamente em processadores ARM. Dado que este sistema operacional é proprietário e sua implementação de C++ não é padrão, uma forma interessante de programar para o N95 é através de Python. Através do S60 (http://opensource.nokia.com/projects/pythonfors60/) pode-se fazer aplicações stand-alone e rápido desenvolvimento de protótipos. Um exemplo de aplicação que utilizava a câmera fotográfica para tirar uma foto e salvá-la no sistema de arquivos pôde ser feita em pouco mais de uma hora. Uma excelente referência com tutoriais para o S60 pode ser vista aqui (http://www.mobilenin.com/pys60/menu.htm). E aqui (http://www.mobilenin.com/pys60/resources/ex_camera_viewfinder.py) o código de uma aplicação para S60 que tira uma foto em 19 linhas.
Eis então que surge a pergunta, por que não desenvolver tudo em Java ME? Estas threads dão uma idéia (http://discussion.forum.nokia.com/forum/showthread.php?t=125743 , https://developer.symbian.com/forum/message.jspa?messageID=59978 ). Basicamente está ligado ao fato da virtual machine não disponibilizar algumas funções e à velocidade dos programas. Quando estas duas questões não são importantes, é muito provável que Java ME seja a melhor escolha, ainda mais visto que o C++ do Symbian não é o mesmo comumente disponível nos desktops.
Com relação ao desenvolvimento em Maemo, fica a dica do OpenBossa (http://www.openbossa.org/) com várias soluções interessantes combinando Python, Linux e embedded development.
Aqui (http://labs.vivi.eng.br/blog/?p=44 , http://labs.morpheuz.eng.br/blog/21/04/2008/fisl9-good-start/) há dois posts sobre a arena de programação do Fisl 9.0, explicando o que foi feito em cada dia. Também saiu um post bem engraçado no site do fisl: http://www.fisl.org.br/9.0/www/node/475 .
Fica aqui o meu grande abraço para todas as pessoas que conheci neste encontro, bem como um grande agradecimento pela oportunidade cedida pelo CCA e companhia dos amigos de trabalho :)

Sunday, April 06, 2008

Google SoC 2008 Work Schedule

1st Month:
* Hand tracking/gesture:
1st week: * Study and implement Viola-Jones http://research.microsoft.com/~viola/Pubs/Detect/violaJones_IJCV.pdf paper for hands
2nd week: * Study and implement Flock-of-features http://www.movesinstitute.org/~kolsch/handvu/KolschTurk2004Fast2DHandTrackingWithFlocksOfFeatures.pdf
3rd week: * Study and implement posture recognition and hand gestures http://www.movesinstitute.org/~kolsch/pubs/Dissertation_twoside.pdf
4th week: * Test features and integrate developed code in an easily accessible C++ class. Show zoom and rotate functionalities.

2nd Month:

* Head and body tracking
1st week: * Facade classes for OpenCV already implemented head and body tracking.
2nd week: * Study and implement head distance information.
3rd week: * Combine 2d head tracking and head distance, so that 3d head tracking is done.
4th week: * Integration tests and integrated classes. Deliver small OpenGL based demos and tutorials on how to use the framework.

3rd Month:
* Motion flow and augmented reality
1st week: * Create easy to access objects that react to motion flow, similar to the ones I've developed here: http://www.youtube.com/watch?v=QJvKT-NId9M
2nd week: * Study and implement 3d model tracking through wireframes http://www.bmva.ac.uk/bmvc/2000/papers/p66.pdf
3rd week: * Integrate developed research in easily accessible classes and write documentation.
4th week: * Time to develop side projects as packaging TouchLib for Linux or to use in case prior time wasn't enough for some features.