Thursday, December 03, 2009

Visita ao CPTEC


Nossa, hoje fiquei realmente impressionado. Graças ao fenomenal professor Jairo Panetta, pude ir conhecer o Centro de Previsões de Tempo e Estudos Climáticos do INPE, um dos poucos lugares com supercomputadores aqui no Brasil.
Foi um prazer conhecer desde o SX3 ao Cluster 1100, passando pelo Tatuí e outros. Queria deixar os meus parabéns para toda a equipe de pesquisadores e funcionários do CPTEC.
Sei que este post merece ser bem maior, mas queria pelo menos agora deixar algo registrado aqui. :)
Iremos tentar colocar parte do modelo de previsão de tempo rodando em um cluster de PlayStations 3, na arquitetura Cell. Por favor, confiram as novidades no site do projeto: http://code.google.com/p/ps3hacking

Tuesday, October 27, 2009

VisionBlaster lança código de integração entre Unity3D e headtracking

A empresa que desenvolve jogos em Unity3D em São Paulo, a VisionBlaster (www.visionblaster.com), lançou o código fonte do streamer de 6 graus de liberdade com a FaceAPI. Com este código pode-se observar headtracking e uma espécie de realidade aumentada em que o personagem imita a movimentação do usuário. O link para o post encontra-se aqui.

Saturday, October 10, 2009

Games and Teaching

Just as a remark, I'd like to put two links here that deal with the subject of using games in learning and teaching. I see an enormous potential, but I'd like to dive in a bit more before getting to conclusions. Please comment in case you have some idea or other references:
A book about it Games and simulations in online learning: research and development frameworks
An article discussing the fear of games: http://net.educause.edu/ir/library/pdf/eqm0830.pdf
Another great one: https://www.iste.org/Content/NavigationMenu/EducatorResources/YourLearningJourney/CreativityandInnovation/jrte-40-1-023-gro.pdf

Now, some focus on useful games: http://www.gamesforchange.org/

Another great example of using games is showing abuse felt by some people and letting the whole world know about it. I personally enjoyed the idea of Darfur is Dying. Check the cool game here.

It seems Channel 4 has some experience in it: http://www.channel4learning.com/
There's an article about it here:

Thursday, September 10, 2009

Unity3d em São Paulo

Bem, já existe uma empresa trabalhando com Unity3D em São Paulo:
http://visionblaster.com/cms/index.php?option=com_content&view=section&layout=blog&id=11&Itemid=59&lang=pt
"A VisionBlaster cria jogos em Unity3D de acordo com os seus requisitos, seja um AdverGame, algum jogo de caráter educativo ou mesmo algum aplicativo cujo visual precisa ser feito em 3 dimensões (3D)."
Outras empresas, como a AlphaChannel já estão dando treinamento: http://www.alphachannel.com.br/noticia.php?id=259 . Esta tecnologia realmente promete.

Monday, April 13, 2009

Filtrando imagens apelativas com 'Olha o nível!'


Sabe-se que atualmente muitos seqüestros de crianças estão ligados à pornografia infantil. O próprio artigo 70 do Estatuto da Criança deixa claro:

'Art. 70. É dever de todos prevenir a ocorrência de ameaça ou violação dos direitos da criança e do adolescente. (Estatuto da Criança e do Adolescente - LEI Nº 8.069, DE 13 DE JULHO DE 1990.)'

Visando evitar a dissipação de tais imagens, bem como diminuir o caráter apelativo de diversos sites através de imagens de violência e lembrando que a internet é uma mídia interativa, o serviço 'Olha o nível!' foi criado.



Através do site: http://olha-o-nivel.appspot.com/ , pode-se baixar um plugin para o Firefox que bloqueia o aparecimento de tais imagens em uma navegação, de forma colaborativa. Assim que alguém que tenha visto alguma imagem apelativa na internet, pode reportar tal imagem para o site (clicando com o botão direito e selecionando 'Olha o nível!') de forma que outras pessoas que tenham instalado a ferramenta evitarão automaticamente o carregamento destas imagens. Desta forma, as estatísticas de carregamento de imagens apelativas irão diminuir, forçando os produtores de conteúdo a mudar o enfoque de seus sites. É claro, a ferramenta só fará sentido com um número razoável de usuários.

De qualquer forma, fica a dica: http://olha-o-nivel.appspot.com/

Tuesday, March 24, 2009

Python mouse move in 5 lines of code (Linux only)

from Xlib import X, display
d = display.Display()
s = d.screen()
root = s.root
root.warp_pointer(300,300)
d.sync()

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.