Friday, December 16, 2011

ssh refused to visit

If you got this problem ,first check if both computers have installed ssh.
This stupid problem wasted me few hours.

vncviewer: keyboard mapping problem

If you encounter a problem of keyboard mapping when you use the vncviewer,
the solution is to add "export XKL_XMODMAP_DISABLE=1" to the file "~/.vnc/xstartup"  on the server which looks like:

"
#!/bin/sh

export XKL_XMODMAP_DISABLE=1

xrdb $HOME/.Xresources
xsetroot -solid grey
#x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
#x-window-manager &
/etc/X11/Xsession
"

Of course, you have to restart xserver to implement the changes.




Opencv 2.3 on Ubuntu 9.10

The ubuntu 9.10 is not supported by ubuntu community any more. To use apt-get,
you have to manually edit "/etc/source.list" file and replace "archive" with "old-release".

The Opencv 2.3 need a cmake 2.8, buth ubuntu 9.10 only has cmake 2.6, so when you compile the opencv 2.3 the cmake gives you errors and warnings such as "incompletely configuration".

What you need to do is downlad cmake 2.8 and install it.

Wednesday, December 14, 2011

URG-04LX-UG01 problems and solutions

Recently our group got a urg laser which has a usb connector. It took me about two days to figure following problems out:
 
1. Power. The laser comes with a dual usb connector. From the urg website, it says the urg needs two usb port to get enough power (>500mA). I have tried every pairs of usb port. Neither of them work. The possible reasons are: the laser is damaged, the cable doesn't work, or the power from pc usb is not enough. I simply use a single usb connector from my mp3 to replace the dual usb port, then the laser is surprisingly working!! What can I say. Dual port don't work, single port works fine! If you have similar problem, then you can try this solution.

2. Library. Now the laser can work well with XP system after installing the driver. However, the library got some problems when I compile them, such as can no reference to 'floor'. I google the solutions and find one nice patched urg library which works fine for Ubuntu oneiric: http://bazaar.launchpad.net/~ubuntu-branches/ubuntu/oneiric/urg/oneiric/revision/4?start_revid=4 You can download the tarball of the urg library and compile it. That works great on my ubuntu machine.

3. Urg program samples. The sample programs also get some problems, such as "undefined reference to" blabla. The solution is very simple: rewriting the Make file (for C++ urg_sample) as : CXXFLAGS = -g `urg-config --cflags` `sdl-config --cflags` LDFLAGS = `urg-config --libs` `sdl-config --libs` LDLIBS = -lc gdScanSample: gdScanSample.cpp g++ -o gdScanSample gdScanSample.cpp $(CXXFLAGS) $(LDFLAGS) $(LDLIBS) clean : $(RM) *.o $(TARGET) .PHONY : all clean


Now, everything works perfectly. Enjoy!

Wednesday, September 21, 2011

Google, what are you going to do with the blogger?

Now the google has the google+. How about the Blogger? It's even harder to access the Blogger from the homepage of the Google. I couldn't find it. The only thing about the blog is the blog search which is useless for me, because I don't want to search my blogger which is ridiculous. The only way left is to type the www.blogger.com instead of the www.google.com.

Friday, August 19, 2011

such that vs. so that

so that focuses on a purpose.

such that focuses on a consequence.

Saturday, August 13, 2011

IEEE LATEX TEMPLATE \markboth doesn't work

Because the default setting of the template is one side document, so to enable the \markboth,
you have to add twoside to the documentclass options:
\documentclass[10pt,journal,letterpaper,compsoc,twoside]{IEEEtran}

Friday, August 12, 2011

cvFloodFill: one example

In the OpenCv, the definition of cvFloodFill is:

void cvFloodFill( CvArr* img, CvPoint seed, double newVal,
double lo=0, double up=0, CvConnectedComp* comp=0,
int flags=4, CvArr* mask=0 );
#define CV_FLOODFILL_FIXED_RANGE (1 << 16)
#define CV_FLOODFILL_MASK_ONLY (1 << 17)

The trick is how to define the flags. One example is:
int flags = connectivity + (new_mask_val << 8 ) + CV_FLOODFILL_FIXED_MASK_ONLY;

where connectivity can be 4 or 8, new_mask_val is the gray value to be assigned to the mask, e.g., 255.

Wednesday, August 10, 2011

JAVACV: no jniopencv_core in java.library.path

To solve it, adding following lines to ~/.bashrc:
#For JavaCv
export CLASSPATH=$CLASSPATH:~/Src/javacv/javacv-bin/javacpp.jar:~/Src/javacv/javacv-bin/javacv.jar:~/Src/javacv/javacv-bin/javacv-linux-x86.jar

The key solution is the javacv-linux-x86.jar. If you are using 64bits windows, then you have to choose javacv-windows-x86_64.jar.

Tuesday, August 9, 2011

Read temperature from sensors in GPU

The powerful tool is xsensors:
First install lm-sensors:
$ sudo apt-get install lm-sensors
Then run sensors-detect in root
$ sudo sensors-detect
Answer YES to all.
Then run sudo /etc/init.d/module-init-tools restart
Answer No.
Next install xsensors and run it by:
$ sudo apt-get install xsensors
$ sudo xsensors

Recover the default nvidia driver

Just do:
$ sudo apt-get install nvidia-current
That's it.

Sunday, July 31, 2011

High quality video from images by FFMPEG

