June 2006 Archives
Fri, 2006-06-23 10:56:00 +0800
Compile OpenCV Conveniently in GNU/Linux
Refer to How To Compile OpenCV in Linux we know that it's a little complicated to compile OpenCV by:
#gcc `pkg-config --cflags opencv` `pkg-config --libs opencv` -o my-opencv-prgm my-opencv-prgm.c
or simply (in contrast the above command):
gcc `pkg-config --cflags --libs opencv` -o my-opencv-prgm my-opencv-prgm.c
However, it's still not convenient to type a long command like that. So, just put the following line in your $HOME/.bashrc:
alias gccopencv="gcc `pkg-config --cflags --libs opencv`"
and then run #. $HOME/.bashrc, now you can compile the OpenCV file by
#gccopencv -o my-opencv-prgm my-opencv-prgm.c
Thu, 2006-06-22 17:58:13 +0800
Intel IPP and OpenCV Installation
IPP Installation
Intel Integrated Perfomance Primitives (IPP) is a library of thousands of multi-core-ready, highly optimized software functions for multimedia and data processing applications. It's not free, however, you can get the evaluation version from Intel which will expire in one month. Also you can register and pay for download it. There will be several kinds of version to download:
- Intel Integrated Performance Primitives v5.1 for Linux* on IA-32 Intel Architecture
- Intel Integrated Performance Primitives v5.1 for Linux* on Intel EM64T-Based Platforms
- Intel Integrated Performance Primitives 5.1 for Linux* on Intel Itanium Architecture
- Intel Integrated Performance Primitives 5.1 for Linux* on Intel IXP4XX Product Line of Network Processors
- Intel Integrated Performance Primitives v5.0 for Linux* on Intel PXA27x Processors
You can choose one of them according to your hardware structure. Then I will take my situation as example to show how to install it:
#tar xvfz l_ipp_ia32_p_5.1.016.tgz#cd l_ipp_ia32_p_5.1.016#./install.sh
I choose to install IPP to $HOME/.opt/intel as non-root, you can make your own decision to answer the questions it required.
OpenCV Installation
You can first read Installing OpenCV on my Slackware 10.2 for the reference. But I will install OpenCV to a different place with the following commands:
#./configure --prefix=$HOME/.opt/intel/opencv-0.9.7 --with-x --with-gnu-ld --enable-shared#make && sudo make install
Libraries
After installation you should update the shared library by modifing the file /etc/ld.so.conf at first:
#cat /etc/ld.so.conf
... ...
/home/flyzhy/.opt/intel/ipp/5.1/ia32/sharedlib
/home/flyzhy/.opt/intel/opencv/lib
And then run sudo ldconfig.
For OpenCV you should change the variable $PKG_CONFIG_PATH by adding a line in your $HOME/.bashrc:
export PKG_CONFIG_PATH=/where/you/have/installed/opencv/lib/pkgconfig:${PKG_CONFIG_PATH}
At last run . $HOME/.bashrc.
You can check that the PKG_CONFIG_PATH is correct by doing either:
#pkg-config --cflags opencv#pkg-config --libs opencv
Test
Here we go! You can test your OpenCV by compiling the opencv-version/samples/c/ with the command:
#sh ./build_all.sh
If no error occurs, congratulations! Or else check through your steps and feel free to contact me.
Docs
Wed, 2006-06-21 12:41:54 +0800
wvHtml - a good tool to convert .doc to .html
wvHtml is really a good tool to convert .doc file to .html file especially for me who never want to use M$ Office (you might ask for what I used for documents, yes, I use TeX/LaTeX to document).
Actually I do not receive any M$ Office file, however, I can not avoid these kinds of files. If I met them, I always choose three methods to deal with:
- use ExpressPDF to convert .doc to .pdf
- use
wvHtmlto convert .doc to .html - use Gmail to look through the .doc file
Here wvHtml can be downloaded from http://prdownloads.sourceforge.net/wvware/, and the usage for .doc file is:
#wvHtml --charset=gb2312 filename.doc filename.html
Besides, I use this tool to change the attached .doc file in my Mail which is managed by Mutt+Esmtp+Fetchmail system.
Tue, 2006-06-20 21:04:52 +0800
About writing LaTeX resume and my writing
LaTeX is really a very good tool for me to make some arts about documents. Also it can help you make a good career from a well look resume. Here is the resume of mine (with source):
- English: Source PostScript PDF using shading.sty package
- Chinese: Source PDF
Here also gives some references to make this:
Enjoy!
Mon, 2006-06-19 20:44:48 +0800
Installing OpenCV on my Slackware 10.2
What you need
The file INSTALL said that:
you need to build and use a _shared_ library libavcodec.so.*:
get ffmpeg-0.4.9-pre1 from ffmpeg.sourceforge.net
./configure --enable-shared
make
make install
you will have got: /usr/local/lib/libavcodec.so.* &
/usr/local/include/ffmpeg/*.h
How to install
#tar xvfz ffmpeg-0.4.9-pre1.tar.gz#cd ffmpeg-0.4.9-pre1#./configure --with-x --with-gnu-ld --enable-shared#make && make install
#tar xvfz opencv-0.9.7.tar.gz#cd opencv-0.9.7#./configure --enable-shared#make && make install
Then read How To Compile OpenCV in Linux for more information.
Mon, 2006-06-19 10:27:38 +0800
New features of JavE
I got some problem about JavE5, so I asked for help on the forum of JavE. The problem was that when I quit jave with jave5 using jre1.5.0_04/bin/java in Linux, I got the following error:
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at sun.awt.X11.XMenuPeer.repaintMenuItem(Unknown Source) at sun.awt.X11.XMenuItemPeer.setEnabled(Unknown Source) at sun.awt.X11.XMenuItemPeer.disable(Unknown Source) at java.awt.MenuItem.disable(Unknown Source) at java.awt.MenuItem.enable(Unknown Source) at java.awt.MenuItem.setEnabled(Unknown Source) at de.jave.jave.JaveMenuBar.updateWindowsMenu(JaveMenuBar.java:579) at de.jave.jave.Jave.updateWindowsMenu(Jave.java:356) at de.jave.jave.Jave.doExit(Jave.java:1109) at de.jave.jave.Jave.windowClosing(Jave.java:2964) at java.awt.AWTEventMulticaster.windowClosing(Unknown Source) at java.awt.Window.processWindowEvent(Unknown Source) at java.awt.Window.processEvent(Unknown Source) at java.awt.Component.dispatchEventImpl(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Window.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source)
I did not know what's the problem about this, however, I got the answer from jave:
Please upgrade to the current JavE 6.0 developer version. It can be downloaded from: http://www.jave.de/developer/jave_6.0_i20060105.zip Also there is general information about the new JavE 6.0 versions in the JavE Wiki at: http://wiki.jave.de/index.php/Build_downloads Let me know if the problem still exists with the new version. Regards, Markus
Then I download the new version of JavE and got the perfect new JavE, thanks to Markus so much.
Fri, 2006-06-16 10:23:39 +0800
How To use rar for Linux to compress documents
RAR for Linux is very useful for uncompressing .rar documents that is:
#unrar x example.rar /path/to/extract/directory
However, how to compress .rar files, and this is the solution:
#rar a example.rar /path/to/compress/directory
You can also add a file or compress a file by this way. Here gives more options:
Usage: rar <command> -<switch 1> -<switch N> <archive> <files...>
<@listfiles...> <path_to_extract\>
<Commands>
a Add files to archive
c Add archive comment
cf Add files comment
cw Write archive comment to file
d Delete files from archive
e Extract files to current directory
f Freshen files in archive
i[par]=<str> Find string in archives
k Lock archive
l[t,b] List archive [technical, bare]
m[f] Move to archive [files only]
p Print file to stdout
r Repair archive
rc Reconstruct missing volumes
rn Rename archived files
rr[N] Add data recovery record
rv[N] Create recovery volumes
s[name|-] Convert archive to or from SFX
t Test archive files
u Update files in archive
v[t,b] Verbosely list archive [technical,bare]
x Extract files with full path
<Switches>
- Stop switches scanning
ad Append archive name to destination path
ag[format] Generate archive name using the current date
ap<path> Set path inside archive
as Synchronize archive contents
av Put authenticity verification (registered versions only)
av- Disable authenticity verification check
c- Disable comments show
cfg- Disable read configuration
cl Convert names to lower case
cu Convert names to upper case
df Delete files after archiving
dh Open shared files
ds Disable name sort for solid archive
e[+]<attr> Set file exclude and include attributes
ed Do not add empty directories
en Do not put 'end of archive' block
ep Exclude paths from names
ep1 Exclude base directory from names
ep3 Expand paths to full including the drive letter
f Freshen files
hp[password] Encrypt both file data and headers
id[c,d,p,q] Disable messages
ierr Send all messages to stderr
ilog[name] Log errors to file (registered versions only)
inul Disable all messages
isnd Enable sound
k Lock archive
kb Keep broken extracted files
m<0..5> Set compression level (0-store...3-default...5-maximal)
mc<par> Set advanced compression parameters
md<size> Dictionary size in KB (64,128,256,512,1024,2048,4096 or A-G)
ms[ext;ext] Specify file types to store
n<file> Include only specified file
n@ Read file names to include from stdin
n@<list> Include files in specified list file
o+ Overwrite existing files
o- Do not overwrite existing files
ol Save symbolic links as the link instead of the file
ow Save or restore file owner and group
p[password] Set password
p- Do not query password
r Recurse subdirectories
r0 Recurse subdirectories for wildcard names only
rr[N] Add data recovery record
rv[N] Create recovery volumes
s[<N>,v[-],e] Create solid archive
s- Disable solid archiving
sfx[name] Create SFX archive
si[name] Read data from standard input (stdin)
t Test files after archiving
ta<date> Process files modified after <date> in YYYYMMDDHHMMSS format
tb<date> Process files modified before <date> in YYYYMMDDHHMMSS format
tk Keep original archive time
tl Set archive time to latest file
tn<time> Process files newer than <time>
to<time> Process files older than <time>
ts<m,c,a>[N] Save or restore file time (modification, creation, access)
u Update files
v Create volumes with size autodetection or list all volumes
v<size>[k,b] Create volumes with size=<size>*1000 [*1024, *1]
ver[n] File version control
vn Use the old style volume naming scheme
vp Pause before each volume
w<path> Assign work directory
x<file> Exclude specified file
x@ Read file names to exclude from stdin
x@<list> Exclude files in specified list file
y Assume Yes on all queries
z<file> Read archive comment from file
Tue, 2006-06-13 16:40:07 +0800
Setting up CVS server in my own system
The first thing to use cvs is to set up cvs server correctly, here is everything I did to get started with cvs. Notice that I used Slackware 10.2 GNU/Linux system.
- Installing cvs on your system.
Most of the GNU/Linux distro with cvs installed as default, if you lost it, just install it from the source install CD or download from the home of cvs. - Configuring cvs server.
- Create a new group named cvs:
#groupadd cvs - Create a new user named cvsroot with cvs as its group:
#useradd -g cvs -p ****** -s /bin/bash cvsroot - Make home for cvsroot:
#mkdir /home/cvsroot#chown cvsroot:cvs /home/cvsroot#chmod 771 /home/cvsroot - Set up cvs repository with the cvsroot user:
#su cvsroot#cvs -d /home/cvsroot init - Modify the file /etc/inetd.conf by adding a line as follows:
cvspserver stream tcp nowait root /usr/bin/cvs cvs -f --allow-root=/home/cvsroot pserver
- Modify the file /etc/services (if you have the following line then donot change it):
cvspserver 2401/tcp #CVS network server
- Add your user to cvs group by changing /etc/group from
... ... cvs:x:103:
to... ... cvs:x:103:user
- Create a new group named cvs:
- Configuring cvs client by setting the variable CVSROOT with a line added in your $HOME/.bashrc:
export CVSROOT=":pserver:${USER}@${HOSTNAME}:/home/cvsroot" - Restarting cvs server (for slackware):
#/etc/rc.d/rc.inetd restart - Using cvs now:
#cvs login#cd /your/project/import the project#cvs -import -m "My Project" project_name tag_1 tag_2#cd /your/cvsWorkSpace/checkout the project#cvs checkout project_name#cd project_name/save the changes#cvs commit -m "Made some useful changes on some files"add two files#cvs commit -m "Add two files: file_1_add and file_2_add" file_1_add file_2_adddelete a file#rm file_delete#cvs remove file_delete#cvs commit -m "Delete a file: file_delete" file_deleteset up the special version number#cvs tag release0-1checkout a special version number#cvs checkout -r release0-1 project_nameupdate#cvs updatecompare#cvs diff file_name
References
- CVS Tips (in Chinese)
- CVS quick start (in Chinese)
- CVS server setting (in Chinese)
Fri, 2006-06-09 22:31:36 +0800
BINS warning: Parameterless "use IO" deprecated at /usr/share/perl5/HTML/Clean.pm line 4
BINS is a perfect program to generate Static HTML Photo Album based on GNU/Linux shell and perl. However, when I use it I got the warning as follows:
Parameterless "use IO" deprecated at /usr/share/perl5/HTML/Clean.pm line 4
I Googled it and find a perl bug here, it said that:
We believe that the bug you reported is fixed in the latest version of libhtml-clean-perl_0.8-4 ... * Removed needless "use IO;" from lib/HTML/Clean.pm because it caused warnings every time it was loaded
So I commented the 4th line which is
use IO;
in the file /usr/share/perl5/HTML/Clean.pm with a "#", and it's good now.
, if you have a problem like that, give this a try now.
Fri, 2006-06-09 10:16:16 +0800
How to make Chinese bookmarks pdf file for TeX/LaTeX
It's very boring when generate pdf file with Chinese bookmarks before, however, it's perfect now because we have gbk2uni to generate Chinese bookmarks. Follow me and let's do the amazing work:
- First add something necessary in the preamble of the TeX file as follows:
\usepackage[dvipdfm,% CJKbookmarks=true,% bookmarksnumbered=true,% bookmarksopen=true,% ]{hyperref}it's ok if you substitute dvipdfm by pdftex. - Then run
latexto compile the .tex file several times until it doesnot recommand you torerun. - Next run
gbk2unito the .out file such as:#gbk2uni foo.out
suppose the file you compiled before is foo.tex - At last, run
latexfor the last time and generate pdf bydvipdfm.
So, the whole things you should do to get the perfect result are:
- dvipdfm
#latex foo.tex #latex foo.tex #latex foo.tex #gbk2uni foo.out #latex foo.tex #dvipdfm foo.dvi
- pdflatex
#pdflatex foo.tex #pdflatex foo.tex #pdflatex foo.tex #gbk2uni foo.out #pdflatex foo.tex
Thu, 2006-06-08 02:37:03 +0800
Custom the caption style of figure in TeX
To custom the header of the caption, use the command:
\renewcommand{\figurename}{Fig}
If you need more bells and whistles, you should check out caption2 package and read Using Imported Graphics In LaTeX2e (in Chinese or in English (ps)) in Chapter 19.
Wed, 2006-06-07 03:57:11 +0800
Using comic fonts in LaTeX
If you are using updmap to manage the map files for your TeX/LaTeX, you can easily run the command updmap to configure the stuffs like pdftex/pdflatex, dvips, dvipdfm to know comicsans package. Besides, you can also use the comic fonts in your LaTeX document as follows:
\documentclass{article}
%\usepackage[ulemph]{comicsans}
\begin{document}
comicsans\\
{\usefont{OT1}{comic}{m}{n} OT1 comicmn}\\
{\usefont{OT1}{comic}{b}{n} OT1 comicbn}\\
{\usefont{OT1}{comic}{m}{sl} OT1 comicmsl}\\
{\usefont{OT1}{comic}{b}{sl} OT1 comicbsl}\\
{\usefont{OT1}{comic}{m}{sc} OT1 comicmsc}\\
{\usefont{OT1}{comic}{bx}{n} OT1 comicbxn}\\
{\usefont{OT1}{comic}{m}{it} OT1 comicmit}\\
{\usefont{OT1}{comic}{bx}{sl} OT1 comicbxsl}\\
{\usefont{OT1}{comic}{b}{it} OT1 comicbit}\\
{\usefont{OT1}{comic}{bx}{it} OT1 comicbxit}\\
{\usefont{OML}{comic}{m}{n} OML comicmn}\\
{\usefont{OML}{comic}{b}{n} OML comicbn}\\
{\usefont{OML}{comic}{bx}{n} OML comicbxn}\\
{\usefont{T1}{comic}{m}{n} T1 comicmn}\\
{\usefont{T1}{comic}{b}{n} T1 comicbn}\\
{\usefont{T1}{comic}{m}{sl} T1 comicmsl}\\
{\usefont{T1}{comic}{b}{sl} T1 comicbsl}\\
{\usefont{T1}{comic}{m}{sc} T1 comicbsc}\\
{\usefont{T1}{comic}{bx}{n} T1 comicbxn}\\
{\usefont{T1}{comic}{m}{it} T1 comicmit}\\
{\usefont{T1}{comic}{bx}{sl} T1 comicbxsl}\\
{\usefont{T1}{comic}{b}{it} T1 comicbit}\\
{\usefont{T1}{comic}{bx}{it} T1 comicbxit}\\
\end{document}
And the result is: