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

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

Hand Gesture Recognition -1 :background subtraction

The aim here is to segment the hand region in a video sequence.
It is assumed that the video capture  device is stationary .
The background is relatively stationary.
The hand motion is assumed to be dominant motion in the scene.
The first step in hand region segmentation is hand region segmentation.
The hand region segmentation is performed using background 
subtraction technique.This method is computationally efficient and 
robust to illumination changes and can efficiently segment hand 
region against complex backgrounds.
The CB algorithm adopts a quantization/clustering technique to model 
a background.Samples at each pixel are clustered into the set of 
codewords. The background is encoded on a pixel by pixel basis.
Let X be a training sequence for a single pixel consisting of N RGB or
 YUV or HSV vectors: X = {x1 , x2 , ..., xN }. 

The training pixels are  obtained from the video sequence 
by capturing the image for a few  seconds where there are no foreground
objects in the scene.

Let C = {c1 , c2 , ..., cL } represent the codebook for the pixel con-
sisting of L codewords.
Each pixel has a different codebook size based on its sample variation.

Each codeword c_i , {i =1 . . . L}, consists of an intensity vector 
vi  and a 6-tuple vector xi = {Imin , Imax , fi , λi , pi , qi .}
The tuple xi contains intensity (brightness) values and temporal variables
described below.

Imin and Imax are minimum and maximum brightness values
f is the frequency with which the codeword has occured.
λ is maximum interval in the training period that codeword has not 
occured.
p,q are the first and the last access times that code word has occured. 
In The training period each sample x sampled at time t is compared to
the current codebook to determine which codewords if any match.
if two codewords provide good matches then the color distortion measure
is used to resolve the ambiguity.

During the training period a run length is maintained of codeword
has not re-occurred during the training period.This indicates that codeword
was generated by foreground object or noise hence is eliminated.
The maximum run  length can be configured by the parameter λ.A large value
of λ indicates that it is a foreground event which was stationary for only
small period .

The frequency of occurrence of codeword is also recorded.A large value of 
f over a period T and small value of λ indicates that the object is a 
foreground object which was stationary during the time period T.

A small value of f may indicate noise or very fast moving objects which
will be accompanied by large value of λ.

A small value of λ and small value of f indicates a periodic event 
occurring  in the background,since the frequency of occurrence is small
by the pixel is occurring repeatedly.

consider the background pixel values or a particular pixel in 
video sequence p1,p2,p3.
the variation in brightness of pixels p1,p2,p3 will be reflected in the
variation of codewords corresponding to the pixels p1,p2,p3.
A low and high bound can be assigned to the pixel values which define
the allowable range of pixel values corresponding to the same codeword.
This range is can be called I_low and I_high and all the pixel values
lying in this range will be assigned the same codeword.
pixel intensity value of p1 is compared with the entires int the codebook.
the pixel intensities lies within the range I_low and I_high of some
entry in the codebook then the run length of non occurrence is set to zero
and the count is also incremented.
in case on ambiguity between two codewords,the color distortion measure
can be used to determine codeword that is assigned to the pixel.

We assume that the training phase has been completed and we have
a codebook associated with each pixel.

For all the codeword in the codebook we find the codeword that matching
the given pixel such that given pixel intensity lies within the bounds
I_low and I_high and the color distortion .
If we find that non of the entries in the codebook satisfy the condition
the we consider pixel to be foreground .If we find entry in the codebook
corresponding the pixel then it is considered as background pixel.

Implementation Details
The present algorithm has implementation available in OPENCV

CvBGCodeBookModel* model cvCreateBGCodeBookModel() - This method creates 
the background model.

I think mode->modMin model->modMax allows you to set the I_low and I_high.
and model->cbounds allows us to set the mminimum color distortion
for the pixel to be considered as the belonging to the codeword.

For the first 100 frames the method
cvBGCodeBookUpdate( model, yuvImage );
is called to update the background model.

one the learning has been completed
cvBGCodeBookClearStale( model, model->t/2 ); is called
model->t is total run length of pixel during the training phase
The above call removes the pixels that were not present for
more that 50% of the training period ie non stationary pixels.

One the background has been obtained

cvBGCodeBookDiff( model, yuvImage, ImaskCodeBook );
cvSegmentFGMask( ImaskCodeBookCC );

can be called to obtain the foregound image mask in ImaskCodeBook

The above code was written using OpenCv C api using QtSDK on
ubuntu 12.04 OS.

Change the path os the Opencv libraries int project .pro file 
according to you environment.

change nframesToLearnBG or -nframes 100 as argument to configure the 
number of background frames.

Disadvantages 
The model performs poorly in presense of shadows eg poorly lit large 
indoor rooms where shadows may occur in background.

Enchancements
The same model can be made adaptive by performing update and 
cleaning of the model  periodically.
This feature will be explored in the future blogs.

Example code is available in opencv /samples/c/bgfg_codebook.cpp directory
The above code is modified version of the code including largest blob 
selection and ROI selection.

The example for the above program can be found in the below link
http://sdrv.ms/Kk3pRW