Gary Steele described how to use ffmpeg to make a video from images by the command:
ffmpeg -r 10 -b 1800 -i %03d.jpg test1800.mp4
(see: http://electron.mit.edu/~gsteele/ffmpeg/)

This command only can output a very low quality video. To make the video better, you can try following command:
ffmpeg -f image2 -i %03d.jpg -r 10 -s w*h test1800.mp4
where w and h are the width and hight of the video image, such as 640*480.

Tuesday, July 12, 2011

The vim-latexsuit in Ubuntu 11

I failed to install it by apt-get. The version of the vim-latexsuit might be very old in the package source of Ubuntu.
I decide to install the latest version from the vim-latex website. Finally successful following their manual.

Tuesday, June 14, 2011

Run April Toolkit ( including April tags) in C/C++ environment (call java classes from C/C++)

This is one example application: run April Toolkit (April tags) in C/C++. It requires the JNI to call Java functions in C/C++. You could download the source file from HERE.

The original April toolkit is working in the Java environment. However, my project needs C/C++, so how to wrap Java into C/C++ project becomes one problem.
After a few days work, I finally get a solution to solve this.

There are two subfolders in this application :
1, One is "java" folder. It includes Java source file "myTagTest.java", which is a simpler version of "TagTest.java" in the AprilToolkit. This program reads the frames from webcam, detect the april tags and calculate the relative pose matrix. That's all, so it's simpler and easier to understand than the original one.
2. The other one is "cpp" folder. It includes the C source file "ctest.cpp" and a "Makefile". The main architecture of the ctest.cpp is first launching the JVM, then finding the java class and java function, finally running the function.

How to run it (for Linux):
1. Download and install the April toolkits from:
http://april.eecs.umich.edu/wiki/index.php/April_Tags

2. Download the source file of my application from my website:
https://sites.google.com/site/guoliangliu2010/opensouce

3. In the java folder:
$ javac mytagTest.java

4. In the cpp folder:
$ make ctest
$ ./ctest

P.S.
I need thanks the engineer Ahmad Jalil Qarshi. He gives a nice introduction about how to call Java classes in C/C++, which can be found in the following link:
http://www.codeproject.com/KB/cpp/CJniJava.aspx

Friday, June 10, 2011

Remove ^M in the VIM or GVIM

The ^M is the \r in the file. To remove these strange things, you could do replace \r by space. Very simple.

Wednesday, June 8, 2011

JavaCV for webcam

Now I start to conquer Java for robotic stuffs.
I am used to use opencv, so I find Javacv is a nice interface to wrap opencv.
After download and install the javacv, I try to run a sample: "MotionDetector.java".
But it gives me some errors like:
HIGHGUI ERROR V4L2

The solution is commenting following lines in the OpenCVFrameGrabber.java:
cvSetCaptureProperty(capture, CV_CAP_PROP_CONVERT_RGB, colorMode == ColorMode.BGR ? 1 : 0);
and
return_image.timestamp(Math.round(cvGetCaptureProperty(capture, CV_CAP_PROP_POS_MSEC)*1000));

Now it works, but it return BGR image instead the RGB image.
I don't think it's a good idea to use CV_CAP_PROP_CONVERT_RGB in the above line, because the Opencv users are used to use BGR. If they don't check the source, they will never know the function "grab()" return a RGB image.

Now recompile it using command "ant" and copy the generated ./dist/javacv.jar to the CLASSPATH.

Tuesday, June 7, 2011

Type D in the vncviewer

I got a problem when I was using vncviewer: couldn't type d in the terminal or other windows.
The solution is:
1. Go to System->Preference->Keyboard shortcuts
2. Find the item Hide all normal windows and set focus to the desktop
3. Type Alt+D to change this hot key
4. vncserver -kill :1 which kills the current server
5. restart the vncviewer.

Problem Solved

Friday, May 27, 2011

To use cvCvtColor

Be careful to use CV_BGR2HSV, the detail of the manual shows:
// In case of 8-bit and 16-bit images
// R, G and B are converted to floating-point format and scaled to fit 0..1 range

V <- max(R,G,B)
S <- (V-min(R,G,B))/V if V≠0, 0 otherwise

(G - B)*60/S, if V=R
H <- 180+(B - R)*60/S, if V=G
240+(R - G)*60/S, if V=B

if H<0 then H<-H+360

On output 0≤V≤1, 0≤S≤1, 0≤H≤360.
The values are then converted to the destination data type:
8-bit images:
V <- V*255, S <- S*255, H <- H/2 (to fit to 0..255)
16-bit images (currently not supported):
V <- V*65535, S <- S*65535, H <- H
32-bit images:
H, S, V are left as is

If the original image is float, you should manually convert the pixel values in the original image to [0, 1].

The ICRA 2011 conference at Shanghai, China

Well, ICRA2011 was a very amazing conference, where I met a lot of famous experts in robotics and computer vision, such as Marc Pollefeys, Stan Birchfield, Shoudong Huang, Chieh-Chih Wang, Larry Matthies and Ryan Eustice, etc. Although I did not try to talk with them all because I am a little nervous and shy, I am very exciting to see them face to face.
About my talk, it was my first conference talk, so some mistakes happened, for instance, wrong pronunciation for some words. I forgive myself here. This experience will let me learn and make further progress on the next conferences.
Thanks my friends and prior college Kejun Ning, who made a photo when I gave the talk.

Thursday, May 26, 2011

opencv2.0: a bug in the function convertBGRImageToOpponentColorSpace

The O1 in the opponent color space should be red - green, but in the code, it shows:

int value = static_cast( static_cast(static_cast(*gIt)-static_cast(*rIt)) * factor );

which is wrong.

Thursday, May 5, 2011

Specify the port of vncviewer

It works fine for me....
vncviewer -via "NAME@IP -pXXXX " localhost:1

UBUNTU 11.04 again can not boot because the NVIDIA driver

Yesterday I update the other computer's system to Ubuntu 11.04. The result was very disappointment.
The system went to die when it rebooted. The reason behind this is the graphic card driver: NVIDIA. I download the new version NVIDIA driver for my computer, and try to reinstall the driver.
There is the other problem show up : it can't find the header file of linux kernel.
Then I use the --kernel-source-path to tell the program where the headers are.
The other problem turn out: the "nvidia.ko" can not be loaded because the kernel version doesn't match. The kernel version can be found out by command "uname -al".
The corresponding kernel header which is ending with "pae" which I don't have. Then I use aptitude to install this header and compile the nvidia driver again. Now it works.

Friday, April 29, 2011

IV2010 paper is available to download now

This paper was accepted in IEEE Intelligent Vehicles Symposium (IV) 2010. Now I upload the preprint version to this site, so everyone can access it and comment on my work.

Guoliang Liu, Florentin Woergoetter, Irene Markelic. "Combining Statistical Hough Transform and Particle Filter for Robust Lane Detection and Tracking." IEEE Intelligent Vehicles Symposium, June 2010 (Oral)(pdf)

You can download it from my google site:
https://sites.google.com/site/guoliangliu2010/publications

A paper accepted in 2011 IEEE Workshop on Statistical Signal Processing (SSP2011)

I have the other paper accepted in 2011 IEEE Workshop on Statistical Signal Processing (SSP2011):

Guoliang Liu, Florentin Woergoetter, Irene Markelic. "Nonlinear Estimation Using Central Difference Information Filter." 2011 IEEE Workshop on Statistical Signal Processing , SSP2011. (Accepted)

The pdf file is available in my personal google site:
https://sites.google.com/site/guoliangliu2010/publications

One paper accepted in ICRA2011

The paper's detail is as follows:

Guoliang Liu, Florentin Woergoetter, Irene Markelic. " Lane Shape Estimation using Partitioned Particle Filter for Autonomous Driving." IEEE International Conference on Robotics and Automation 2011 (Accepted, Oral)(pdf)

The pdf and the source code of this paper are available in my personal site soon:
https://sites.google.com/site/guoliangliu2010/publications

This paper introduces a novel lane tracking method. The contributions in this paper are three folds:
First, multiple kernel density estimation method is used to infer the lane parameters.
Second, a partitioned particle filter is used for linear-parabolic lane shape estimation.
Third, we combine the partitioned particle filter and the multiple kernel density, and shows its robustness in challenge scenes.

Well, if you would join in ICRA 2011, which will be held in Shanghai of China next month, let's meet together.

Thursday, April 28, 2011

My personal website: google site

https://sites.google.com/site/guoliangliu2010/

A little bit shock by the New Ubuntu 11.04

Today a new message just show up: the new ubuntu 11.04 comes.
Then I choose update to the new version. I thought everything will be fine.
However, after long time update, the computer restart, but no screen be found.
After I check the log files of system and xserver, finally I figure out the reason is the installed NVIDIA driver doesn't compatible with this new ubuntu.
I download a new version of NVIDIA driver, which is (270.40).
Surprisingly, now it works......
The new desktop of ubuntu looks so simple and a little stupid.
I have to learn how to find the applications and the configure programs, etc..
There are no panel bar anymore, and everything seems be hided.
I don't like this style. I prefer everything can be easily found or seen.
So if you have the same feeling, just go to the "login screen" and select "ubuntu classic" as default session.
I like the classic....

CMUCAM3: HSV color space

There is a command [CS ], which is not in the CMUCAM manual.
This command can set the color space to HSV: [CS 1].
If you would like to use RGB, then simply use [CS 0].

The other similar command is [CR ], which only sets the color space to CrYCb.

Monday, April 18, 2011

CTAGS for source code analysis

Today I found it's nice to work with ctags, which is a source code analysis tool.
Although it doesn't have a nice front-end gui interface, ctags works nicely with vi and vi's brothers, e.g., vim, gvim.
The source navigator is also nice to try, but it looks much complicated when you just want to have a look at the classes or functions in your code. The other important thing is I am used to program in GVIM.
The way to use ctags is very simple, first go to your source directory, and type following command in your terminal:
ctags -R *
this command will generate a tags file which you can find in your source directory.
Next thing is using vi or gvim to open your source file, and move cursor to the keyword, e.g, class name, function name, etc., and use CTRL-] to get this keyword's source position. If you want to get backward, then use CTRL-T.

