Wednesday, April 25, 2012

To access multiple dimensional array in Java from C using JNI

It is a little bit tricky to use jni to access matrix in java from c/c++ code. Here is my example:

I really hate the blogger. I can past my source code. Anyway, you can send me email about how to do it.

Here the "tags" is a two dimensional array in java. I would like to access its data and save them to a matrix "tagPos" in c/c++;

jni getobjectclass function error "SIGSEGV"

Here is my code :

    midMain = env->GetStaticMethodID( clsMTT, "TagCalculation", "()LReturnTags;");
        tagInfo = env->CallStaticObjectMethod(clsMTT, midMain, NULL);
        clsR = env->GetObjectClass(tagInfo);

When I run this program, I get the following the "SIGSEGV" error caused by GetObjectClass function.

The reason is the function "TagCalculation" returned a empty object "tagInfo" when I run "CallStaticObjectMethod".
Therefore, the GetObjectClass tries to find a class from an empty object. This will be wrong.
The solution is very simple: I change the function "TagCalculation" to always return a real object, which is not empty.
Then, the error gone.

Friday, April 13, 2012

Install PTAM on Ubuntu 11.10

The PTAM is a nice augmented reality software, which is developed by Dr. Klein in 2008. It requires three dependencies: TooN, libcvd and gvars3. Since the ubuntu has upgraded to the 11.10 and libcvd also has its new version. When I try to install PTAM with new versions of ubuntu and dependencies, I have encountered some problems, such as " undefined reference to `typeinfo for CVD::V4L::RawV4LBuffer
" and “undefined reference to `dgesvd_’”.

The solution I found is from the website:

1. Edit the source file "cvd_src/
 //      #error "Can't do v4l2 for this kernel version"
         #define K26(X) X
         #define K24(X)

2. Edit "cvd/v4l1frame.h" :

3. Edit "Makefile" in libcvd: 

     add cvd_src/Linux/v4lbuffer.o to CVD_OBJS
4. Install libcvd without the configuration (configure will change the makefile).

5. Edit "Makefile" in PTAM to include " -llapack -lblas": 

LINKFLAGS = -L MY_CUSTOM_LINK_PATH -lGVars3 -lcvd -llapack -lblas

6. Install PTAM

Latex souce code of my presentation for the PhD defense

I thought it might be useful for someone who wants to use the latex for their presentations. In my case, I have used the latex graphical package TIKZ/PGF a lot. This package is very powerful and handy for drawing nice pictures, e.g., mind maps, arrows, coordinates, math plot, node chains.
Here I would like to publish my source code and share some magics (-:. You can download my thesis, presentation and its source code by clicking following links:

Guoliang Liu. "Bayes Filters with Improved Measurements For Visual Object Tracking", PhD Dissertation, University of Goettingen, Mar 2012. (PDF, PPT, LATEX CODE )

Wednesday, April 11, 2012

API mismatch: nvidia

I upgrade my ubuntu, but the camera applications give me an error message: API mismatch: nvidia....
I find two versions of the nvidia in my system: one is from the ubuntu repository, i.e., nvidia-current. The other one was installed by myself long time ago by nvidia-installer.
The solution for this issue uses the following command:

sudo nvidia-installer --uninstall

Of course, you also can remove the nvidia-current and run nvidia-installer again. For me, the previous one is simpler.

New paper: Square Root Sigma Point Information Filtering

Recently I have a paper accepted in IEEE Trans. on Automatic Control, which is a great journal. The paper is titled as "Square-Root Sigma-Point Information Filtering". The preprint version of this paper is available HERE. The abstract of this paper is following:

Abstract—The sigma-point information filters employ a number of
deterministic sigma-points to calculate the mean and covariance of a
random variable which undergoes a nonlinear transformation. These
sigma-points can be generated by the unscented transform or Stirling’s
interpolation, which corresponds to the unscented information filter (UIF)
and the central difference information filter (CDIF) respectively. In this
technical note, we develop the square-root extensions of UIF and CDIF,
which have better numerical properties than the original versions, e.g.,
improved numerical accuracy, double order precision and preservation of
symmetry. We also show that the square-root unscented information filter
(SRUIF) might lose the positive-definiteness due to the negative Cholesky
update, whereas the square-root central difference information filter
(SRCDIF) has only positive Cholesky update. Therefore, the SRCDIF
is preferable to the SRUIF concerning the numerical stability.