Thursday, 14 February 2013

Running Matlab in Awesome

Today I tried to run Matlab R2012a 64bit under Awesome, but I only got gray windows. After googling around, I found that X window integration in most modern Java virtual machine displays gray windows when used with non-re-parenting window manager such as Awesome. According to this post, Sun  JVM 7 shows this symptom for some Java applications, while OpenJDK may work. So I changed the Matlab Java directory to point to OpenJDK's jre and it works.

export MATLAB_JAVA="/usr/lib/jvm/java-7-openjdk-amd64/jre"
To run Matlab from command line, use:
matlab -desktop
To check the environment variables used by Matlab, use:
matlab -n

I found the solution from this forum post.

Tuesday, 5 February 2013

Hand pose descriptor

Left column: hand pose after aligning major axis with x axis; right column: visualization of the cylindrical descriptor

The saturation of the color in the descriptor is proportional to the value of each bin. The hue of the color reflects the depth of the annulus section.

Frame 261: currently classified as class 1 using mclust (k means clustering) R package

Frame 333: currently classified as class 1




Frame 341: currently classified as class 2


Depth images:

Frame 261:


Frame 333:


Frame 341:


Friday, 1 February 2013

R

Vectors vs. lists

Lists are vectors, but vectors are not lists. The elements of a list can be different data types, but the elements of a vector must be the same data type. If you create a vector with different data types, they will be coerced to the same type.

Thursday, 3 January 2013

How to eat dinner

I woke up around 2am today because of hunger, because I only ate a box of cherry tomatoes for dinner.  Then I impulsively finished one bag of pistachios again. This is really bad for losing weight. I realized that sometimes self control is really hard. So why work against the will? If I eat a healthier dinner, I won't have the urge to eat later.

1. Eat dinner 3 hours before going to bed. I'm planning to sleep around 11pm, so I should eat dinner before 8pm.

2. Can do some light exercise before sleeping.

3. If you want to lose some weight, only eat until 50% full for dinner. This means you don't feel hungry anymore, but still want to eat something. You may feel a bit hungry before sleeping. Normally can eat until 70% full. This means your stomach is not bulging and your appetite is reduced. Maybe you can eat a little bit more, but if the food is taken away, you won't regret.

4. If I do exercise at night (like karate), I don't need to ration on food for dinner. But I should eat dinner around 5pm if I do karate at 7pm.

5. Some dinner recipes:

减肥晚餐1.燕麦枣肉豆浆+黑芝麻腰果菠菜+蒸藕丁
燕麦枣肉豆浆:黄豆15克,燕麦、红枣各10克,豆浆机制作。
黑芝麻腰果菠菜:菠菜200克焯熟切段,烤腰果、熟黑芝麻各1勺。
蒸藕丁:鲜莲藕150切块蒸熟,枸杞少量点缀。
减肥晚餐2.牛奶蛋羹+酸奶(100克,全脂、原味)+什锦水果(300克,自己按照喜好组合)
牛奶蛋羹:脱脂牛奶100克,鸡蛋1个。加盐、香油、葱花各少量,混合蒸熟。
营养小提醒
    1 蛋羹操作简单,味道、口感丰富,各种维生素和钙的供应较为充足。吃略有咸味的低能量牛奶蛋羹可以带来正餐的感觉。完全没有咸味时,很多人会觉得食欲不满足。
    2 可以把酸奶先从冰箱中拿出来暖着;先吃一碗热的蛋羹,过一会儿再吃酸奶和水果,胃里会比较舒服。
减肥晚餐3. 凉拌海芽菜+酱牛肉+大拌菜+燕麦大米粥
拌海芽菜:干海芽菜(或裙带菜、海带等)1勺泡发洗净,水果醋或香醋,滴几滴香油。
 大拌菜:生菜、鸡毛菜、紫甘蓝、甜椒各50克撕碎,白米醋、糖、盐或酱油、核桃油各适量。
燕麦大米粥:燕麦、大米各50克,加水8倍煮粥。

6. Drink a cup of soy milk before sleeping to prevent hunger.

Reference: http://snowheart19.blog.sohu.com/238396760.html

Monday, 31 December 2012

Mount DVD drive in Ubuntu

mount /dev/cdrom [dir]
In my case, I mount it in the existing media directory.

Monday, 10 December 2012

Playing videos in Ubuntu

Recently I've been having a problem playing videos in Ubuntu: all I see is a green screen. This happens for Totem Movie Player, mplayer and VLC. So far I fixed the problem in VLC. What I need to do is  to go to Tools > Preferences > Video and choose X11 video output (XCB) under Display Output. Un-checking the "Accelerated video output (Overlay)" works too. Using Xvideo as the output will cause the green screen.

Another useful tool for converting ogv file to high definition mp4 file is Arista Transcoder. You can install it from Ubuntu Software Center.

Also I installed all the libraries for media support mentioned in this post: 3 things to do after installing or upgrading to Ubuntu 12.04. Now I can also play mp4 file in the Chrome browser.

Thursday, 6 December 2012

Video and audio conversion

For video conversion, avidemux is a good tool. Today I used it to rotate a mp4 video by 180 degrees. The instructions can be found here.

For audio conversion, soundconverter is good. I used it to convert a wma file to mp3. The instructions can be found here.