CTAGS is small and big enough for me.

Saturday, April 16, 2011

PKG-CONFIG with INTEL IPP

Intel® Integrated Performance Primitives Performance Library is used with OPENCV.
The pkg-config is a nice tool to compile your programs, because you don't need define a lot of libraries in the Makefile.
Here I made a pkg-config file for IPP, which can be copied to your local lib directory.
In general, you can put it in "/usr/local/lib/pkgconfigs".

First create a .pc file in above directory, here we give it a name: ipp.pc, then copy following contents to the file:
"
# Package Information for pkg-config

prefix=/opt/intel
exec_prefix=${prefix}/ipp
ipp_libdir=${exec_prefix}/lib/ia32
intel_libdir=${prefix}/lib/ia32
includedir=${exec_prefix}/include

Name: INTEL_IPP
Description: Intel Integrated Performance Primitives Performance Library
Version: 3.2
Libs: -L${ipp_libdir} -lippac -lippcc -lippch -lippcore -lippcv -lippdc -lippi -lippdi -lippj -lippm -lippr -lippsc -lipps -lippvc -lippvm -L${intel_libdir} -lcxaguard -limf -lintlc -liomp5 -liompprof5 -liompstubs5 -lirc -lomp_db -lpdbx -lsvml
Cflags: -I${includedir}
"
Where we assume the ipp is installed under the folder /opt.

Here is a example which introduce how to use it in the Makefile:

PKG=`pkg-config opencv ipp --cflags --libs`
Matrix.o: Matrix.cpp Matrix.h
gcc -g -c Matrix.cpp $(PKG)

Thursday, April 14, 2011

Give up on CUDA 4.0

The reason is simple:
The new NPP was embedded in the CUDA toolkit.
However, the functions, such as Canny functions are not inside of NPP anymore.
To compile the OpenCV, I have to use CUDA 3.2.
Really pity.
I wasted 6 hours....F..K

IPP works with OpenCV 2.0 : a solution

The libraries name of IPP has been changed since IPP 7.0, so the New Opencv can not be compiled with IPP.
The solution is to change the CMakeLists.txt in the OpenCV2.0's source file.
The following is what I did, where the IPP_PATH is defined as /opt/intel/ipp/lib/ia32 in the CMAKE:

############################### IPP ################################
set(IPP_FOUND)
set(OPENCV_LOADER_PATH)

if(UNIX)
if(APPLE)
set(OPENCV_LOADER_PATH DYLD_LIBRARY_PATH)
else()
set(OPENCV_LOADER_PATH LD_LIBRARY_PATH)
endif()
endif()

