Wednesday, May 23, 2012

Angry birds soda in six packs

Angry Birds soda can be now bought in six packs too.

Too bad the packaging is plastic bag, there would have been so many possibilities with cardboard packaging...

Like they could have printed coloring images for kids on the cardboard, or they could have printed "birds nest" or "launch pad" for playing with your Angry Birds plushy toys etc.





Angry Birds soda cans

Tuesday, May 22, 2012

How to cope with tinnitus

I have been suffering from tinnitus from 1994 (since the techno rave era), but it has been severe and affecting my life heavily since 2008.

Recently (from the beginning of 2012) I have seen small steps of progress in my habituation process.

Here are my tips to coping with severe and distracting tinnitus.



1) Accept
Many of us tinnitus sufferers try to find a magical cure, which will remove the tinnitus noise immediately and completely. At the moment, there is no such a cure for tinnitus. After realizing and understanding this cold fact, the attitude towards tinnitus can be changed.

My goal in coping with tinnitus is not "completely free of tinnitus sounds and anxiety" but it is instead "tinnitus is not bothering me at the moment". This goal is a lot easier to reach!

I have accepted my situation, I am hearing tinnitus sound, which is actually quite common phenomena. It is sometimes extremely distracting, but it will be a part of my life for a long time, possibly forever. I can not remove the sound at the moment, I have stopped looking for a cure, I have moved on and now I am trying to improve other areas of my life.


2) Ignore it
One of the most difficult things with tinnitus is that when you think about tinnitus, it will have more and more meaning and the awareness of tinnitus will grow. This will create a never ending loop, unless you will break it.

To break the cycle, just ignore the tinnitus. You can not do it immediately, but you can do it gradually. Stop listening to tinnitus, do not put fingers into your ears and try to measure the tinnitus volume. Do not compare the sound from today to the sound from last week or last month.

Gradually, break the old habits of listening and measuring the tinnitus sound. Do not listen to it every morning in the same spot in the stairs, in your car, at the office elevator or what ever measuring locations you have...  You will notice that it is a lot easier to live, when you do not have the compulsion to listen to your tinnitus! 

3) Think positive
If you can mask the tinnitus sound and there are normal situations in life where the tinnitus sound is masked, enjoy the situation. Do not try to hear the sound, just relax and continue what ever you are doing.

For me, washing dishes or cooking food is quite enjoyable.  I usually put on relaxing music and start to make food for my family. While I am concentrating to cooking, I am not actively listening to the tinnitus sound. If there is a quiet moment, I'll try to listen to the background music instead of tinnitus. This way, I am not hearing (listening to) the tinnitus as long as I am making food.

After some period of time (hour or two hours) without bothered by tinnitus, I will congratulate myself... I have proven to myself that it is possible to live with tinnitus and not get bothered about it. Yes, it was only some hours, but the time can be longer tomorrow and surely it will be longer next week!

4) Relax
Tinnitus often increases when you are under a lot of stress. Logical conclusion is that the tinnitus decreases when the stress is relieved.

I am trying to relax every day while listening to a special relaxation tape, you can found similar sound files from YouTube. I am also using spike mat (acupuncture mat) every evening, or when ever I am feeling tense.

To relax, you can do what ever you want, but it should something that calms you down and relaxes you. Some people do physical exercises, like running or swimming, but for me that is not relaxing at all... :)

5) Listen to natural sounds
I have loaded several natural sounds and relaxation sounds to my iPod. I have water falls, fountains, rain, storms, singing birds, campfire, crickets and Japanese and Chinese relaxation music.

I am listening to these sounds as often as possible, actually all the time when I am at home. It gives to my ears and brains something to listen to, and specifically something else than tinnitus sound.

I have the iPod playing sounds also during the night. For the nights I have loaded "clock ticking" sound to my iPod. This way I can control the sound level for the ticking. Actually I have found that this ticking sound helps me a lot! I just place the iPod next to my bed and set the volume to comfortable level.

6) Sleep
After a bad night sleep, my tinnitus is more noticeable. At least it seems to get worsen if there are several consecutive nights with only few hours of sleep.

Thus I am trying to sleep well. Sometimes it is not possible, but if I am noticing the tinnitus more after a bad night, I can stop worrying because I know the situation will be fixed with a proper hours of sleep.

7) Medication
When the tinnitus hits you really hard, I mean really really hard, it might be a good idea to seek help from a doctor. The stress and anxiety created by the tinnitus should be minimized, because that is actually the worst part of the tinnitus, which will also lead you to the vicious tinnitus-stress circle.

If you are so stressed you can not function anymore, can not work or socialize with your family, perhaps you are crying or can not sleep at all, the doctor should see and understand your situation.






