Tuesday, 19 February 2013

Scanning a Document in ubuntu 12.04

Install sane and sane-utils package
$ sudo apt-get install sane sane-utils 

to scan the image issue to following command

$ scanimage > back.ppm

Tuesday, 12 February 2013

Compiling 32 bit binaries/libraries on 64 Bit OS - Ubuntu 12.04

On 64 bit 0S 32 bit compile and run time include and libraries are not present by default
we need to install these dependencies
below are few of packages that are required

sudo apt-get install ia32-libs libc-i386 libc6-dev-i386

Without these dependencies
u will be unable to compile 32 bit libs/binaries

withput lib6-dev-i386 u may encounter the error
/usr/include/features.h:323:26: fatal error: bits/predefs.h: No such file or directory

Uniform Color Quantization

Uniform Color Quantization by

Friday, 8 February 2013

Oracle JDK Installation on Ubuntu 12.04

  • Download Oracle JDK
Go to download site http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html

select jdk-7u13-linux-i586.tar.gz for 32bit JDK download.

* Extract the Tar file to required directory for example /opt/softwares-linux/jdk1.7.0_13/

* Install the pointer to the JDK locations

sudo update-alternatives –install “/usr/bin/java” “java” “/opt/softwares-linux/jdk1.7.0_13bin/java” 1

sudo update-alternatives –install “/usr/bin/javac” “javac” “/opt/softwares-linux/jdk1.7.0_13/bin/javac” 1

sudo update-alternatives –install “/usr/bin/javaws” “javaws” “/opt/softwares-linux/jdk1.7.0_13/bin/javaws” 1

* Configure The default JDK configuration

sudo update-alternatives –config java
sudo update-alternatives –config javac
sudo update-alternatives –config javaws

Wednesday, 6 February 2013

OpenCL 2D Convolution Using Separable Filters -Box Filter

The Article contains details and code about implementations of Convolution Operation using Separable filters in an Heterogeneous Parallel Programming Environment using  OpenCL.

In the Present article Box filter is implemented and comparison of performance of 2D separable Convolution,2D convolution and CPU Host 2D convolution operations are performed

Tuesday, 5 February 2013

Compiling OpenCV 2.4.3 for Ubuntu 12.04 and Android Platform

Compiling/Building OpenCV 2.4.3 for Ubuntu 12.04 and Android Platform

Build for Ubuntu 12.04

* Install Required Packages

* GCC 4.4.x or later. :

   sudo apt-get install build-essential

* CMake 2.6 or higher and cmake-gui

Assuming that you have downloaded the OpenCV 2.4.3 source code and unzipped
it to specified directory

* GTK+2.x or higher, including headers (libgtk2.0-dev);


Python 2.6 or later and Numpy 1.5 or later with developer packages (python-dev, python-numpy);

ffmpeg or libav development packages: libavcodec-dev, libavformat-dev, libswscale-dev;

* libdc1394 2.x;

 libjpeg-dev, libpng-dev, libtiff-dev, libjasper-dev.


* Run cmake-gui command
   select the OpenCV source and configure build directory where the make files will be generated.

* Press Configure button 

You may receive error configuration completed/terminated with errors

you can see the error log in the Tab below the option panel

The errors are occuring because the default options enabled are not compatible 
with software packages installed in the system

To resolve the errors  deselect the packages that are not required 

For example :
- i disable WITH_CUDA  as my PC does not have GPU 
hence CUDA toolkit is not installed ( CUDA is for  hetrogenous parallel programming) 

- i disable WITH_GSTREAMER since i had not installed the GSTREAMER package

- i disable WITH_OPENEXR ( OPENEXR is format for HDR images )

- i disable WITH_V4l               ( v4l is video for linux package)

I enable Additional options that are disabled by default
I enable WITH_TBB          

i enable WITH_OPENCL  (OpenCL is open source package for hetrogenous parallel programming)

After that i press the generate option ,and errors are resolved and make files are generated

Alternatively you can install the required packages to resolve the dependencies and then proceed to generate the make files successfully.

* To initiate the build  : 
  Go to the build directory configured in the cmake-gui and enter



   to install OpenCV library and header files type
   make install

Build for Android

Download Require Android Pre-Requisites like Android SDK and Android NDK
and note down the paths for the same

*  Export the following shell variables

export ANDROID_NDK=/opt/android-sdk-r8d