foreach(v "7.0" "6.1" "6.0" "5.3" "5.2" "5.1")
if(NOT IPP_FOUND)
if(WIN32)
find_path(IPP_PATH "ippi-${v}.dll"
PATHS ${CMAKE_PROGRAM_PATH} ${CMAKE_SYSTEM_PROGRAM_PATH}
DOC "The path to IPP dynamic libraries")
if(NOT IPP_PATH)
find_path(IPP_PATH "ippiem64t-${v}.dll"
PATHS ${CMAKE_PROGRAM_PATH} ${CMAKE_SYSTEM_PROGRAM_PATH}
DOC "The path to IPP dynamic libraries")
endif()
endif()
if(UNIX)
find_path(IPP_PATH "libippi${CMAKE_SHARED_LIBRARY_SUFFIX}.${v}"
PATHS ${CMAKE_LIBRARY_PATH} ${CMAKE_SYSTEM_LIBRARY_PATH} ENV ${OPENCV_LOADER_PATH}
DOC "The path to IPP dynamic libraries")
if(NOT IPP_PATH)
find_path(IPP_PATH "libippiem64t${CMAKE_SHARED_LIBRARY_SUFFIX}.${v}"
PATHS ${CMAKE_LIBRARY_PATH} ${CMAKE_SYSTEM_LIBRARY_PATH} ENV ${OPENCV_LOADER_PATH}
DOC "The path to IPP dynamic libraries")
endif()
endif()
if(IPP_PATH)
file(GLOB IPP_HDRS "${IPP_PATH}/../../../ipp/include")
if(IPP_HDRS)
set(IPP_FOUND TRUE)
endif()
endif()
endif()
endforeach()

message(STATUS "IPP detected: ${IPP_FOUND}")

if(WIN32 AND NOT MSVC)
set(IPP_FOUND)
endif()

set(USE_IPP ${IPP_FOUND} CACHE BOOL "Use IPP when available")

message(STATUS "IPP_FOUND: ${IPP_FOUND}")
message(STATUS "USE_IPP: ${USE_IPP}")
message(STATUS "USE_PATH: ${IPP_PATH}")


if(IPP_FOUND AND USE_IPP)
add_definitions(-DHAVE_IPP)
include_directories("${IPP_PATH}/../../../ipp/include")
link_directories("${IPP_PATH}/../../../ipp/lib/ia32")

file(GLOB em64t_files "${IPP_PATH}/../lib/*em64t*")
set(IPP_ARCH)
if(em64t_files)
set(IPP_ARCH "em64t")
endif()

set(A ${CMAKE_STATIC_LIBRARY_PREFIX})
set(B ${IPP_ARCH}${CMAKE_STATIC_LIBRARY_SUFFIX})
if(WIN32)
set(L l)
else()
set(L)
endif()
set(IPP_LIBS
${A}ippvm_l${B}
${A}ippcc_l${B}
${A}ippcv_l${B}
${A}ippi_l${B}
${A}ipps_l${B}
${A}ippcore_l${CMAKE_STATIC_LIBRARY_SUFFIX})
endif()

INstall CUDA toolkits under Ubuntu

Here is a wonderful link to introduce the steps.

http://wiki.accelereyes.com/wiki/index.php/Installing_CUDA_Under_Ubuntu_10.04

Today I had one error, that the NVIDIA_GPU_Computing_SDK can not find out the libXmu.
The solution for this issue is using following command in the terminal :
$ sudo ln -s /usr/lib/libXmu.so.6 /usr/lib/libXmu.so

Monday, March 28, 2011

The chinese fonts for Adobe reader 9.x in Ubuntu

The recently version Adobe reader 9.4 need additional fonts package to support chinese display.
You can download the fonts from :

ftp://ftp.adobe.com/pub/adobe/reader/unix/9.x/9.1/misc/

where the File:FontPack910_chs_i486-linux.tar.bz2 is chinese simple version.
The files can be extracted by command "tar -xvf FontPack910_chs_i486-linux.tar.bz2 " in the command terminal.
Finally run the "sudo ./INSTALL".
Everything will be fine.

Tuesday, March 22, 2011

Export the Bibliography as You Like Using Jabref

This document introduce how to export the bibliography in a .RTF or .HTML format using the Jabref.
1. Download and install Jabref from website “http://jabref.sourceforge.net/index.php”.

2. Open the database. “File”->”Open database” and choose the right file.

3. Customize entry types. Add the sentence “ Acknowledgement: acknowledgement; bccn; status” to “options”->”Set up general fields”.

4. Use the export template. The templates for RTF or HTML can be downloaded from website “ http://jabref.sourceforge.net/resources.php”. They need be further changed to get what we want, e.g., including acknowledgements. Click “Options”->”Management custom exports ” -> “add new” and choose the right template file, e.g., “edward_elgar.layout”, then give it a name, e.g. “edward” and specify the format, e.g., “.rtf”.

5. Export settings. If you want to index the output file first by entry type and second by the year, you can first click the “Entry type” with control key “Ctrl”, then click the “Year”.  Now you have to make sure the export setting is right: click the “Options”->”Preference”->”file”->”sort order” and choose “Export in current table sort order”.

6. Do export. Click “File”->”Export” and choose the right format, e.g., “edward (*.rtf)”.

Tuesday, March 15, 2011

Integral Histogram for fast Calculation of HOG Features

The original article can be found in

http://smsoftdev-solutions.blogspot.com/2009/08/integral-histogram-for-fast-calculation.html?showComment=1300196607644#c294288376459522527

However, there are some problems when you are going to use it:
First, the input image should be a BGR color image.
Second, the variable "xsobel" and "ysobel" must be "IPL_DEPTH_32F".
Third, the author does not write out the function "doSobel".


To avoid these problems,
you can change a little bit of original codes:

IplImage* img_gray = cvCreateImage(cvGetSize(in), IPL_DEPTH_8U,1);
if(in->nChannels>1){
cvCvtColor(in, img_gray, CV_BGR2GRAY);
}
else
{
cvCopy(in,img_gray);
}
cvEqualizeHist(img_gray,img_gray);
/* Calculate the derivates of the grayscale image in the x and y
directions using a sobel operator and obtain 2 gradient images for the
x and y directions*/
IplImage *xsobel = cvCreateImage(cvGetSize(in), IPL_DEPTH_16S, 1);
IplImage *ysobel = cvCreateImage(cvGetSize(in), IPL_DEPTH_16S, 1);

