Showing posts with label Ubuntu. Show all posts
Showing posts with label Ubuntu. Show all posts

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.

Thursday, April 28, 2011

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....

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.

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 16, 2011

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

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

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.

Tuesday, November 9, 2010

Let your folders become secret

Under Linux, maybe some files that you don't want to share with others, so the best way is to encrypt the secret files.
Here I introduce a simple way for Ubuntu or other linux users:
First install CFS:
$ apt-get install cfs

Make a folder where you want to keep secret files.
$ cmkdir Secret
Now input your password (At least 16 characters). You have to remember it.

Attach a folder to show the secret context in "Secret" and might add more files to "Secret":
$ cattach Secret tmp
Now input the mentioned password.

Check the context of folder "Secret":
$ cd /crypt/tmp
$ ls

You will see all files that have been encrypted in "Secret", are now shown in "/crypt/tmp".
Now you can add more files in "/crypt/tmp":
$ cp some.txt /crypt/tmp/

After changing the "/crypt/tmp" folder, you have to encrypt the folder:
§ cdetach tmp

Now the folder "/crypt" become empty. However, you can check the encrypted file is added in "Secret" now.

That's it!

Friday, September 24, 2010

Nautilus open folder from terminal

Great command....
You can open current folder from terminal command line....

Thursday, November 12, 2009

Smart search history command in linux bash

Well, many people knows the up key can search the similar command in matlab terminal. But in linux (Ubuntu), if you work on terminal and want to try this, then nothing happen. If you want it search command history automaticly, you need do:

edit \etc\inputrc
uncomment next part:

# alternate mappings for "page up" and "page down" to search the history
"\e[5~": history-search-backward
"\e[6~": history-search-forward


Now you can use page up and down to search command history. Is that cool? eh.....

Tuesday, July 21, 2009

Input Chinese in Ubuntu(输入中文)

I follow the guidance of website "http://ubuntuforums.org/showthread.php?p=124214".
1. Install libraries:
* scim
* scim-chinese
* scim-config-socket
* scim-frontend-socket
* scim-gtk2-immodule
* scim-server-socket
* scim-tables-zh (option)
* xfonts-intl-chinese
* xfonts-intl-chinese-big
* ttf-arphic-gbsn00lp
* ttf-arphic-gkai00mp
* ttf-arphic-bkai00mp
* ttf-arphic-bsmi00lp


2, Open a terminal,
$gvim .xsession

Type
"
scim -d
export XMODIFIERS=@im=scim
export GTK_IM_MODULE=scim
gnome-session
"

Then save .xsession under your home direcotry.

$chomd +x .xsession



Restart X server by CTRL+ALT+BACKSPACE

Activate the chinese input by CTRL+SPACE.

Finally I got it. Very cool, just feel a little strange.

现在可以用中文咯。。。。。嘻嘻。。。




This method is dead in June, 2010.



But I find a solution:
$sudo apt-get install scim-qtimm im-switch scim-pinyin
$im-switch -z en_US -s scim

It works again......你看到了吧。。。死掉的SCIM又活回来了。。