* If you are using 64-bit linux 
make sure to install  ia32 shared libraries - transitional package as the NDK requires 32-bit runtime and libraries

* Run cmake-gui
choose a different/new build directory for android build

When you enter configure , a window popup occurs 

* Locate the toolchain 

  file is found in  ${opencv_source_dir}/android/android.toolchain.cmake

    Select Specify tool chain file for cross compiling 

    and enter the tool chain filter located in the above step

*  Android and ARM options

    Select the android-sdk ,android-api level and ARM architecture type if required
    Else it will be compiled with default options
application binary interface (ABI) describes the low-level interface between a computer program and the  OS or another program
An embedded-application binary interface (EABI) specifies standard conventions for file formats, data types, register usage, stack frame organization, and function parameter passing of an embedded software program.


   arm-v7a (hardware floating point)
   arm-v7a-with neon (harware floating point and vectorization and SIMD operation)

i selected arm-v7a-with-neon as my Mobile device processor belongs to family that supports armv7 architecture.

This information can be observed when mobile is connected to USB and launching 

the DDMS utility or viewing the device details in eclipse plugin etc.

* Resolving Errors 

 As in the ubuntu case if errors are encountered un-check the packages not applicable or not   required   or install the required packages to resolve the error and click on generate.

* Run make

   After the cmake-gui generates the files successfully go to the build directory and type
   make  to build the files

Sunday, 3 February 2013

Image Degradation And Restoration Model

Image Degradation and Restoration Model by

Noise Models In Image Processing

Noise Models in Image processing by

Mounting Google Docs Drive on Ubuntu 12.04

google-docs-fs can enable us to mount the google docs/drive on 
local machine and use it like a stograge drive

Install The following softwares on ubuntu 12.04
Python 2.7 or later       ----interactive high-level object-oriented language
gdata-python-client-1.3.0 --- Google Data python Client
python-fuse-0.2           ----userspace virtual filesystem
mercurial  (optional)     ----- distributed version control system

Download the source from http://code.google.com/p/google-docs-fs/downloads/list 
or run the command
hg clone https://google-docs-fs.googlecode.com/hg/ google-docs-fs
to get the latest source for google-docs-fs

Go the direction where the souce code is present and run the command
su ./setup.py install
This completes the installation process.

Mount the drive :
gmount <local_direction> abc@gmail.com

At the prompt enter the gmail account password.The contents of google docs/drive is mounted to local directory
You can configure the terminal proxy if required.Refer the earlier blob to configure proxy for ubuntu 12.04
for the same.

Unmount the drive :
to unmount the drive use the command
gunmount <local_directory>

Java Installation on Ubuntu 12.04

1.Installation OpenJDK
Download and Install OpenJDK and Oracle JDK on ubuntu 12.04
sudo apt-get install openjdk-7-jre
If your system has more than one version of Java, configure which one your system
uses be entering the following command in a terminal window
sudo update-alternatives --config java
Select the option corresponding to desired java version 2.
2.Installation of oracle JDK
  • Download Oracle JDK
Go to download site http://www.oracle.com/technetwork/java/javase/downloads/jdk-7u4-downloads-1591156.html
and select jdk-7u4-linux-x64.tar.gz for download.
  • Extract and Install
tar -xvf jdk-7u2-linux-x64.tar.gz (64bit)
JDK 7 package is extracted into ./jdk1.7.0_02 directory
sudo update-alternatives --install "/usr/bin/java" "java" "/opt/softwares-linux/jdk1.7.0_04/bin/java" 1
sudo update-alternatives --install "/usr/bin/javac" "javac" "/opt/softwares-linux/jdk1.7.0_04/bin/javac" 1
sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/opt/softwares-linux/jdk1.7.0_04/bin/javaws" 1
  • Configure Default Java Configuration
sudo update-alternatives --config java
sudo update-alternatives --config javac
sudo update-alternatives --config javaws
Check the version of you new JDK 7 installation
Reference : http://roshanbook.wordpress.com/2012/02/18/installing-oracle-jdk-7-on-ubuntu/
3.NetBeans IDE installation
Go  to Netbeans IDE download page http://netbeans.org/downloads/
select the suitable installation .
This will download netbeans-7.1.2-ml-linux.sh file
Execute the script
sudo sh ./netbeans-6.5-ml-java-linux.shcript
After the installation has completed set up soft links to the library and provide suitable permission
ln -s /opt/softwares-linux/netbeans-7.1.2/bin/netbeans /usr/local/bin/netbeans

