Thursday, May 31, 2012

Do you bite your thumb, sir?

This is a funny story dating back to our kindergarden times. I was telling my kid about Shakespeare, precisely "Romeo and Juliet", and I told him that "biting one's thumb" was an offending gesture in that time. I mean about 500 years ago, in England. It was so interesting for him that he started to bite his thumb "on me". Left thumb, right thumb, both thumbs at the same time... Kids are funny. He also told his colleagues in the kindergarden about it, and for a short while they were all doing it. I wonder whether the teachers knew what was the reason.

Another story, also from the kindergarden. My kid asked my once what is it that I like the most. Without thinking too much I answered "ladies". I did not realize that he was doing his homework and the question was a part of it. On the next day I was given a piece of paper with handwritten sentence "Daddy likes the most the ladies". I lost my reputation, if I had any.

Wednesday, May 30, 2012

Fatherhood & fishing

Fatherhood is full of challenges. My kid likes fishing and occasionally they go fishing with their teacher, my kid with his class. Finland is an ideal place for fishing. There is about one hundred fifty thousand lakes here, besides the sea. Unfortunately I have no idea about fishing. I cannot imagine myself killing a fish. On the other hand it is my job, as a father. Maybe some day I will try. I have to.

Tuesday, May 29, 2012

Castel

This is a screenshot of a castel designed in blender. It is shown only from far away, so there was no need to make it very complex. You can download the blender project here. There are tons of good tutorials for blender and it is definitely worth investing some time to learn it.

One of the amazing features of Blender is its capability to execute scripts. Unfortunately the blender folks have recently changed their API and none of my older scripts works. Bad luck ;(

Our movie has recently stuck since I discovered a wonderful new toy: Google App Engine. Google has created an environment to run for example Java projects on the server side. And it is free. I just love this company ;)

Monday, May 28, 2012

Sound engineering & animations

A tip: while recording the soundtrack for our movie it is important to assure appropriate silence. I mean even turning off the refrigerator, turning off a PC, shutting the windows. In the audacity there is a noise removal but it is better to minimize the noise anyway, so that we achieve a good quality sound.

We can easily measure the duration of the video files typing:

time mplayer movie.avi

Typically we will want to combine multiple video files together, this can be done with the mencoder:

mencoder -ovc copy movie_45.avi movie_46.avi -o result.avi

Not all movies need to be recorded with a video camera, we can also put in between nice animations created for example with the blender. In our movie the wizard writes a letter that is later delivered by a magic bird - this bird is actually an animation.


Sunday, May 27, 2012

Chaos Marines

The Chaos Marines we have painted. We like the Warhammer 40000 ;)

In general I have been trying to show the kid various activities different than the computer games. I like computer games myself and sometimes we play together. However it is important to maintain a balance. Warhammer is an awesome hobby both to paint and to play. I managed to find another one, too - the Dungeons and Dragons. It was a big surprise for me that after a couple months of playing my kid (now 9) expressed the wish to be the Dungeon Master himself. And it works! Of course I need to help him a little, but I would say he is a better Dungeon Master than myself. He is even creating his own monsters and enhancing the adventures with quite unexpected and interesting events. The role playing is definitely an interesting thing to do.

Concerning the Warhammer, we also have some Necrons and Eldars. Necrons seem to be the most attractive for my kid, possibly due to their skeleton-like look. They are also relatively easy to paint.

Saturday, May 26, 2012

Make a movie with your kid! Part3

In order to combine all the frames into a movie (without the sound) we will use a program called mencoder, which comes with the mplayer: http://www.mplayerhq.hu/design7/news.html

All the frames from the directory RESULT3 will be combined into a single AVI file with the command:

mencoder "mf://RESULT3/*.png" -mf fps=14 -o movie.avi -ovc copy

The parameter fps passed above means "frames per second" - it should be chosen according to the original frame rate used by the ffmpeg.

The next thing we need is the soundtrack. I would propose to record the whole soundtrack with audacity - http://audacity.sourceforge.net/. Then we can easily edit the soundtrack adding special effects like for example echo.

