Friday, June 26, 2009

EKF or UKF?

For non linear system, the most important way to solve it is make it linear. The well known method is using Taylor formula. EKF is using Taylor formula to linear state equation and measure equation. And assuming the noise obey Gaussian.

But Taylor linear method is not the only way, the other way is using uncented transform to linearize the state equation and/or measure equation. It also assumes Gaussian noise.

Friday, June 19, 2009

get real disparity map from OpenCV function cvFindStereoCorrespondenceBM()

The function cvFindStereoCorrespondenceBM() can give you a disparity map, but it's not real disparity map which we used to reconstruct real 3D world.

I have checked the source code and find this function uses Bitwise operator to shift the real disparity value. For false matching points, it give a certain value which is left shifted version of 'mindisp-1', here mindisp is the minimum disparity value. In this function, it shift 4 bits, which means if mindisp=-64, then after shifted , it become -1040; Shifting 4 bits equal the value*2^4; Here -1040=(-64-1)*2^4;

As I don't exactly sure if it's same shift way for right matching points, so leave this question to the authors. But If I unshift all datas, I find all disparity value go to the right range, it seems for all the disparity, the author left shift 4 bits. If it's true, then we can get real disparity map by

disp_real=(disp_shifted/2^4)+1

Visit the Multi-channel data for Opencv Image and Matrix data

According the data structure of IplImage and CvMat, assuming we have a matrix M[m*n*c], which m is row's number, n is column number, c is channel' number. If the data type is float, then we can get the value of M(i,j,k):

M(i,j)=M.data.fl[i*n*c+j*c+k];

for double, short or uchar data:
M(i,j)=M.data.db[i*n*c+j*c+k];
M(i,j)=M.data.s[i*n*c+j*c+k];
M(i,j)=M.data.ptr[i*n*c+j*c+k];

If M is a IplImage data type, then we have:
M(i,j)=M->imagedata[i*n*c+j*c+k];

Thursday, June 11, 2009

Check disk Usage by "du"

For example:

$ du -s -m *

Here -s means dont show children folder. -m means show in MB

Dual IP on one internet card

For Ubuntu do :
$ cd /etc/network/
$ sudo vi interfaces

Then add follow line in:
If your 1st ip config is:

iface eth0 inet static
address 172.xxx.xxx.xxx
netmask 255.255.xxx.xxx
...
auto eth0

Now add 2th ip :

iface eth0:1 inet static
address 192.xxx.xxx.xxx
netmask 255.255.xxx.xxx
auto eth0:1


do:
#sudo /etc/init.d/networking restart

Wednesday, June 10, 2009

How to resize opencv image window

AS I need transfer the image to client computer by vnc, so bigger size image will be very slow. So I need resize it. But when you want to resize the window, you need make sure define the window like:

cvNamedWindow("winname",0);
cvResizeWindow("winname",200,200);

Then you also can resize the window manually.

But if you want window fit the image size automatically then you should :

cvNamedWindow("winname",CV_WINDOW_AUTOSIZE);

Then you are not allowed to resize it anymore. So be careful here.

Tuesday, June 9, 2009

Connect to headless desktop by TightVNC

My teamer is using s-video to connect laptop with TV. But for headless desktop, I think the work should be same: configure Xorg.conf file.
My laptop is lucky as the graphic card is Intel985, so ubuntu does nothing to transfer desktop of my laptop to TV, although the resolution is not good.

But my desktop is unfortunately has a Nvidea Graphcard. So if I use s-video which means I need configure Xorg.conf file, that 's now I want.
So I prefer use VNC or NX. Ubuntu already includes a X11vnc which is vino. That can work perfect if you login the X11 window of server. But our headless computer can not do that. So I choose TightVnc which seems can work with headless computer.

First,
1, install tightvncserver on headless computer and install vncviewer in my laptop.
2, use "ssh host@serverip" to connect server. run "vncserver :1". Then you need type password which you will need them to login later. Finally "exit".
3, On local machine, we run "vncviewer serverip :1", then type the password. Now you will get a window and a shell.


By the way, if you want to change the password, just run "vncpasswd" in the server machine through ssh.
If you want to kill the server then do "vncserver -kill :1"


Many guys said NX is better than VNC as it's faster. But for me, it's too complicate and VNC is fast enough.
If you want to use NX, then check here:
http://ubuntuforums.org/showthread.php?t=467219

Thursday, June 4, 2009