Reference : https://help.ubuntu.com/community/Netbeans

before launching change the java reference to openjdk

Configuring Proxy for Ubuntu 12.04

apt utility configuration.
Add the following lines in /etc/apt/apt.conf
Acquire::http::proxy "http://<username>:<password>@<proxy>:<port>/";
Acquire::ftp::proxy "ftp://<username>:<password>@<proxy>:<port>/"; 
Acquire::https::proxy "https://<username>:<password>@<proxy>:<port>/";
Or you can add the following line in file /etc/apt/apt.conf.d/01proxy
For terminal configuration .
This will set the proxy for utilities that are run from the terminal  
export http_proxy=http://<username>:<password>@<proxy>:<port>
export https_proxy=http://<username>:<password>@<proxy>:<port>
If these settings are included in .bashrc or .profile these settings will be applied at the time of user login.
Synaptic package manager
The synaptic package manager has option for the proxy settings to be configured in Settings ->Preferences ->Network

OpenCV 2.3.1 build for Ubuntu 12.04

download the OpenCv Source package from

Download all the pre-requisite packages

Execute the below commands

apt-get install build-essential
apt-get install cmake
apt-get install pkg-config
apt-get install libpng12-0 libpng12-dev libpng++-dev libpng3
apt-get install libpnglite-dev libpngwriter0-dev libpngwriter0c2
apt-get install zlib1g-dbg zlib1g zlib1g-dev
apt-get install libjasper-dev libjasper-runtime libjasper1
apt-get install pngtools libtiff4-dev libtiff4 libtiffxx0c2 libtiff-tools
apt-get install libjpeg8 libjpeg8-dev libjpeg8-dbg libjpeg-prog
apt-get install ffmpeg libavcodec-dev libavcodec52 libavformat52 libavformat-dev
apt-get install libgstreamer0.10-0-dbg libgstreamer0.10-0  libgstreamer0.10-dev
apt-get install libxine1-ffmpeg  libxine-dev libxine1-bin
apt-get install libunicap2 libunicap2-dev
apt-get install libdc1394-22-dev libdc1394-22 libdc1394-utils
apt-get install swig
apt-get install libv4l-0 libv4l-dev
apt-get install python-numpy
apt-get install libjpeg-progs libjpeg-dev

1.Run cmake-gui
2.Enter the source directory as OpenCV-2.3.1/build_1/2.3/opencv
3.Enter the binary build directory as OpenCV-2.3.1/build_1/2.3/opencv/build_2
4.Select the suitable options and click of configure
Select the suitable support libraries that are required.
5.Select generate to generate the make files
6.cd /media/LINUX/OpenCV-2.3.1/build_1/2.3/opencv/build_2
make -j4
7.make install

Errors encountered in OpenCv Build
1.cap_ffmpeg_impl.hpp:1128:90: error: ‘av_rescale_q’ was not declared in
this scope
2.Add #include <libavutil/mathematics.h> in the file cap_ffmpeg_impl.hpp before
#include <ffmpeg/avcodec.h>

Saturday, 2 February 2013

Control Limited Adaptive Histogram Equalization for Image Enhancement

OpenCL -Heterogeneous Parallel Programming-Image Convolution Filters(Box Filter)

Hetrogenous Parallel Programming for Image Processing - ColorSpace Conversion in OpenCL

Image Enhancement Using Fusion

Temporal Filters For Motion Segmentation

temporal filters by pi19404

Output if LOG temporal filters

Shape Classfication Using Histogram of Oriented Gradients

shape classification using Histogram of oriented gradients by pi19404

Gesture/Shape Recognition using Hidden Markov Model

Gesture Recognition using Hidden Markov Mode by pi19404

Description and Results of Different Color Balance Algorithms for Image Enhancement

A detailed descriptions and results for different color constancy algorithms by pi19404

Simple Color Balance Algorithm

A simple color balance algorithm by pi19404

Algorithm - To Check if Number is Prime or Not

Algorithms by pi19404

Single Passs Connected Component Labelling

Single Passs Connected Component Labelling by pi19404

Symmetic Nearest Neighbour Anisotropic 2D image filter

Symmetic Nearest Neighbour Anisotropic 2D image filter by pi19404

Fitting Ellipse To Set Of Points

Fitting Ellipse by pi19404

Fitting a Line To Set Of Points

Fitting Line to set of Points by pi19404