Do you agree with me or not? Do you have questions? Please, leave me a comment!

Thursday, May 10, 2012

Knitted police car

This artist has spent 3 years knitting a life sized police car replica!

 
News post:
http://yle.fi/uutiset/virkattu_poliisiauto_kurvaa_pian_kiasmaan/6089159

More detailed images:
http://www.novita.fi/blogit/576167

Friday, May 4, 2012

Hardware switch for Lenovo wireless radio truly exists

Today I spent some hours trying to figure out why I was not able use the wireless radio (WLAN) on an old Lenovo SL400 laptop.

When I tried to search for wireless networks, the machine told me to "Turn the wireless radio on". I tried to do that by disabling and enabling the wireless device, but the led for wireless connection just blinked for some seconds. Also nothing happened when I pressed Fn+F5.

I updated everything possible with Lenovo's own updater software and tried to enable and disable the wireless network card from BIOS. But still nothing, I was not able to use wlan.

While clicking around the settings, I suddenly got a popup window with the notification "The internal wireless device is set to 'radio off' in BIOS setup or hardware switch".

Because I certainly had checked from BIOS that the wireless was in use, I made the conclusion that there really HAS to be an actual physical switch for the wireless radio usage.

Really, I had to google the "lenovo wireless switch" and with a help of some forum post, I was able to locate the switch, from bottom of the front panel, out of sight. Definitely not an easy place to spot a small black switch!

Oh boy, how I felt shamed! My colleagues told me that every Lenovo has always had a hardware wireless switch. But every model may have it in slightly different place.

Well, this was my first Lenovo, so how could I knew that?!

Wednesday, May 2, 2012

LG tumble dryer error "be"

Recently I got error "be" with my LG tumble dryer.

I found out that the error message means that the drive belt is completely broken. Actually the machine also sounded like the drum was not turning at all. I could hear the motor running, but as the belt was broken, it did not turn the drum.

I had to call a repairman, who was able to change the belt in 20 minutes.

The operation cost me 160 euros. The dryer is 4 years old, and it is the first and last time when I used money to repair it. New tumble dryer costs around 400 - 600 euros, so I think the machine has reached the point where it is not economically wise to repair it anymore.

Naturally, from ecological point of view, it is very wise to continue repair broken devices.

Sunday, April 29, 2012

Fisheye lens equation - Simple fisheye effect with one function


I am interested in many kind of computer algorithms, including algorithms for computer graphics, digital image processing and 3D-graphics.

In one of my projects I needed to have "fish eye lens" like effect, and tried to find easy equation or ready function from the internet. To my surprise, there were not complete functions available, just theories and images how it can be achieved. 

Here is a brief tutorial and loop how to create fish eye -effect to any image. The function is written in Java, but as you can see, it is easily rewritten with any programming language. 

If you find this article and function useful and you will use it in your own projects, please refer where the source came. In any case, leave a comment. Questions and requests are welcome!

What is fish eye effect?

Fish eye effect is a mirror effect which happens when the image is drawn on to a surface of a sphere or a hemisphere. The surface does not need to be a perfect sphere, it can also be paraboloid or have other kind of curve as a surface.

Common effect is, that the image is "zoomed" in the center and "shrink" at the edges. The image is usually round (because we are dealing with spheres) but the image can also be clipped to be square.

Mathematics

What we need is a function which maps any pixel from the image to a surface of a sphere. 

In this fish eye effect, we are not using equations for a sphere, but an equation for unit circle:

x^2 + y^2 = 1 
Solving y
y^2 = 1 - x^2
and then finally
y = sqrt(1 - x^2) 

Because we are limiting all our values between 0.0 and 1.0, we can create values for nice arc when x goes from 0.0 to 1.0.


For example, in the image we have marked x-position 0.75, and we can calculate y-position substituting x in y = sqrt(1 - x^2), which gives us y = 0.66.

For our purpose, we will flip the curve with subtracting the result from 1.0:

d = 1 - sqrt(1 - x^2)

This curve will give us values for the difference of the distance of the source pixel and destination pixel, from the center of the image, when mapping from plane to sphere. 

The new distance is then the original distance added with the difference:

r' = r + d  (r' > r)

Polar coordinates

The normal screen coordinates (two dimensional Cartesian coordinates, simply x- and y-axis) are difficult when dealing with trigonometric functions, because the input values are typically between -1 to 1 and the angles are in radians from 0 to 2*PI.

Everything becomes more easier when you change the screen coordinates (x,y) to polar coordinates (r, theta). This is done with simple functions:

From Cartesian to polar:

    r = sqrt(y^2 + x^2)
    theta = atan2(y, x)
    