cvSobel(img_gray,xsobel,1, 0, 3);
cvSobel(img_gray,ysobel, 0, 1, 3);

cvReleaseImage(&img_gray);
/* Create an array of 9 images (9 because I assume bin size 20
degrees and unsigned gradient ( 180/20 = 9), one for each bin which
will have zeroes for all pixels, except for the pixels in the original
image for which the gradient values correspond to the particular bin.
These will be referred to as bin images. These bin images will be
then used to calculate the integral histogram, which will quicken the
calculation of HOG descriptors */
IplImage** bins = (IplImage**) malloc(9 * sizeof(IplImage*));
for (int i = 0; i < 9 ; i++) {
bins[i] = cvCreateImage(cvGetSize(in), IPL_DEPTH_32F,1);
cvSetZero(bins[i]);
}
/* Create an array of 9 images ( note the dimensions of the image, the
cvIntegral() function requires the size to be that), to store the integral
images calculated from the above bin images. These 9 integral
images together constitute the integral histogram */
IplImage** integrals = (IplImage**) malloc(9 * sizeof(IplImage*)); for (int i =
0; i < 9 ; i++) {
integrals[i] = cvCreateImage(cvSize(in->width + 1, in->height + 1),
IPL_DEPTH_64F,1);
}
/* Calculate the bin images. The magnitude and orientation of the
gradient at each pixel is calculated using the xsobel and ysobel
images.{Magnitude = sqrt(sq(xsobel) + sq(ysobel) ), gradient = itan
(ysobel/xsobel) }. Then according to the orientation of the gradient,
the value of the corresponding pixel in the corresponding image is set
*/
int x, y;
float temp_gradient, temp_magnitude;
for (y = 0; y height; y++) {
/* ptr1 and ptr2 point to beginning of the current row in the xsobel
and ysobel images respectively. ptrs[i] point to the beginning of the
current rows in the bin images */
short* ptr1 = (short*) (xsobel->imageData + y * (xsobel->widthStep));
short* ptr2 = (short*) (ysobel->imageData + y * (ysobel->widthStep));
float** ptrs = (float**) malloc(9 * sizeof(float*));
for (int i = 0; i < 9 ;i++){
ptrs[i] = (float*) (bins[i]->imageData + y * (bins[i]->widthStep));
}
/*For every pixel in a row gradient orientation and magnitude are
calculated and corresponding values set for the bin images. */
for (x = 0; x width; x++) {
/* if the xsobel derivative is zero for a pixel, a small value is added
to it, to avoid division by zero. atan returns values in radians, which
on being converted to degrees, correspond to values between -
90 and 90 degrees. 90 is added to each orientation, to shift the
orientation values range from {-90-90} to {0-180}. This is just a matter
of convention. {-90-90} values can also be used for the calculation. */
if (ptr1[x] == 0){
temp_gradient = ((atan(ptr2[x] / (ptr1[x] + 0.00001))) * (180/ PI)) + 90;
}
else{
temp_gradient = ((atan(ptr2[x] / ptr1[x])) * (180 / PI)) + 90;
}
temp_magnitude = sqrt((ptr1[x] * ptr1[x]) + (ptr2[x] * ptr2[x]));

/*The bin image is selected according to the gradient values. The
corresponding pixel value is made equal to the gradient magnitude at
that pixel in the corresponding bin image */
if (temp_gradient <= 20) {
ptrs[0][x] = temp_magnitude;
}
else if (temp_gradient <= 40) {
ptrs[1][x] = temp_magnitude;
}
else if (temp_gradient <= 60) {
ptrs[2][x] = temp_magnitude;
}
else if (temp_gradient <= 80) {
ptrs[3][x] = temp_magnitude;
}
else if (temp_gradient <= 100) {
ptrs[4][x] = temp_magnitude;
}
else if (temp_gradient <= 120) {
ptrs[5][x] = temp_magnitude;
}
else if (temp_gradient <= 140) {
ptrs[6][x] = temp_magnitude;
}
else if (temp_gradient <= 160) {
ptrs[7][x] = temp_magnitude;
}
else {
ptrs[8][x] = temp_magnitude;
}
}
}
cvReleaseImage(&xsobel);
cvReleaseImage(&ysobel);
/*Integral images for each of the bin images are calculated*/
for (int i = 0; i <9 ; i++){
cvIntegral(bins[i], integrals[i]);
}
for (int i = 0; i <9 ; i++){
cvReleaseImage(&bins[i]);
}
/*The function returns an array of 9 images which consitute the
integral histogram*/
return (integrals);
}

Wednesday, March 9, 2011

户口迁移证,派遣证,报到证-关注中国大学生!

刚刚下午写的一篇非常精彩的文章:关注大学生就业:派遣报到证 有效期及作用! 当前文章的内容虽然有些已经过时,因为不符合现代社会,但还是值得我们参考。 因为现在大学生毕业后,学校方已不占主动权,掌握权已经在单位。所以人家单位接收你,你的派遣证等才有用,否则都是白搭。 下边的内容我们多少也看看:

关于户口和派遣的一些问题:07 年7月毕业的同学,户口可以保留在学校2年不打回学校。这个也是你需要办一定手续,如果你毕业了户口没解决,一走了之,就麻烦了,学校或者通过机要系统转回你家乡所在地级市的人事局或劳动局。转到人事局和劳动局也不一样,在人事局是干部,在劳动局是工人,这两个身份不同。大学毕业生都是干部,但是你找的工作没有解决户口,学校把户
口派遣回老家,也有派遣证,有这个证就可以把你户口重新落到你老家所在的地级市。如果你07年7月毕业了,假设在北京找了一个单位,没有户口,那么你可以有如下选择:

1. 申请户口保留在学校2年。7月毕业的学生,留京的最后期限市07年12月底,注意不是2 年,就是说在7-12月你找到一个北京的单位能够解决你的户口,学校仍然可以派遣。而不是2年,在7月之后2年内你可以申请把户口保留在学校,北京之外的城市有单位在这2年内可以给你解决户口,学校仍然可以派遣,注意除了北京,北京是半年,到07年12月底。