It is possible that we will need to cut off a piece of the video. In order to do it type:

ffmpeg -i movie.avi -ss 1 -t 5 -c copy hallo.avi

This will start after the first second and cut off 5 seconds of the video. The result will be placed in the file hallo.avi. You can watch the movie using the totem video player (http://projects.gnome.org/totem/index.html). This will allow you to choose the correct time to cut the video off.

Friday, May 25, 2012

Make a movie with your kid! Part 2

Now render the virtual environment into a file environment.png:


Unpack the archive movie_maker_scripts2.tar.gz to the directory PERL, create a directory RESULT2 and then type:

perl -I../../PERL -f ../../PERL/paste_background.pl RESULT RESULT2 environment.png

After a while the directory RESULT2 will contain the images like this one:

 Success! The wizard is now located in his room.

The next step is optional. We want to put a part of the picture in front of the wizard. Let's cut it off using gimp and store it in a file table.png:


Now unzip the archive movie_maker_scripts3.tar.gz  to the directory PERL, create the directory RESULT3 and type:

perl -I../../PERL -f ../../PERL/mask_paste.pl RESULT2 ../table.png RESULT3


After a while in the directory RESULT3 there will be pictures we wanted:


This gives as an illusion the wizard is inside the virtual world.



Thursday, May 24, 2012

Make a movie with your kid!

I will demonstrate how to put your kid into a virtually created environment. First you need to record your kid and capture an AVI file using the program "dvgrab". It is possible that you will need to install dvgrab. Then connect your camera with the computer using a Firewire cable and issue a command:

dvgrab film.avi

Next we will split the file film.avi into separate frames. This can be done with the program ffmpeg from http://www.ffmpeg.org/.

ffmpeg -i film.avi image_%06d.png

This will create a number of frame files. Now we need to define what "background" means. Use gimp or any similar program to cut off the background from one of the frames.




Store it in the file background.png. Then unzip the archive  movie_maker_scripts.tar.gz to the directory PERL and type:

perl -I../PERL -f ../PERL/detect_background.pl background.png

As a result you will obtain the HVS parameters of your background. Now open the background_remover.pm in an editor and edit the line:

if ($h>=156 && $h<=167 && $v<=162 && $v>=54)

The values should reflect the minimum and maximum for H and V, respectively. Once this is done we are ready to remove the background from all the frames. Go to the directory with the frames, create a directory RESULT and then run:

perl -I../../PERL ../../PERL/remove_background.pl . RESULT

After a while the directory RESULT will contain a number of frames without the background, like the one below:


Now is a good time to learn Blender http://www.blender.org/, or a similar program to build a virtual 3D environment. It can look like:

Note that in this case we used one of the frames to create the wizard's picture hanging on the wall. Next step will be to paste the virtual environment into the frames without background. I will describe how to do it next time.








Wednesday, May 23, 2012

Colorful Dwarves

This is a kind of a maze for children. You begin your quest from the field START and try to find the silver key to open the chest. In order to play you need a small game description:

A01 - In this room you meet the Yellow Dwarf. "If you want I can give you Manuscript in exchange for Purple Key, White Key and Silver Key. If you accept go to D01".
A05 - In this room you meet the White Dwarf. "If you want I can give you Artefact in exchange for White Key, Purple Key and Silver Key. If you accept go to C05".
A10 - In this room you meet the Red Dwarf. "If you want I can give you Cristal in exchange for Purple Key, White Key and Silver Key. If you accept go to B10".
A28 - In this room you meet the Blue Dwarf.
A37 - In this room you meet the Green Dwarf.
A41 - In this room you meet the Purple Dwarf. "If you want I can give you Medallion in exchange for Purple Key, White Key and Silver Key. If you accept go to B41".
A43 - You did it ! You open the chest with the Silver Key and you enjoy the nice sound of gold.
A46 - In this room you meet the Green Dwarf. "If you want I can give you Yellow Key and Blue Key in exchange for Silver Key, White Key and Purple Key. If you accept go to B46".
A51 - In this room you meet the Purple Dwarf. "If you want I can give you Yellow Key and Blue Key in exchange for Statue. If you accept go to B51".
A60 - You remember this place - this is were you started your quest.
B01 - In this room you meet the Yellow Dwarf.
B05 - In this room you meet the White Dwarf.
B10 - In this room you meet the Red Dwarf. "If you want I can give you Purple Key, White Key and Silver Key in exchange for Cristal. If you accept go to A10".
B28 - In this room you meet the Blue Dwarf.
B37 - In this room you meet the Green Dwarf. "If you want I can give you Purple Key and Red Key in exchange for Yellow Key and Blue Key. If you accept go to D37".
B41 - In this room you meet the Purple Dwarf. "If you want I can give you Purple Key, White Key and Silver Key in exchange for Medallion. If you accept go to A41".
B43 - You found the chest, but unfortunately you do not have the Silver Key to open it.
B46 - In this room you meet the Green Dwarf. "If you want I can give you Silver Key, White Key and Purple Key in exchange for Yellow Key and Blue Key. If you accept go to A46".
B51 - In this room you meet the Purple Dwarf. "If you want I can give you Statue in exchange for Yellow Key and Blue Key. If you accept go to A51".
B60 - You remember this place - this is were you started your quest.
C01 - In this room you meet the Yellow Dwarf.
C05 - In this room you meet the White Dwarf. "If you want I can give you White Key, Purple Key and Silver Key in exchange for Artefact. If you accept go to A05".
C10 - In this room you meet the Red Dwarf. "If you want I can give you Manuscript in exchange for Green Key. If you accept go to D10".
C28 - In this room you meet the Blue Dwarf. "If you want I can give you Coat in exchange for Artefact. If you accept go to D28".
C37 - In this room you meet the Green Dwarf.
C41 - In this room you meet the Purple Dwarf. "If you want I can give you Red Key and Purple Key in exchange for Blue Key. If you accept go to D41".
C43 - You found the chest, but unfortunately you do not have the Silver Key to open it.
C46 - In this room you meet the Green Dwarf.
C51 - In this room you meet the Purple Dwarf.
C60 - This is where you start your quest. You have Blue Key.
D01 - In this room you meet the Yellow Dwarf. "If you want I can give you Purple Key, White Key and Silver Key in exchange for Manuscript. If you accept go to A01".
D05 - In this room you meet the White Dwarf.
D10 - In this room you meet the Red Dwarf. "If you want I can give you Green Key in exchange for Manuscript. If you accept go to C10".
D28 - In this room you meet the Blue Dwarf. "If you want I can give you Artefact in exchange for Coat. If you accept go to C28".
D37 - In this room you meet the Green Dwarf. "If you want I can give you Yellow Key and Blue Key in exchange for Purple Key and Red Key. If you accept go to B37".
D41 - In this room you meet the Purple Dwarf. "If you want I can give you Blue Key in exchange for Red Key and Purple Key. If you accept go to C41".
D43 - You found the chest, but unfortunately you do not have the Silver Key to open it.
D46 - In this room you meet the Green Dwarf.
D51 - In this room you meet the Purple Dwarf.
D60 - You remember this place - this is were you started your quest.

Tuesday, May 22, 2012

Hi! I think it is a good occasion to introduce myself. I was born in 1973 in Cracow, Poland. My surname - Biernacki - is quite popular in Poland, it means someone living in Biernaty, which is a small town I have never been to. As you probably know Cracow was formerly the capital of Poland. It is a beautiful city with a little less than 1 million inhabitants. I have not been there for couple years, though. Now I consider Helsinki to be my home, I have been living here for six years. Six years and a half. OK, that's all for today. See you.

Monday, May 21, 2012

Hello! Welcome to my blog. My name is Pawel Biernacki, I am a programmer. I live in Helsinki, Finland.