Sep 29, 2009

Sep 28, 2009

Saliency Toolbox with ubuntu 8.10

The SaliencyToolbox is a collection of Matlab functions and scripts for computing the saliency map for an image, for determining the extent of a proto-object, and for serially scanning the image with the focus of attention. It has been cited in more than 60 papers.

System requirements:

* Any computer and operating system that runs Matlab
* Matlab Release 13 or later
* Image Processing Toolbox

What to do :

1- Unpacking the code creates a directory structure under SaliencyToolbox. Simply add the SaliencyToolbox directory including its subdirectories to your Matlab path:
[MATLAB] >> addpath(genpath(""));
2- Okay, now that installation was so simple, you have some time left for a test drive, right? Version 2.0 sports a new graphical user interface (GUI) version of the saliency code. In Matlab, change to the SaliencyToolbox directory, then type:
[MATLAB] >> guiSaliency('img/balloons.png');
Hit "Start" to start the saliency computation. Everything else should be fairly intuitive.

There is also the command-line version of the program:
[MATLAB] >> runSaliency('img/balloons.png');
After a few moments, you should see four figure windows with various intermediate results, and in the Matlab window you will see details about the most salient location, which is also marked in the image. You can now hit Return to go to the next most salient location and so forth. To quit, simply enter 'q' and press Return.

3- If you receive a fatal error "MEX file xxx could not be found." and you are sure that you have set the paths correctly, then you might need to compile the mex files for your system.

* You should export MATLABROOT
[TERMINAL] >> export MATLABROOT="PAth to matlab"
* Then type
[TERMINAL] >> make
* You can see some errors, such that The program 'mex' is currently not installed. You can install it by typing: sudo apt-get install texlive-lang-polish

Solution:
-> Edit makefile in src of saliency toolbox code

* MEXFLAGS := -cxx (This should be selected)
* MEXOPTS := {PATH_TO_SALIENCY_TOOLBOX}/src/mexopts.sh
* MEX := {PATH_TO_MATLAB}/bin/mex

-> Edit mexopts.sh

* change
CFLAGS='-fPIC -ansi -D_GNU_SOURCE -pthread -fexceptions -m32'
to
CFLAGS='-fPIC -ansi -D_GNU_SOURCE -pthread -fexceptions'

* If there is no error, go to matlab and again run saliency code. If it still gives this error:

Error:

{MATLABPATH}/sys/os/glnx86/libgcc_s.so.1: version `GCC_4.2.0' not found (required by /usr/lib/libstdc++.so.6)

Solution:

Remove the libgcc_s.so.1 from: {MATLABPATH}/sys/os/glnx86/

After that, restart your computer !
Have fun while finding regions of importance =)

Note:

[TERMINAL]-> gcc --version)

gcc (Ubuntu 4.3.2-1ubuntu12) 4.3.2
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

References:
http://www.saliencytoolbox.net/
http://mexcdf.sourceforge.net/faq.html
http://www.saliencytoolbox.net/doc/index.html

Sep 23, 2009

Linux: The detailed information about your computer's trademark, hardware, etc.

1 - CPU Information
[TERMINAL] >> cat/proc/cpuinfo
2- RAM Information
[TERMINAL] >> cat/proc/meminfo
3 - hda Information
[TERMINAL] >> dmesg|grep "^hda"
4 - hdd Information
[TERMINAL] >> dmesg|grep "^hdd"
5 - USB audio card Information
[TERMINAL] >> dmesg|grep usb
6 - PCI devices Information
[TERMINAL] >> lspci

Oops! Matlab gives OpenGL Error !!!

In matlab, do you get error when you prompt:
[MATLAB] >> opengl info
If yes, you have to link your opengl libraries. Firstly, look at your libraries :
[TERMINAL] >> cd /usr/lib
[TERMINAL] >> ls *GL*

you have some libGL, libGLU libraries. Here is my results:
libEGL.so libGL.so libQtOpenGL.prl
libGLcore.so.1 libGL.so.1 libQtOpenGL.so
libGLcore.so.177.82 libGL.so.177.82 libQtOpenGL.so.4
libGLESv2.so libGLU.a libQtOpenGL.so.4.4
libGLEW.so.1.5 libGLU.so libQtOpenGL.so.4.4.3
libGLEW.so.1.5.0 libGLU.so.1
libGL.la libGLU.so.1.3.070200

You can get the correct version of these libraries by setting up MATLAB to use your native Linux "libGL.so" file and the generic "libGLU.so" file that is shipped with MATLAB in the $MATLABROOT/sys/opengl/lib/glnx86 directory (where $MATLAB is the root MATLAB directory).

Consult your system documentation to identify the location of your native Linux OpenGL libraries. They are files or symbolic links called "libGL.so" and they are usually located in a directory such as /usr/lib or a similar directory. This native library may indicate Mesa software OpenGL, or may indicate a library that is specifically accelerated for your hardware. Later in this resolution, you will see how to determine which MATLAB is using.

Once you have identified these libraries, for example: /usr/lib/libGL.so and [YOUR_MATLAB_PATH]/sys/opengl/lib/glnx86/libGLU.so

you can create symbolic links in some_directory to these respective libraries using the UNIX linking utility. For example, assuming your native OpenGL Linux library "libGL.so" is located in /usr/lib and your MATLAB is installed in /usr/matlab, you would then do something such as this:
[TERMINAL] >> cd /usr/MATLAB_OpenGL
[TERMINAL] >> ln -s /usr/lib/libGL.so libGL.so
[TERMINAL] >> ln -s [YOUR_MATLAB_PATH]/sys/opengl/lib/glnx86/libGLU.so libGLU.so

And then edit your matlab configuration file where it is in [YOUR_MATLAB_PATH]/bin/matlab


[TERMINAL] >> sudo nano [YOUR_MATLAB_PATH]/bin/matlab

Find the line : # Determine for each platform and find the first export LD_LIBRARY_PATH , before this line , add

LD_LIBRARY_PATH=/usr/MATLAB_OpenGL:$LD_LIBRARY_PATH

And, then you can verify which OpenGL library file MATLAB is using by using the "ldd" command:

[TERMINAL] >> ldd /usr/matlab/bin/glnx86/glren.so

You can verify which renderer the libraries actually indicate by using the following command in MATLAB:

[MATLAB] >> opengl info

After you have determined what you are using for hardware, check which XVisual your MATLAB figure is using. You can use the following MATLAB commands:

[MATLAB] >> hf=figure;
set(hf,'renderer','opengl');
get(hf,'xvisual')
Output:
ans =
0x23 (TrueColor, depth 24, RGB mask 0xff0000 0xff00 0x00ff)

Now cross-reference this number against the output of the UNIX command, glxinfo:

[MATLAB] >> !glxinfo
Output:

visual x bf lv rg d st colorbuffer ax dp st accumbuffer ms cav
id dep cl sp sz l ci b ro r g b a bf th cl r g b a ns b eat
----------------------------------------------------------------------
0x23 24 tc 0 24 0 r y . 8 8 8 8 0 0 0 0 0 0 0 0 0 None
0x24 24 tc 0 24 0 r . . 8 8 8 8 0 0 0 0 0 0 0 0 0 None
0x25 24 tc 0 24 0 r y . 8 8 8 8 0 24 8 0 0 0 0 0 0 None
0x26 24 tc 0 24 0 r . . 8 8 8 8 0 24 8 0 0 0 0 0 0 None
0x27 24 tc 0 24 0 r y . 8 8 8 8 0 0 0 16 16 16 0 0 0 Slow
0x28 24 tc 0 24 0 r . . 8 8 8 8 0 0 0 16 16 16 0 0 0 Slow
0x29 24 tc 0 24 0 r y . 8 8 8 8 0 24 8 16 16 16 0 0 0 Slow
0x2a 24 tc 0 24 0 r . . 8 8 8 8 0 24 8 16 16 16 0 0 0 Slow
0x2b 24 dc 0 24 0 r y . 8 8 8 8 0 0 0 0 0 0 0 0 0 None
0x2c 24 dc 0 24 0 r . . 8 8 8 8 0 0 0 0 0 0 0 0 0 None
0x2d 24 dc 0 24 0 r y . 8 8 8 8 0 24 8 0 0 0 0 0 0 None
0x2e 24 dc 0 24 0 r . . 8 8 8 8 0 24 8 0 0 0 0 0 0 None
0x2f 24 dc 0 24 0 r y . 8 8 8 8 0 0 0 16 16 16 0 0 0 Slow
0x30 24 dc 0 24 0 r . . 8 8 8 8 0 0 0 16 16 16 0 0 0 Slow
0x31 24 dc 0 24 0 r y . 8 8 8 8 0 24 8 16 16 16 0 0 0 Slow
0x32 24 dc 0 24 0 r . . 8 8 8 8 0 24 8 16 16 16 0 0 0 Slow

You can see that a visual id of 0x23 has a depth ("dp th") of 0. This indicates that the patches do not get rendered in the proper order. The renderer is not paying attention to their depth within the monitor.

To fix this, choose the best TrueColor visual that has a depth and that has double buffering. A TrueColor visual has a "visual cl" value of "tc", and a double buffering visual has a "d b" value of "y".

In this case visual 0x25 has TrueColor, double buffering, 24bit Zbuffer ("bfsz"), and is not "slow".

The following code shows how to set this visual to all MATLAB figures. You may wish to put this line of code in a "startup.m" file:

[MATLAB] >> set(0,'defaultfigurexvisual','0x25');
and well done ! =)

References:
http://onurs.wordpress.com/tag/linux/
http://www.mathworks.com/support/solutions/en/data/1-18N21/index.html?solution=1-18N21

Projects - Installing Matlab on Linux

The version of matlab : Mathworks MATLAB V7.0 Release-14
Including:
* MathWorks_R14_1.iso
* MathWorks_R14_2.iso
* MathWorks_R14_3.iso
* license.dat
* license.lic

How to Install: commands for your terminal
* #mkdir -p /mnt/iso # make the mount point for ISOs
* #mount -o loop /path/to/Matlab_R14_Mac.Linux.Unix_CD1.iso /mnt/iso # mount the first ISO
* #mkdir -p /usr/local/matlab7/etc # make the installed directory for Matlab
* #cp /mnt/iso/Matlab.7.R14.License-Mac.OS.X-Unix-Linux/Matlab.7.R14.License-Mac.OS.X-Unix-Linux/* /usr/local/matlab7/etc/ # copy the licenses files (license.dat and license.lic)

Then modify the file license.lic with your own $HOSTNAME environment variable as follows:

#echo $HOSTNAME
FlyZhy.ouc.edu.cn
#chmod -R 755 /usr/local/matlab7
#vim /usr/local/matlab7/etc/license.lic
... ...
#cat /usr/local/matlab7/etc/licesne.lic
SERVER FlyZhy.ouc.edu.cn ANY 5353
VENDOR MLM

#
# Mathworks MATLAB V7.0 Release-14 License
#
# --------------------------------------------------------------------
#
# Mendling with Feature lines will only invalidate them!
# Don't forget to set MLM_LICENSE_FILE to point to the saved LICENSE.LIC
#
# --------------------------------------------------------------------
#
... ...

At last, getting started to install by typing the following command:

#cd /usr/local/matlab7/
#/mnt/iso/install
... ...

During the installation, answer the questions by clicking the suitable button when it pops up any windows with some questions. After it finishes the first ISO, it will prompt you to mount the second ISO by popping up a window, then you should mount the second ISO as it requires by typing:

#umount /mnt/iso # unmount the first ISO
#mount -o loop /path/to/Matlab_R14_Mac.Linux.Unix_CD2.iso /mnt/iso # mount the second ISO

Then click "OK" or something like that to continue the installation. After the second ISO is finished, just do the same operations to install the third ISO until it finished all the three ISOs. (Do it for the 3rd iso)

How to configure:

After finished the installation, try to type matlab in your shell, does it work? Of course not. You should do the last thing to make it work in GNU/Linux shell that is add the path "/usr/local/matlab7/bin" into your $PATH environment variable (maybe you should add "export PATH=$PATH:/usr/local/matlab7/bin" into your $HOME/.bashrc file and then execute it by the command . ~/.bashrc or source ~/.bashrc to make the change effect now).

If you are lucky to finish all the process without any error, congratulations and enjoy now.


#matlab # the default Matlab interface
#matlab -nojvm # the CLI mode of Matlab
#matlab -nodesktop # the same as above

Enjoy matlab on linux =)

Reference : http://www.zhyfly.org/projects/MatlabInstall.html

Mount ISO files in linux


mount -o loop -t iso9660 file.iso /mnt/test
sudo umount /mnt/test

YUV Player for Linux

I can watch a .yuv animation. You need to specify the size it was rendered at - that doesn't seem to be part of the file format:
animate -size 480x270 file.yuv
I can single-step through a .yuv animation, using SPACE to step forward and BACKSPACE to step back through the frames:
display -size 480x270 file.yuv
I can also convert a .yuv to a series of .png files. This makes file-0.png through file-23.png for a 24 frame animation:
convert -size 480x270 file.yuv file.png
I also discovered that ffmpeg will happily convert a .yuv to .avi if you just tell it the image dimensions:
ffmpeg -s 480x270 -i file.yuv file.avi
Reference: http://www.synfig.org/Render_options

Linux version control

At a terminal, enter ->
lsb_release -a
Current ubuntu releases:

Sep 19, 2009

DNS for restricted web sites

208.67.222.222
208.67.220.220

these Dns addresses are for restricted sites....

have fun!

Sep 13, 2009

log4cxx with Visual Studio 2008

1- Download necessary files from here

2- Then unrar the file and under msvc9-proj directory, open the VS project to build necessary dll and library files.

3- Copy the dll file under Release_Shared.

4- Open Visual Studio. Tools->Options->VC++Directories->Library Files, add path to Release_Shared directory for linking necessary libraries.

5- Tools->Options->VC++Directories->Include Files, add path to src/main/include

6- To use the static link log4cxx library, the macro LOG4CXX_STATIC MUST be defined in your projects preprocessor, otherwise your compilation will suffer unresolved linking error:
6-1) Open your project's settings.
6-2) C/C++->Preprocessor->Preprocessor Definitions , add LOG4CXX_STATIC.

Now, you can use logger with Vs 2008.

Ref: http://www.dreamcubes.com/blog/index.php?itemid=43

Sep 1, 2009

CEGUI Tips: UnifiedAreaRect

means start from 0,0 to 1.3,0 and 0,0 to 0.8. here 1.3 is the width and 0.8 is the height.

Visual Studio Keyboard Shortcuts

Playing with keyboard shortcuts is very interesting and reduce the headache of using the mouse again and again while programming with visu...