2.不保留在学校,转回家。这样的话也需要你去就业中心,毕分办等单位办手续,开派遣证,学校通过机要系统把你的户口转到你家乡的地级市。如果你有派遣证,那么是转到人事局,你有干部身份,如果你不去办理,学校自己给你转回去,你没有派遣证,转到你家乡地级市的劳动局,你就成工人了,丧失了干部身份。干部和工人的区别,中国的特色,详情可咨询就业中心。转回家后需要你持派遣证落户,一般是落在人事局所属的人才交流中心。你要不去落户,就没有户口。

3.不申请户口保留在学校,自己也不去办理将户口转回家,那你就麻烦了。有些同学不明白其中的规定,毕业了,找了工作,没有解决户口,自己户口也不管,离开学校一走了之,这样的话不仅你的户口,学校会直接转走,你还没有派遣证,没有干部身份。你自己不去将户口转回家,不回家报到落户,那你就没有户口,你的档案中间也会出现空白,不连贯。
特别要强调一下:派遣证的问题,这个证件很重要很重要,建议大家一定要重视。

还有:1.如果你找了个北京的单位,给你解决户口了,那就最容易不过了,三方各方面都搞定了,学校给发派遣证,毕业了到单位报道,户口档案都由公司给你处理。

2. 如果找了北京的单位,没有解决户口,你也没有办法解决,可以参照上面几条如何转回家去。如果你找的单位没有解决户口,而你想要北京户口,那么可以考虑买个户口。具体的办法是:找一个有剩余户口名额的单位,它如果想卖户口,可能需要几万块,你和它签约,三方各方面搞定了,学校也给你发派遣证,你的就业方向就等于去了这个卖户口的公司,在学校的统计里。你拿派遣证,到这个公司报道,然后办理户口档案人事代理都让它给你处理。但是实际上你并不去这个卖户口的公司上班,而是去你另外找的,不给你解决户口的单位上班,你在那个公司等于是打工的,户口和档案则在卖户口的公司。这是个解决办法,但是务必务必小心,小心被骗。如果你有熟人或通过关系找熬到有些单位有剩余户口名额,可靠的话就最好了。最后提醒大家一下:毕业生 毕业的时候,是解决户口最容易的时候,如果你的户口一旦转回家去,那想出来就太难了,除非你再考研或者通过单位人才引进,但是人才引进也是很麻烦的。提请大家一定一定注意这个问题,人生大事不可马虎。

第一个问题:在7月份你有如下选择:
一.找到了工作,给你解决户口,签了三方,学校发派遣证,拿派遣证到燕园派出所办理户口迁移证,然后拿派遣证到你所在单位落户,档案学校会通过机要系统转到你的单位。 我校不可以个人自带档案,方老师说过。
二.找到了工作,没有解决户口。这样就无法签订三方,你有如下选择:

1. 向学校申请将档案和户口保留在学校2年,不转回原籍。在2年期间,如果你找到了北京以外的单位,可以解决户口问题,仍然可以给你派遣,当然已经不是应届生了,但是仍然可以派遣。注意:如果要留京,方老师说,在2007年12月底找到仍然可以派遣,是半年而不是2年,过期就户口就无法留京。

2. 转回原籍,你仍然有派遣证,最低转到你家乡所在的地级市人事局。档案学校会给转回去。注意:这需要你自己毕业时候到毕分办去办理,如果你不去办理,一走了之,档案转回家了,但是你的户口没有办理迁移证,户口资料仍然在北大派出所,但是你已经不是这里的户口了,你又没有派遣证可以回家乡落户,就没有户口了。并且如果没有派遣证,档案转回劳动局而不是人事局,丧失了干部身份。 本文来源:www.ieeye.com
第二个问题:毕业了当然不是应届生,其他参见上面解释。
第三个问题:参见上面解释,2年内找到可以解决户口的单位,仍可签三方。

报到证 派遣证区别?以前叫派遣证,现在叫报到证,一样的,一个意思,这东西很重要的,千万不能丢报到证是你拿着到上面所写的地方报到,一般报到后就要申请落户,就用户口迁移证了,没什么特殊的地方!

如果是毕业多年的毕业生,到现在也没找下工作,那么派遣证什么户口,什么档案,似乎没什么用处?

一、报到证全称是“全国普通高等学校大中专毕业生就业派遣报到证”,这是所有普通全日制大中专院校毕业生毕业时必须要拿到的重要证件之一,如果你没有拿到的话,请回学校的就业工作部门(如学生处、毕分办、就业中心等)领取。领取的时候注意一下,你是师范类毕业生,此报到证应当是由当地教育主管部门签发的(如省教育厅的人事处、毕分办或学生处)。如果你在毕业之前没有签订就业协议,那报到证是到生源所在地教育主管部门(如某市教育局)报到的,备注栏为空白(此证为待就业报到证,你仍属于学生身份)。
二、关于你的户口问题,如果你是本地户口的话,一般在入校前是不必迁到学校的,你回家问问家里人,是不是户口还在家。如果你已经把户口迁到学校了,这你要找学校户政管理部门(如校派出所或保卫处)拿户口迁移证或集体户口单页,再持毕业证、报到证到生源地公安户政机关落户就可以了。
三、关于报到证日期的问题。报到证有两个期限,一是报到期限,如果有包分配的地方教育局,一般会要求你在规定期限内(一般是毕业后一个月)报到,否则今年你有可能错过包分配或参加公开招聘的机会,如果是不包分配教育局,错过期限就无所谓了,象我们这儿,错过期限报到就没有太多影响。二是报到证本身的期限,一般是三年,就是说你要在三年内找到工作单位并办理正式就业报到证,确定国家干部身份,否则错过时间就再也办理不了了。
四、关于转行。国家是不鼓励师范类毕业生转行的,所以请你在转行之前慎重考虑,象我省,规定师范类毕业生转行后就没机会再回到教育行业工作了。如果你要转行也可以,但不知你是否在校时领取过师范专业每月的专业奖学金,如果领取过,请在转行前还清奖学金,否则教育主管部门可能不让你转行。
五、关于档案。如果你属于待就业毕业生,学校会将你的档案转回生源所在地教育主管部门(即报到证上让你报到的地方),如果将来就业或转行,请到该部门办理档案转递手续。