From polar to Cartesian:

    x = r cos(theta)
    y = r sin(theta)

In polar coordinates, any point in the image can be accessed with the angle (theta) and distance from center (r).

Now we are able to map any (x,y) pixel to polar coordinate (r,theta), then CHANGE the r, and map it back to (x',y'), and the pixel remains at the same line going through center of the image!

Algorithm 

What we need:
  1. the distance from center of the source image to any pixel (x,y) in the same image
  2. the position (x', y') where the pixel belongs in the fish eye image
In the following pseudo code, we are using polar coordinates. The key part in the whole process is to use polar coordinates and this fact: The actual pixel translation from 2D-image to sphere surface is done with manipulating the distance from center (r).

Pseudo code:

for each pixel (x,y)
    normalize (x,y) to (nx, ny) to be in range [-1,1]
    calculate distance from (nx, ny) to center (0,0)
    convert (nx,ny) to polar coordinates
    calculate new distance from center on the sphere surface
        The new distance is r' = r + (1 - sqrt(1 -r^2)) / 2
    translate (nx, ny) back to screen coordinates (x',y')


The image above shows how Points P1 and P2 will be displaced to P1' and P2', so that the angle remains the same. In other words, the point is displaced along the original line towards the edge of the unit circle. The distance from the center tells us how big is the displacement. In the center and near the center the displacement value is zero or almost zero. Near the edges displacement value grows towards value of 1.0.


The image above gives the idea behind the displacement value. For every pixel in the result image plane, there is a pixel from source image plane. In here, the source image plane is stretched and curved. It may be easier to understand, if you think a one single line instead of the plane. Along that line, the pixels are almost normal at the center, but towards the ends, the pixels are fetched further and further away from the center.

Most important thing


The most important thing is to understand, that for each result pixel, there is a source pixel, on the same line going through the center, but with a greater distance.

The source 

public static int[] fisheye(int[] srcpixels, double w, double h) {

    /*
     *    Fish eye effect
     *    tejopa, 2012-04-29
     *    http://popscan.blogspot.com
     *    http://www.eemeli.de
     */

    // create the result data
    int[] dstpixels = new int[(int)(w*h)];            
    // for each row
    for (int y=0;y<h;y++) {                                
        // normalize y coordinate to -1 ... 1
        double ny = ((2*y)/h)-1;                        
        // pre calculate ny*ny
        double ny2 = ny*ny;                                
        // for each column
        for (int x=0;x<w;x++) {                            
            // normalize x coordinate to -1 ... 1
            double nx = ((2*x)/w)-1;                    
            // pre calculate nx*nx
            double nx2 = nx*nx;
            // calculate distance from center (0,0)
            // this will include circle or ellipse shape portion
            // of the image, depending on image dimensions
            // you can experiment with images with different dimensions
            double r = Math.sqrt(nx2+ny2);                
            // discard pixels outside from circle!
            if (0.0<=r&&r<=1.0) {                            
                double nr = Math.sqrt(1.0-r*r);            
                // new distance is between 0 ... 1
                nr = (r + (1.0-nr)) / 2.0;
                // discard radius greater than 1.0
                if (nr<=1.0) {
                    // calculate the angle for polar coordinates
                    double theta = Math.atan2(ny,nx);         
                    // calculate new x position with new distance in same angle
                    double nxn = nr*Math.cos(theta);        
                    // calculate new y position with new distance in same angle
                    double nyn = nr*Math.sin(theta);        
                    // map from -1 ... 1 to image coordinates
                    int x2 = (int)(((nxn+1)*w)/2.0);        
                    // map from -1 ... 1 to image coordinates
                    int y2 = (int)(((nyn+1)*h)/2.0);        
                    // find (x2,y2) position from source pixels
                    int srcpos = (int)(y2*w+x2);            
                    // make sure that position stays within arrays
                    if (srcpos>=0 & srcpos < w*h) {
                        // get new pixel (x2,y2) and put it to target array at (x,y)
                        dstpixels[(int)(y*w+x)] = srcpixels[srcpos];    
                    }
                }
            }
        }
    }
    //return result pixels
    return dstpixels;
} 

Example pictures 

Original

After applying fish eye function

 

Angry Birds theme park opened!

The world's first Angry Birds land will be opened in Tampere, Finland, within few weeks. However, theme park guests are already able to take rides in some of the attractions.



More videos from here:
http://www.aamulehti.fi/Kotimaa/1194739901549/artikkeli/katso+videot+talta+nayttaa+sarkanniemen+angry+birds+land.html

and here:
http://www.hs.fi/kotimaa/S%C3%A4rk%C3%A4nniemess%C3%A4+aukesi+Angry+Birds+-seikkailupuisto/a1305560876496