Thursday, March 28, 2013

Rename the bolg title

My original blog title was ``人 teh 飛, 天 teh 看'' in Taiwanese and the meaning was ``human being are flying and God is watching.'' It came from my old hobby: RC airplanes and helicopters.

After graduating from the university and leaving the lab, my work has been nothing to do with aerial vehicles. I have had no time to keep the RC flying hobby and gradually my interesting (partly due to my work) has been shifted to programming for vision applications.

Maybe one day I will have time to fly RC aerial vehicles again, but for now I am focusing on the topics of image processing and programming and hoping I could get more experiences in the future. So I changed the blog title, which is simple and contains no non-ascii characters, and with the tiny change I could help myself to focus on techniques I want to develop.

Monday, March 25, 2013

Test Kinect in Ubuntu 12.04

In the previous post I tried to make the Kinect (for Windows) work in my Win7 with x86 driver. Actually my first attempt was to try to make the Kinect work in my Ubuntu 12.04 but failed, so I switched back to Win7 to make sure the Kinect is workable.

Several days ago I wanted to test the Kinect in my Ubuntu 12.04, and of course I googled and got OpenKinect. I followed the installation procedure but got no luck and before proceeding on I decided to make sure the Kinect is okay (and therefore `the previous post' about the test in Win7).

This time I followed another tutorial by igorbarbosa and finally got the Kinect working in my Ubuntu 12.04.

My installation steps were slightly different from that described in igorbarbosa's tutorial. I believe it is due to the version changes of avin2's SensorKinect driver.

Now I am sharing my installation and hope it might be useful to you.

Friday, March 22, 2013

Vistalizator -- Easy way to change display language in Win7

Warning: Do NOT use Vistalizator to change your display language. I have encountered something annoying and decided to restore my system. I will post some screenshots of the applications in my Win7 which were affected by  Vistalizator.

For the problems cause by Vistalizator in my Win7, see this post.

Test Kinect in Win7 x64 using x86 driver

In the previous posts [1][2] I tried to rebuild a VS project using Kinect given by my colleague and encountered some problems. Because my Win7 is the x64 version but the project had been built for x86 (Win32) platform, the rebuilding work in my Win7 machine cost me and my colleague almost a whole working day (without my colleague's help, I may give up the rebuilding).

Although I changed the project configuration to x64 [2], there were still problems with other libraries, for instance, OpenCV, built along with the project for x86 platform. When I was wondering the next step, my colleague suggested me to try the x86 driver of Kinect and if it works, just keep sticking on the Win32 setting of the project configuration.

Hmm, it seemed I had taken a long route and headed back to the origin... XD

Okay, the happy news is the x86 driver really worked in the x64 Win7, and here is a working log of the test.

Thursday, March 21, 2013

Change VS2005 project from Win32 to x64

I was rebuilding a Win32 project in my x64 Win7 PC. The online sources [1][2] told me just to change the active project configuration from Win32 to x64, but my VS2005 has no x64 option. Then it occurred to me that maybe I didn't install something related to x64 modules when installing the VS2005, so I checked it by using the installation package.

Wednesday, March 20, 2013

'WIN32': No such file or directory

I was rebuilding a project given by my colleague and encountered strange error message:

c1xx : fatal error C1083: Cannot open source file: 'WIN32': No such file or directory

This error was caused by an empty path variable [1] $(OPEN_NI_INCLUDE) which (I guess) indicates the directory containing the installed OpenNI SDK. It was empty because I forgot to restart Visual Studio after install the SDK... :-p

So the solution is simple: restart Visual Studio and the path variable will be set.

---
Edit:

After solving the previous problem, I got another similar problem which related to the Linker path.

I used the set command [2] in cmd of Windows to the list environment variables about OpenNI:
OPEN_NI_BIN64=C:\Program Files\OpenNI\Bin64
OPEN_NI_INCLUDE=C:\Program Files\OpenNI\Include
OPEN_NI_INSTALL_PATH64=C:\Program Files\OpenNI\
OPEN_NI_LIB64=C:\Program Files\OpenNI\Lib64
Then I changed $(OPEN_NI_LIB) to $(OPEN_NI_LIB64) and the new error message said the file OpenNI.lib cannot be found, and the reason was it should be  OpenNI64.lib in my system. The right place to change the library file name is in the following path:
Properties -> Configuration Properties -> Linker -> Input -> Additional Dependencies

---
Ref:
[1] Cannot open source file: 'WIN32': No such file or directory
[2] How can I display the contents of an environment variable from the command prompt in Windows 7?

Friday, March 01, 2013

[PCVP] Gaussian blurring and a minor imshow problem

As mentioned in the previous post (To-Do List of 2013), I am trying to learn something by following the examples listed in Programming Computer Vision with Python (PCVP).

I've done some exercises without any systematic or consistent record. So I think it's time to post some results here to record my own understanding as well as to push myself to keep going forward.

The exercise here is a test of Gaussian blurring given in pp.31-32 of the PCVP book. The following is my code and output images.


from PIL import Image
from PIL import Image
import numpy as np
from scipy.ndimage import filters
import matplotlib.pylab as plt 

img = Image.open('../data/empire.jpg')
im0 = np.array(img) #original image
im1 = np.array(img.convert('L')) #convert to grayscale
im2 = filters.gaussian_filter(im0,2)
im3 = filters.gaussian_filter(im0,5)
im4 = filters.gaussian_filter(im0,10)

for i in range(5):
    plt.subplot(1,5,i+1).set_axis_off()
    plt.title( '(' + str(unichr(97+i)) + ')' )
    #plt.imshow(eval('im'+str(i))) # This will output the grayscale image with colors 
    plt.imshow(eval('im'+str(i)), cmap=plt.cm.Greys_r)

plt.show()


From left to right: (a) original image, (b) grayscale image, (c)  Gaussian filter with σ = 2, (d) σ = 5, (e) σ = 10.

Actually, the Gaussian blurring has no problems but the convert('L') and the imshow() functions bothered me for a while. I expected the imshow() function will gave me a grayscale image as the one shown in the PCVP book, but it gave me an image with colors as the second one listed in the following figure.


The solution I found [1] and tested is to add a cmap option to tell the imshow() which colormap [2] I want it to apply on the output image.

---
Ref:
[1] Display image as grayscale using matplotlib
[2] Matplotlib Color Maps