所谓派遣证是过去统分统招时期的叫法,而报到证是实行双向选择以后的叫法,名称虽然不同,起的作用基本相同,都是你大学毕业后办理各种就业手续(如户口迁移,档案落户等)的一纸凭证. 根据现行就业政策,大学毕业生可把档案保留在学校2年,在此期间不影响你在任何地方联系工作,毕业后两年内如果你还没有一个稳定的工作单位,那么根据国家政策,你的档案将由学校寄给生源所在地.

Thursday, March 3, 2011

WPS只域显示

发现我们自主的WPS OFFICE 软件真的强大啊。而且免费。
但也有些不熟悉的地方,今天我只是按了下CTRL+F9,结果就是公式只显示域代码,必须得用SHIFT+F9才可以正常显示公式。比较繁琐。
今天发现解决方法就是在工具-》选项-》视图》里的域代码选项给去掉就行了。SO EASY..
不然每次都是
EMBED Equation.KSEE3

Thursday, February 24, 2011

如何在UBUNTU10.10版本中使用LATEX制作中文论文

折腾了两天,一直想着把我在WINDOWS里用CTEX写的论文搞到UBUNTU下来。
最近的UBUNTU当然界面是十二分的漂亮。但是也丢掉了一些比较有用的包包,比如TEX-COMMON等,这些是CCT安装必须的文档。
所以现在不能按照以前的路子装CCT和CJK了。。
幸好最新的UBUNTU是支持CJK(China, Japan, Korea)的,所以首要工作就是安装CJK和LATEX的组件
然后就是安装字体了。
看了看自动化学报的LATEX模板,要用到GBK,而新装的CJK里只有GB。
所以就到网上到处搜索GBK的字体,
从ftp://ftp.cc.ac.cn/pub/cct/CJK/ 下载了ctex-0.7-1.i386.rpm和CJK-GBKfonts-0.3-15.i386.rpm两个文件
然后用alien命令转换rpm到deb,在UBUNTU下直接用DPKG命令安装两个DEB文件。
对于字体,可以直接从WINDOWS里COPY,我的WINDOWS XP只有两种汉字字体,所以只能到网络上寻找以下六种常用字体:
#sudo gbkfont-inst simsun.ttf song
#sudo gbkfont-inst simkai.ttf kai
#sudo gbkfont-inst simhei.ttf hei
#sudo gbkfont-inst simfang.ttf fang
#sudo gbkfont-inst simyou.ttf you
#sudo gbkfont-inst simli.ttf li

具体操作方法可以参考http://zeroxu.ycool.com/post.1446655.html。
不过他的是安装CCT,我的是安装CJK,有点不同。。

最后就是别忘记了TEXHASH来更新LATEX的路径。
现在就可以在UBUNTU下进行完美的中文论文排版和输入了。。

Wednesday, February 23, 2011

解决UBUNTU下GVIM等显示中文为乱码的问题

由于WINDOWS下的汉字一般默认是GB格式,而UBUNTU下的汉字是UTF8,所以UBUNTU不能正常显示WINDOWS下书写的汉字,
比较笨拙的解决办法是下载安装zh-autoconverter,使用命令autob5来进行转换。

另外一个在GVIM上比较好的方法是,打开.vimrc,
添加以下命令:

let &termencoding=&encoding
set fileencodings=utf-8,gbk,ucs-bom,cp936

果然问题解决了。。。

Wednesday, February 16, 2011

告诉你如何让自动化学报使用最新的CTEX

国内的LATEX用户逐渐增多,当然LINUX下书写英文论文非常便捷。但是中文支持却差强人意。CTEX是在为WINDOWS用户开发的一款LATEX中文书写工具,添加了对中文的支持,感觉做的非常棒。界面功能非常的多。但是国内中文期刊还都是在用WORD排版,对于这种新鲜事物,敢为人先的就是自动化学报。
就连自动化学报也固步自封,只支持老版本的CTEX,没有提出针对新版本的方案。
其实看下它的模板,唯一和新版本不兼容的只是PSFIG插件没装。一种解决方案是自己手动安装PSFIG,我尝试过了,是不通的。另外一种方案就是放弃PSFIG,将模板中的\PSFIG命令全部换成\includegraphics命令,编译通过。图像和中文显示完美。另外编译的时候要采取两步处理,第一步是LATEX命令生成DVI文件,然后用DVI2PDF生成PDF文件。

我的户籍和档案不知何处

硕士毕业后就出国了,,档案和户籍都没管,三年过去,现在准备回国,提前找找吧。。


一、户口所谓“打回原籍”是指《户口迁移证》的迁往地址栏里写上你的原籍,而并不是给你寄回去。《户口迁移证》必须是本人或委托人来办理带回原籍落户。
二、学生毕业时由保卫处户籍室统一办理户籍迁出手续。户口迁移手续办理程序:
①已落实就业单位的,保卫处户籍室根据就业指导中心提供的《毕业生就业方案》户口迁往就业单位。
②未就业且未申请留校的,一般两年不迁户口迁往原籍。
③毕业前保卫处户籍室集体办理户口迁出手续,然后以系为单位集体来保卫处户籍室领取《户口迁移证》,分发毕业生本人带到迁往地派出所落户(不包括户口留校的)。
④户口在校没领取的,本人或委托人必须持就业《报到证》或《毕业证》到学校保卫处户籍室办理领取手续,否则后果自负。
如果学校给提出了,你四十二天内没落户或没拿回原籍入户,就变成黑户,将来向上户口麻烦了,要开很多证明才可以再从学校提出来。切记。

毕业生档案打回原籍

1.档案打回原籍的具体流程是什么?

只要你不在原籍以外的地方签订就业协议,档案会有两个去处,一是学校免费保管两年,两年期间只要你找到工作就可以随时提取,两年后没有工作就给你打回生源地,二是学校直接将你的档案打回生源地(是你参加高考的地方,跟户口所在地的原籍不同)