References :
1. BACKGROUND MODELING AND SUBTRACTION BY CODEBOOK CONSTRUCTION
Kyungnam Kim1 , Thanarat H. Chalidabhongse2 , David Harwood1 ,
Larry Davis1 .Computer Vision Lab, University of Maryland, College Park, 
MD 20742, USA Faculty of Information Technology, 
King Mongkut’s Institute of Technology, Thailand

2. Learning OpenCV: Computer Vision with the OpenCV Library
Gary Bradski (Author), Adrian Kaehler (Author)

hidden menu for LG920 LG 920

to enter hidden menu for LG920 Enter 3845#*920# code on keypad.

my camera flash was not working .So i entered the device test menu,performed the camera test.

In the camera test the flash was working properly.After which flash was enabled in my application also

other codes are

LG codes

  • *#06# IMEI number
  • *#07# IMEI and SW number (on very old LGs)
  • *8375# Software version (on B1200)
  • *6861# Recount checksum (on B1200)
  • #+powerON then 668 Factory test (on B1200)
  • 8060#* ? works on very old LGs
  • *789# then “Send” button ? works on very old LGs
  • 9270#* ? (works on very old LGs)
  • 9278#* ? (works on very old LGs)

Secret / Service menu codes

  • 3845#*XXXX# Secret menu code for newer LGs. Write the numbers from the phone name instead of XXXX. (Ex.: P920: 3845#*920# E730: 3845#*730#)
  • 2945#*# Secret menu (informations, tests, factory reset…) It works on most of the LG phones without SIM card
  • 1809#*code# Service menu, code = phone name (For example: 1809#*500# for KP500; 1809#*360# for KS360 etc..)
  • 1809#*500# Secret menu for KP500 / KP501 / KP502
  • 1809#*900# Secret menu for KM900
  • 2945#(then hold *) Secret menu for very old LGs
  • *+powerON then 668 Service menu for LG B1200
  • *+powerON then 159 Service menu for LG B1300
  • 277634#*# or *277634#*# Service menu code for U8110 and U8120 and U900 and KU800 etc…
  • 47328545454# Service menu code for U8130 and U8138
  • 49857465454# or 492662464663# Service menu code for U8180
  • 637664#*# Service menu code for U8330
  • *6*41*12## Service menu code for U8360
  • 525252#*# Service menu code for U8380
  • 885508428679#*# Service menu code for U8550
  • hold 2 and 5 then power ON Service menu code for U880
  • 142358#*# Service menu code for U890 and U880
  • 082065#*# Service menu code for U900
  • 1945#*5101# Secret menu for older LGs
  • 2945#*5101# Secret menu for older LGs
  • 1945#*70001# Secret menu for older LGs
  • 2947#* Secret menu for very old LGs
  • 3845#*920# Secret menu for LG P920 Optimus 3D

Other codes

  • *854#46 Engineer menu
  • 4568*0#96 Engineer-menu
  • *748#96 Debug menu
  • 23#*# ?
  • 2945#*71012# ?Secret menu code?

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

OpenCv 2.3.1 build on ubuntu 12.04

Hi
download the OpenCv Source package from
http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.3.1/
OpenCV-2.3.1a.tar.bz2/download

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
Add #include <libavutil/mathematics.h> in the file cap_ffmpeg_impl.hpp before
#include <ffmpeg/avcodec.h>

Installation of Libhand -hand articulation library on ubuntu 12.04

1.Download the linhand source package for linux libhand-0.9.tar.gz 
  from http://www.libhand.org/download.html and extract it to 
  some directory libhand
2.Install the pre requisite low level libraries
  Execute the below command
  sudo apt-get install doxygen libxaw7-dev libxrandr-dev tcl tk \
  libois-dev libtbb-dev libzzip-dev libfreeimage-dev \
  libboost-thread-dev libboost-date-time-dev \
  libjpeg-dev libtiff4-dev libbz2-dev subversion 

3.Download or upgrade to cmake-2.8.6 or higher version

sudo apt-get install cmake
sudo apt-get update
sudo apt-get upgrade cmake

Or use search the package cmake in synaptic package manager and mark the 
package for installation


Or else you can download the cmake source and build
 
wget http://www.cmake.org/files/v2.8/cmake-2.8.6.tar.gz
tar xzvf cmake-2.8.6.tar.gz
cd cmake-2.8.6
make -j4
sudo make install

To build cmake 2.8.6 you require a cmake version of 2.6 or higher.
4.The libhand articulation library uses OGRE open-source graphics rendering engine

Execute the below commands configure static install  of Ogre v1.7.3
cd libhand-0.9/install_help/linux_ogre_static_installer 
./install_ogre_static.sh download
./install_ogre_static.sh build
sudo ./install_ogre_static.sh install

5. Download and Install OpenCv

6.Compiling libhand
cd libhand/libhand-0.9/hand_cpp
mkdir -p build_1
cd build_1
cmake ../
make -j4
make install

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&gt;:<password>@<proxy>:<port>
export https_proxy=http://<username&gt;:<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