Monday, August 23, 2010

Ubuntu no VirtualBox sob Windows


Se você quer rodar o Ubuntu numa Virtual Machine (aqui, VirtualBox) instalada no Windows, e compilar o kernel, esta é a fórmula perfeita.
Isso é bom pra você se acostumar com um SO novo, fazer suas experiências malucas de compilação de kernel - sem medo de danificar logicamente, pois é só um SO virtual (que redundante, não?).
Infelizmente estou sem espaço no meu disco a ponto de criar uma partição, então essa foi a melhor saída que encontrei, além disso, me possibilita rodar os dois SOs ao mesmo tempo e ficar me divertindo, até que eu migre para o Linux.

Passos para compilar o kernel linux-2.6.35.3.tar.bz2 dentro do Ubuntu (ubuntu-10.04.1-desktop-i386.iso) com VirtualBox 3.2.8 rodando no Windows como host (VM).
  1. Baixe o VirtualBox e instale (http://www.virtualbox.org/wiki/Downloads);
  2. Baixe a imagem do Ubuntu (ISO) (http://www.ubuntu.com/desktop/get-ubuntu/download);
  3. Baixe o kernel do Linux e salve em uma pasta qualquer (http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.35.3.tar.bz2);
  4. Instale o VirtualBox;
  5. No VirtualBox, crie um novo sistema operacional, escolhendo tamanho de partição, entre outras opções. Neste exemplo usou-se o Ubuntu como target e o Windows como host. Isto é, o Windows emulará o Ubuntu, o qual compilará o kernel;
  6. Carregue a ISO do Ubuntu na tela que se abrirá no VirtualBox, após este ter sido instalado corretamente;
  7. O Ubuntu será automaticamente carregado. Instale-o na partição criada pelo VirtualBox - não se preocupe com a formatação, já que a partição criada pelo VirtualBox é virtual e não afetará seu sistema;
  8. Terminada a instalação e iniciado o Ubuntu, no VirtualBox, compartilhe a pasta na qual o kernel do Linux se encontra (Dispositivos > Pastas Compartilhadas);
  9. Clique em Dispositivos > Instalar Adicionais para Convidado. Isto criará uma pasta no Ubuntu, que estará rodando (após a instalação ter sido concluída);
  10. Como root, execute o arquivo .run correspondente ao tipo de arquitetura da máquina (e.g. sudo ./VBoxLinuxAdditions-x86.run);
  11. Ainda como root, crie uma pasta onde você deseja que a pasta compartilhada apareça (e.g. sudo mkdir /media/windows), já que estou rodando o VirtualBox no Windows (host) e desejo compartilhá-la com o Ubuntu;
  12. Faça o mount passando o nome do link que foi feito pelo VirtualBox (e.g. sudo mount -t vboxsf WindowsDesktop /media/windows). No meu caso, no passo 7 chamei de WindowsDesktop o caminho da pasta que desejo compartilhar;
  13. Após isso, você poderá ver o conteúdo da pasta do Windows, pelo Ubuntu. Isso porque o kernel está nesta pasta. Portanto, copie o kernel (linux-2.6.35.3.tar.bz) desta pasta para o local desejado no Ubuntu;
  14. Descompacte o kernel em /usr/src (e.g. tar xjvf linux-2.6.35.3.tar.bz2 -C/usr/src);
  15. Copie o arquivo config (e.g. config-2.6.32-24-generic) da pasta /boot para a pasta onde o conteúdo do pacote foi extraído (cp /boot/config-2.6.32-24-generic /usr/src/linux-2.6.35.3/);
  16. Baixe e instale a biblioteca ncurses com o comando: sudo apt-get install libncurses5-dev - ela é necessária para o próximo comando;
  17. Digite 'make menuconfig' para abrir o menu de escolha do que será agregado ao kernel a ser compilado;
  18. Configure o kernel do seu gosto;
  19. Digite 'make' para gerar o novo kernel;
  20. Digite 'make modules' para compilar os módulos do kernel.

Wednesday, July 14, 2010

Previous Demo Enhanced

This is an enhanced version of the previous example.

You can still use the arrows to control the plane and also use the left mouse to zoom in, and change between cameras using keys 1, 2, 3 and 4.

Again, AS3 and Papervision3D is surprising me.

Thursday, July 8, 2010

Papervision3D + AS3

Hi!

These days I started reading a book called Papervision3D Essentials - which I highly recommend.

In this book there are several examples on Papervision3D usage. Basically, Papervision3D is a set of libraries (API) which can be used to performing 3D manipulations in Flash, an extension of its 2D ordinary capabilities.

After reading some chapters, I, who hasn't any previous knowledge in ActionScript programming, was able to create a nice simple demo, which I posted here you check it out by yourself and take the appropriate conclusions of some of the capabilities of Papervision3D and ActionScript 3.

To control the paper plane use the keyboard arrows (Up, Down, Left, Right).

Have fun!

Friday, June 18, 2010

Back to basics

This is neither a computer science post nor a science post in my point of view, but rather a call of attention on a very important topic: When will we revise the basic principles of behavior based on how nature works? That may sound strange at first glance but I'll try to explain what I mean with that on the next lines dropped right below.

Undoubtedly we have grown and we have been growing for more than a million years, our brain has developed, we started to create things according to our needs, and here we are, on the Internet and with other many technologies, believing that we are on a ascending chart (and maybe we are). Certainly you have already questioned yourself about it, hadn't you?

The thing is: the more we talk about technology, money or whatever creations we did, we seem to forget more about how we care about the other, before you get into the wrong conclusion, let me exemplify that: Do you know when someone calls in you the middle of a task and then you say: "Wait, I'm almost there, I'll talk to you just after I finish"? This is a famous phrase, everybody uses that, but that become an horrible habit humans got. Why? Because our "task" is taking centuries, thousand years - the planet has called us, kindness has called us, unconditional love has called us, poverty has called us, violence has called us, but we seem to ignore them completely, not once, but on a daily basis, we just continue walking on our own pace. People are getting children, growing them as they did in the past, same concept base, same focus, to keep this habit of us alive. This may sound strange, but before you place a crucifying comment, I ask you to stop and think about that inertia we, as humans, have.

What worries me is that we have tremendous knowledge on many areas, but we neither revert back these knowledge, at first, to the areas which has called up our attention, nor consider them as top priority to create a consistent base for the future. We just go back to them in case they got something we need to continue our task, then we simple leave them alone again. Here you may argue saying that there are groups which are working exclusively to these areas, but they are few and their force is occluded by the biggest one, which is the one promoted by us. Besides that, these groups shouldn't be groups, these groups should exist in every single person, inside their mind.

I'm not saying that we should stop everything, as it may sound, but we should give equal importance to other questions rather than just focusing on the "BIRTH-WORK-DEATH" cycle. Remember, our coffins do not have a place to store all accumulated money we got, we neither can use it on afterlife.

If we go back to nature, we see it keeps its behavior for a long time - a dog will always swing its tail, even for a foreigner, and probably it did that for more than a thousand years. But we humans change a lot, and here it starts all questions: Do we follow this nature path? What has happened to us to become so selfish? Is this our nature?.
In one decade the trend is to be peaceful, while in another things are different. Why this happens?

My conclusion is that we create things to find our essence, in another words, our point of balance. We born unbalanced.

Tuesday, April 13, 2010

Histogram Mastering Tool

Today I created a tool to help me out training histogram recognition which has high chances of being a question among others on the exam for Vision and Image Processing discipline held by Prof. Roberto Hirata Jr. from IME-USP.

Screenshot:


Short description:

This tool randomizes histograms from various images and then let the user pick one which can be either a wrong or the right one - a score is used and will depend on the right number of answers versus the wrong ones for each different image loaded.

The software can be started in two different modes:

1. Using a default set (preset) of images which comes along with this application
2. Using a group of images chosen (browsed).

When the program starts it generates the histogram of all images and for each image displayed on the screen it associates a set of random histograms, but in this set only one is the right one, in another words, the one which corresponds to the image displayed.

If the wrong histogram is clicked, the histogram background color becomes red to indicate error and a point is subtracted from the score. Otherwise, the background becomes green and a new point is earned.

The number of false histograms can be defined by dragging the track bar below the last histogram of the set - this can be understood as the difficult level or something like that.

The software was developed with C# and AForge .NET, a great computer vision library developed by Andrew Kirillov.

Download steps:
  1. Download the .NET Framework 3.5 or higher if you do not have it;
  2. Download the Histogram Mastering Tool (HMT) application here;
  3. Unpack the content on a folder of your preference and start the executable inside.
Please post bugs under this section or send me an e-mail (profissional at gmail dot com)

Best regards,

Thursday, April 8, 2010

Proton spin simulation

These days I started the development of a 3D proton spin system which is influenced by external magnetic fields and radio-frequency pulses - this is useful for understanding the basics of NMR (Nuclear Magnetic Resonance).

I'm using C# with XNA - the models were created on 3dsMax 2010 but since they are very simple, any other program would do, including old versions of Max. Besides that a shader is used
and, of course, linear algebra to do the rotation and precession movements.

Here is one screen-shot (I expect to post others in future):


*I'm currently looking for tips on how to calculate the gyromagnetic ratio for all unpaired protons of all elements in the periodic table, so if you know how to do that send me an e-mail, you'll be welcome.

Wednesday, August 26, 2009

Time-of-flight cameras and displacement maps

These days I've stumbled upon a very interesting topic: Time-of-flight cameras.

I heard that Microsoft is using them to capture 3d coordinates of players on the amazing Project Natal.

I'm on a project (hobby) that needs that. I don't want to have two cameras to capture users from front and side but instead a single front camera which would know the depth of stuff I need.

Time-of-flight cameras are useful in this matter since they locate points on 3d space according to the light analysis. For more information plaese refer to http://en.wikipedia.org/wiki/Time-of-flight_camera, or any other topic about that on the Internet.

When I was playing around with 3ds Max some time ago I verified a very interesting feature of it called: Displacement Maps.

Quickly, displacement maps provide a mechanism to create a surface where dark areas of the picture (map) will create valleys and brighter areas will represent the mountains. This is: the darker, the deeper and the brighter the higher.

I made some tests with a picture of me with some gloves I got and the result was exciting (check below). I expect to work on that and implement it on C# with AForge help and in future XNA.

See you next time,

1. Original picture


2. Original picture loaded on a plane.


3. Plane with Displacement applied (perspective view).

Sunday, July 26, 2009

Computer Vision

Hey!

It's been a while since my last post, I was in a bunch of compromises and I decided to travel last two weekends to loose, my routine was mind sucking and talk to some great people I haven't met for some months and I must say that this quick chunking recharged my batteries.

I don't know why but I decided to take a break on the 3D Modeling but that I mentioned on the last posts, I think I crossed against a small project that I thought I could conclude on a single week but this project is taking more than that.

I'm using C# and AForge (computer vision library for C#) in order to do body tracking and collision with virtual objects in real-time video. I got stuck on some Asynchronous problems and Marshalling but I could move on the problem I'm getting now is a very understandable one: performance.

Imagine a 30 fps video file coming to you and you want to apply all filters on it. You have 33 ms per function to do everything before a new frame comes in (1 second = 1000 ms; time per function = 1000 ms / 30 = approx. 33 ms). I'm getting 222 ms per function, it won't be an easy job to do that in C# (I know C/C++ would be faster, but I would've to waste many time on UI and things like that and AForge provides lots of great functions and support that made me use C#).

I'm posting the current result of my processing, these images are completely test and won't be used on the final project, so just pay attention on the idea itself which is: remove the background and provide corner detection for future usage on collision detection.

This is the original image.

This is the image after background removal and corner detection. Unfortunately the corner detection still have to be worked - it is not detecting correctly due the brightness it uses to detect corners, so I have to decrease that a bit so the corners can be seen by the algorithm. Talking about that, if someone would like some directions on corner detection algorithm I'd recommend Susan Corners, which I'm using here (provided by AForge).

And that's it.
Next days I intend to finish this and resume the 3D Modeling book plus study more to the Master appliance test on Electrical Engineering.

See you,
Caio.

Friday, June 26, 2009

Cloud Computing

These days, where broadband gets faster enough to stream information in a faster way, some interesting applications arise. These days, two of them called up my attention, they are:

eyeOS:
http://eyeos.org/

Sumo Paint:
http://www.sumo.fi/products/sumopaint/index.php?id=0

Cloud Computing is really a fact which cannot be simply ignored. Don't you know what Cloud Computing is? Google is a great example of that. You don't know where your mail data is stored, sometimes they are stored in different places around the world but it shows to you (the final user) as a single entity (transparency property). Nice, eh?

Tuesday, June 23, 2009

3D Modeling

Last week arrived my book on 3D Modeling. A very nice book, which I would recommend for everyone which wants to learn fast 3D stuff. The book is called 3D Modeling for Games from Andrew Gahan. It comes with a great DVD which is used on the whole book.

After I bought this book I joined the board below:
http://www.3d-for-games.com/forum/index.php

There are lots of nice and skilled people there, Andrew (Andy) is also there and can help anyone - for free, kidding :P

I'm still reading the book so I intend to post things related to it while I do the exercises and things like that.

IT Governance

Last month I presented my MBA thesis on IT Governance. It was very gratifying to finish the course, it was very helpful for my professional career although I'm not putting this in practice on my current job I certainly will do in future.

This topic was created because today I finished reading Peter's Weill & Diana's Ross IT Governance book. The book covers some interesting topics on IT Governance focusing on many different aspects without bind the reader to any of the existent frameworks or technologies but pointing what should be done in order to make IT support the company's strategy.

Now I'm starting to read an algorithms book. But before someone asks me, I say: Yes I know how to program. The thing is that I'm studying for a Master exam which will be happening by the end of this year, so I expect to pass on it and since this book was recommended, why not read it? It seems very complete on this area. Book name: Data structures and their algorithms - authors: Jayme Luiz Szwarefiter & Lilian Markenzon.

The Master program is about Human Computer Interaction mostly, nice isn't it? Hope I can study everything needed until October :P

Introduction

When I was young I though that I loved games* in general but after I grew up I verified that not only the games are nice but virtual reality is also a nice topic in Computer Science and it doesn’t have to be a game to be fun: augmented reality is an example (I expect to talk about that on another topic).

I grew in the 80’s, so yes, I played the ATARI, passing to the SEGA’s Mega Drive, Nintendo’s unforgivable Super Nintendo, and the Sony Playstation with its astonishing 3D graphics.

I’d be unfair if I didn’t mention the PC games, they’ve always accompanied me parallel to consoles.

I thought of computer as something mysterious, a simple box a complete interaction but not a finished experience, something that every year evolves and changes the way people work, behave and conduct their lives. How a box can bring you fun, information, relationships and many things in such diversity. How people put such things inside of it? How it works?

With all those things in mind I decided study Computer Science.

I’m not going to describe the whole course, but it was very important for me, I discovered that as a woodworker can create useful benches I could create useful softwares and that these softwares would depend on what I want it to do.

To create softwares you need knowledge about many things, for example, if you want to create a software about water treatment you should know not only what water treatment is but how that works and how companies of this segment are work. Besides that, one thing is indispensable: a programming language. A programming language instructs the computer to perform some actions according to your needs.

Nevertheless, along the course I learned many interesting technologies, one of them was mobile development. I watched a lecture about a guy which was talking about something very recent at that moment, it was the .NET framework. He was saying that it was a powerful technologies and one could create many applications easily, also for mobile platforms, such as cell phones, PDAs, Palms, etc. In that moment, my curiosity awoke. I remembered the old times where I had some mini-games devices (bought by my father after I cried a lot to him – thanks dad) so I though that creating games for cell phones would be the next step in games.

I could not imagine but that was the start of my journey, the first spark. I decided learning how to program in mobile devices, that’s where I came across BREW a C/C++ API for CDMA cell phones, mine was one, so I decided to learn it. I had to learn many things, I read two books about it and created a project to put the experience on practice, this was my first game. Successfully I could commercialize this game on Venezuela after mailing many publishers.

I got a job on that area, which was very gratifying. I felt the value of my sweat and all effort that I had put to make this happen.

Unfortunately, here in Brazil companies are very small and that time I was looking for a better job so I changed again, this time not for a game company, but the passion for games is still there.

Since then, I’ve been studying computer games by my own, and I’m crossing against many interesting topics which I want to share with people and that is the main reason I’m creating this blog. So if you feel somehow similar to me, do not hesitate in following it, we can share some good experience over this area.

These days, I verified that being a computer scientist is different than a programmer. A computer scientist has a compromise with science as the name says. In my understanding a computer scientist should research at least whilst a programmer needs to make the computer perform what is needed by the project.

I intend to focus on Augmented, Mixed Reality; 3D Modeling; Programming; Human Computer Interaction and new technologies.

Thanks for reading,

See you soon

*When I say games I refer to computer games and console games