2.我是否需要网上注册信息或亲自到学校办理?

不需要,等到学校给你寄出档案的时候去当地人才中心询问即可。

3、如何确定已经打回原籍了?

看你发的报到证的派遣地,没签订协议的非师范类毕业生一般是派往当地人事局。

4.关于工龄问题。听说到人才市场(还是什么其他地方)办理档案托管就可以算工龄?

需要找到工作后出具相关资料才能计算工龄。但是对于没有工作的毕业生将档案放在人才中心满一年后可以办理干部身份转正。

5.究竟如何办理。

去人才中心办理委托手续即可,每年要交一定得档案保管费。
相关法律知识

* 关于学校扣留毕业生档案问题
* 我是今年应届毕业生档案不知放在...
* 高校是否有权利扣留应届毕业生档案
* 保管未就业毕业生档案协议书

毕业生户籍档案迁回原籍(亲身实践)

1、凭《户档托管申请表》到毕业生就业指导中心中间的一个窗口填写户档迁回原籍申请,领取“报到证”,然后在左边的窗口审核,领取“常住人口登记表”,最后在右边的窗口凭“报到证”领取“档案”

2、凭“常住人口登记表”到所在派出所领取“户口迁移证”,需要交5元手续费,“常住人口登记表”上有派出所的盖章,不一定学校所在派出所,不要跑错了地方哦。

3、带上“户口簿”到原籍派出所上户口,需要毕业证原件和复印件、身份证原件和复印件、户口迁移证、个人申请、村(居)委会证明,然后办理身份证就OK了。在原籍办理过二代证的需要交40元重新办理,以前没办过的需要交20元重新办理。

因为是09年毕业,需要过一段时间才能拿到“档案”,不过我看“报到证”上的接受单位是市教育局,估计拿到档案后把“报到证”和“档案”交给市教育局。

Why the Chinese punctuation mark in openoffice is so ugly

The dot always looks like in the middle of a line, for instance: 。.
How to let it stay at the bottom.
I google a lot and find out the reason is the font which is chosen is not correct.
After I choose the AR PL SungtiL GB as the font type, the punctuations are right shown in the text.
Great. But in this blog, I can not choose the font, so it's still ugly.

Monday, February 7, 2011

Merge multiple PDFs to one

Using follow command in LINux terminal:

$ gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=firstANDsecond.pdf -dBATCH first.pdf second.pdf

Wednesday, February 2, 2011

NVIDIA driver is crash when ubuntu kernel updates

After the kernel of Ubuntu is updated, the default display is crash.
The solution is reinstall the NVIDIA driver again which can be downloaded from websites.

Run:
$ sudo sh nvidiadriver.run

After a few steps of setting,
you should able to login in the x window.

Friday, January 21, 2011

How to change the numbering of the subfig in latex

The command is simple:
\setcounter{subfigure}{0}

print small pdf file for a conference

For a IEEE conference paper, all fonts must be embedded in the pdf file.
The solution is print the non-embedded pdf file to the other pdf file.
One is CUPS-PDF, but the output file is strangely larger, and the version of the pdf is 1.3, which is lower than the standard.
The other driver comes from envince document reader, which is the default reader on UBUNTU. You can directly print the file as a pdf or ps file. The surprising thing is the size of the output file is small and all fonts are embedded.

Of course, the most simple one is use ps2pdf in the latex, use follow command:
"ps2pdf -dCompatibilityLevel=1.4 -dMAxSubsetPct=100 -dSubsetFonts=true -dEmbedAllFonts=true -sPAPERSIZE=letter -dPDFSETTINGS=/printer ".

Saturday, January 15, 2011

vim-latexsuit on ubuntu 11.04

After using apt-get to install this suit, it can not work still, but add follow lines in the .vimrc file, it start to work:


" REQUIRED. This makes vim invoke Latex-Suite when you open a tex file.
filetype plugin on

" IMPORTANT: win32 users will need to have 'shellslash' set so that latex
" can be called correctly.
set shellslash

" IMPORTANT: grep will sometimes skip displaying the file name if you
" search in a singe file. This will confuse Latex-Suite. Set your grep
" program to always generate a file-name.
set grepprg=grep\ -nH\ $*

" OPTIONAL: This enables automatic indentation as you type.
filetype indent on

" OPTIONAL: Starting with Vim 7, the filetype of empty .tex files defaults to
" 'plaintex' instead of 'tex', which results in vim-latex not being loaded.
" The following changes the default filetype back to 'tex':
let g:tex_flavor='latex'


set shiftwidth=4
set cindent
syntax on
colo desert


set spell spelllang=en_us
" zg to add word to word list
" zw to reverse
" zug to remove word from word list
" z= to get list of possibilities
set spellfile=~/.vim/spellfile.add

Thursday, January 13, 2011

Solution to find out gstreamer-app for OPENCV

Need install:

$sudo aptitude install libgstreamer-plugins-base0.10-dev

Wednesday, January 12, 2011

How to stop x server of ubuntu

The solution is writing follow line in the terminal:

$ sudo /etc/init.d/gdm stop

Change the gvim default font

I start to use a new big screen, the default font of vim becomes so small.

I start to search methods that can solve it:
Add follow line to ~/.vimrc:
set guifont=Bitstream\ Vera\ Sans\ Mono\ 12

Here Bitstream\ Vera\ Sans\ Mono\ is the type of the font, and 12 is its size.

Matlab for UBUNTU, errors: Locking assertion failure

This error happens because matlab can not find out the java.
The solution is very simple, add follow line to the ~/.bashrc file:

export MATLAB_JAVA=/usr/lib/jvm/java-6-sun/jre

SVN connection with a different port number

Some times the port to the server has been changed, such that we must change the default port (25) to the new port. Here is the solution:

1. Find out the file ~/.subversions/config
2. Add follow line: sshtunnels=ssh -p newportnummer. Save the file and exit.
3. Checkout the server svn repository by: svn co svn+sshtunnels://hostname@hostip/pathToSvnRepository

That's it.