Tag Archives: stage

Basic Image Feature Extraction Tools

Authors : Abhishek Kumar Annamraju, Akashdeep Singh, Devprakash Satpathy, Charanjit Nayyar

Hello Friends,

I think its been almost 6-7 months since my last post came up. Well I will make sure that this doesn’t happen now. To state my research this semester, I will post some cool stuffs on image filtering techniques, advanced bio-medical Image processing techniques, implementation of neural networks with image processing, object detection, tracking, and 3D representation techniques and a touch-up of basic mosaicing techniques. Its a long way to go……………

Today its the time to brush up some basics. The main aim of this post is to introduce the basic image feature extraction tools. Tools!!!!!! , by tools I mean the simple old school algorithms which bring out the best from images and help the process of advanced image processing.

Lets start with understanding the meaning of image feature extraction, In machine learning, pattern recognition and in image processing, feature extraction starts from an initial set of measured data and builds derived values (features) intended to be informative, non redundant, facilitating the subsequent learning and generalization steps, in some cases leading to better human interpretations. In various computer visions, feature extraction applications widely used is the process of retrieving desired images from a large collection on the basis of features that can be automatically extracted from the images themselves. Feature extraction is related to dimensionality reduction:
1)It involves building derived values from the pool of data which is called as the information.
2)It is not non redundant set of data.
3)It is related to dimensionality reduction.

Here are some basic feature extraction codes and respective results and mind my words, I will be playing with your heads,or to put it simply extracting main features of your brain…confused???

a)BRISK Features: Binary Robust invariant scalable keypoints. A comprehensive evaluation on benchmark datasets reveals BRISK’s adaptive, high quality performance as in state-of-the-art algorithms, albeit at a dramatically lower computational cost (an order of magnitude faster than SURF in cases). The key to speed lies in the application of a novel scale-space FAST-based detector in combination with the assembly of a bit-string descriptor from intensity comparisons retrieved by dedicated sampling of each keypoint neighborhood.

Here’s the research paper to BRISK :

Lets get to the code : https://drive.google.com/file/d/0B-_KU2rDr3aTT3JLdGFzM2x1ZEU/view?usp=sharing


main_image                 feature_brisk

I think now you got what I meant by extracting features off your brain!!!!!!!!!!!!!!!!!!!!

Here in the code you will find two main things, one is a constructor while other is the respective operator,

BRISK brisk(30, 3, 1.0f);
brisk(image, Mat(), keypoints, result, false );
BRISK brisk(int thresh, int octaves, float patternScale);

Application based analysis of Parameters:
1) Thresh – Greater the values, lesser are the features detected, that doesn’t mean you will keep it to 0, because in that case the features detected may be redundant.
2) Octaves: Value varies from 0 to 8, greater the values, more the image will be scaled to extract the features
3) PatternScale: Lesser the value more the features as well as redundancies.

b) Fast Features : Features from Accelerated Segment Test. The algorithm operates in two stages 2 : in the first step, a segment of the test based on the relative brightness is applied to each pixel of the processed image; the second stage refines and limit the results by the method of non-maximum suppression. As the non maximal suppression is only performed to a small
subset of image points, which passed the first segment test, the processing time remains short.
FAST.pdf : https://drive.google.com/file/d/0B-_KU2rDr3aTLV9ndlJidHRBUmM/view?usp=sharing

Lets get to the code : https://drive.google.com/file/d/0B-_KU2rDr3aTLVpwSFNjSi1RaEE/view?usp=sharing

main_image          feature_fast

In the code you will find this segment

FASTX(InputArray image, vector<KeyPoint>& keypoints, int threshold, bool nonmaxSuppression, int type);

Application based analysis of Parameters:
1) Threshold: Lesser the value more the features as well as redundancies.
2) nonmaxSuppression: Non-maximum supression is often used along with edge detection algorithms. The image is scanned along the image gradient direction, and if pixels are not part of the local maxima they are set to zero. This has the effect of suppressing all image information that is not part of local maxima. when true, the algorithm is applied.
3) Type: FastFeatureDetector::TYPE_a_b : For every feature point with respect to “a” neighbour pixels, store the “b” pixels around it as a vector.

c)Harris Corner Detector: Harris corner detector is based on the local autocorrelation function of a signal which measures the local changes of the signal with patches shifted by a small amount in different directions.
Harris Corner.pdf : https://drive.google.com/file/d/0B-_KU2rDr3aTYjhOeVpCeWtWQ0k/view?usp=sharing

Code: https://drive.google.com/file/d/0B-_KU2rDr3aTelFLVkZ3dzk4UDg/view?usp=sharing

Results :

main_image          feature_harris_corner

cornerHarris( image_gray, dst, blockSize, apertureSize, k, BORDER_DEFAULT );

Application based analysis of Parameters:
1) blockSize: More the size, more is the blurring and lesser are the detected corners
apertureSize: Its the kernel size, greater the value, greater is filtering of detected corners
2) k: greater the value, greater the edges are preserved and lesser are the corners detected

d) ORB Features : Oriented BRIEF Features. RB (Oriented FAST and Rotated BRIEF) is a fast robust local feature detector, first presented by Ethan Rublee et al. in 2011, that can be used in computer vision tasks like object recognition or 3D reconstruction. It is based on the visual descriptor BRIEF (Binary Robust Independent Elementary Features) and the FAST keypoint detector. Its aim is to provide a fast and efficient alternative to SIFT.
ORB.pdf : https://drive.google.com/file/d/0B-_KU2rDr3aTeC1UUkNBNlhoRFU/view?usp=sharing

Code : https://drive.google.com/file/d/0B-_KU2rDr3aTbWVhZEtpY1dqeWc/view?usp=sharing

Results :

main_image     feature_orb

Here again, in the code you will find two main things, one is a constructor while other is the respective operator,

ORB orb(500, 1.2f, 8, 31, 0, 2, ORB::HARRIS_SCORE, 31);
	orb(image, Mat(), keypoints, result, false );
ORB(int nfeatures, float scaleFactor, int nlevels, int edgeThreshold, int firstLevel, int WTA_K, int scoreType=ORB::HARRIS_SCORE, int patchSize);

Application based analysis of Parameters:
1) nfeatures: Indicates maximum number of features to be detected
scaleFactor: Pyramid decimation ratio, greater than 1. scaleFactor==2 means the classical pyramid, where each next level has 4x less pixels than the previous, but such a big scale factor will degrade feature matching scores dramatically. On the other hand, too close to 1 scale factor will mean that to cover certain scale range you will need more pyramid levels and so the speed will suffer (as per OPENCV WEBSITE).
2) nlevels: The number of pyramid levels. The smallest level will have linear size equal to input_image_linear_size/pow(scaleFactor, nlevels)
3) edgeThreshold: greater the value, lesser are the feature points
4) WTA_K : The number of points that produce each element of the oriented BRIEF descriptor. The default value 2 means the BRIEF where we take a random point pair and compare their brightnesses, so we get 0/1 response. Other possible values are 3 and 4. For example, 3 means that we take 3 random points (of course, those point coordinates are random, but they are generated from the pre-defined seed, so each element of BRIEF descriptor is computed deterministically from the pixel rectangle), find point of maximum brightness and output index of the winner (0, 1 or 2). Such output will occupy 2 bits, and therefore it will need a special variant of Hamming distance, denoted as NORM_HAMMING2 (2 bits per bin). When WTA_K=4, we take 4 random points to compute each bin (that will also occupy 2 bits with possible values 0, 1, 2 or 3) (as per OPENCV WEBSITE).

e) Shi Tomasi Corner Detector : We have come up with this earlier, https://abhishek4273.com/2014/07/20/motion-tracking-using-opencv/

f) SIFT Features: Scale Invarient Feature Transform. SIFT keypoints of objects are first extracted from a set of reference images[1] and stored in a database. An object is recognized in a new image by individually comparing each feature from the new image to this database and finding candidate matching features based on Euclidean distance of their feature vectors. From the full set of matches, subsets of keypoints that agree on the object and its location, scale, and orientation in the new image are identified to filter out good matches. The determination of consistent clusters is performed rapidly by using an efficient hash table implementation of the generalized Hough transform. Each cluster of 3 or more features that agree on an object and its pose is then subject to further detailed model verification and subsequently outliers are discarded. Finally the probability that a particular set of features indicates the presence of an object is computed, given the accuracy of fit and number of probable false matches. Object matches that pass all these tests can be identified as correct with high confidence.

sift1.pdf : https://drive.google.com/file/d/0B-_KU2rDr3aTTWk3M2xJVnU4SkE/view?usp=sharing
sift2.pdf : https://drive.google.com/file/d/0B-_KU2rDr3aTbDlZQkcycXNzdmc/view?usp=sharing

code: https://drive.google.com/file/d/0B-_KU2rDr3aTWThQdTJiWktDaUk/view?usp=sharing

Results :

main_image        feature_sift

g) SURF Features : Speeded Up Robust Features. SURF is a detector and a high-performance descriptor points of interest in an image where the image is transformed into coordinates, using a technique called multi-resolution. Is to make a copy of the original image with Pyramidal Gaussian or Laplacian Pyramid shape and obtain image with the same size but with reduced bandwidth. Thus a special blurring effect on the original image, called Scale-Space is achieved. This technique ensures that the points of interest are scale invariant. The SURF algorithm is based on the SIFT predecessor.
surf.pdf: https://drive.google.com/file/d/0B-_KU2rDr3aTMDhvanl0TlhLVEU/view?usp=sharing

code : https://drive.google.com/file/d/0B-_KU2rDr3aTNWVDNU10aGJjQTA/view?usp=sharing

Results :

main_image       feature_surf

So this is it from my side with respect to basic feature detection. Keep looking forward for my posts.

Thank you guys!!!!
Adios Amigos!!!!!!!




Hi Friends

Lets get into installing player project in the ubuntu system in a very easy process of 10 steps.

Note:Please make sure the system has no version of opencv installed,if present make sure to remove it completely from the system libraries.You can install it after this process is complete.Also for  Ubuntu 12.10,13.04 or 13.10 the process remains same,but the library names/versions of dependencies we are going to install may differ.

Let’s get started:-

Step 1:-

Create a directory named src in /home directory

In the terminal,type the following

a)mkdir src
b)cd src

Step 2:-

Download player and stage tar files and store in src

Step 3:-

Install pre-requisites/dependencies

in the terminal,type the following

a)sudo apt-get update
b)sudo apt-get upgrade
c)sudo apt-get install autotools-dev
d)sudo apt-get install build-essential
e)sudo apt-get install cmake
f)sudo apt-get install cpp
g)sudo apt-get install libboost-signals1.46.1
h)sudo apt-get install libboost-signals1.46-dev
i)sudo apt-get install libboost-thread1.46.1
j)sudo apt-get install libboost-thread1.46-dev
k)sudo apt-get install libcv2.3
l)sudo apt-get install libcv-dev
m)sudo apt-get install libgdk-pixbuf2.0-0
n)sudo apt-get install libgdk-pixbuf2.0-dev
o)sudo apt-get install libgnomecanvas2-0
p)sudo apt-get install libgnomecanvas2-dev
q)sudo apt-get install libgsl0-dev
r)sudo apt-get install libgtk2.0-dev
s)sudo apt-get install libjpeg62-dev
t)sudo apt-get install libtool
u)sudo apt-get install libxmu-dev swig
v)sudo apt-get install python2.7-dev
w)sudo apt-get install libcv-dev
x)sudo apt-get install libcvaux-dev
y)sudo apt-get install libhighgui-dev
z)sudo apt-get install freeglut3

a)sudo apt-get install freeglut3-dev
b)sudo apt-get install libfltk1.1
c)sudo apt-get install libfltk1.1-dev
d)sudo apt-get install libltdl7
e)sudo apt-get install libltdl-dev
f)sudo apt-get install libpng12-dev
g)sudo apt-get install libpng12-0

a)sudo apt-get update
b)sudo apt-get upgrade

Step 4:-

Install player-

In the terminal,type the following

a)tar xzvf player-3.0.2.tar.gz
b)cd player-3.0.2
c)mkdir build
d)cd build
e)cmake ../
f)sudo make


NOTE:-Error bugs for make(if errors dont appear in ‘make’,please skip this part)

–error bugs while installation(if no errors skip this part)
1)cmake stopped with errors in timer.cpp
:- add #include <unistd.h> in timer.cpp

2)artoolkitplus error
:- install artoolkitplus
–$ cd Downloads
$ wget https://launchpad.net/artoolkitplus/trunk/2.3.0/+download/ARToolKitPlus-2.3.0.tar.bz2
$ tar xvjf ARToolKitPlus-2.3.0.tar.bz2
$ cd ARToolKitPlus-2.3.0
$ mkdir build
$ cd build
$ cmake ..
$ make
$ sudo make install

3)cmake stopped with readlog.cc error
:-make changes in readlog.cc
change line 668  –>  ret = gzseek(this->file,0,SEEK_SET);
TO –>                ret = gzseek((gzFile)this->file,0,SEEK_SET);
change line 714  –>  ret = (gzgets(this->file, this->line, this->line_size) == NULL);
TO –>                ret = (gzgets((gzFile)this->file, this->line, this->line_size) == NULL);

4)assembler message error
:- do “sudo make” instead of “make”

5)link cxx error-(cannot find opencv and other bullshits)(STILL A PROBLEM)

a)changes in .bashrc file of build
$gksudo gedit ./bashrc
add the following to it
$ export PATH=~/usr/local/bin:$PATH
$ export CPATH=~/usr/local/include:$CPATH

b)change the CMAKE_CXX_FLAGS variable in /player-3.0.2/build/CMakeCache.txt.
Change the line
CMAKE_CXX_FLAGS:STRING=   -lboost_system
c)install all libdc files
d)install libpq-dev libpqxx-dev

****************************END OF ERROR BUGS*******************

g)sudo make

h)sudo make install

i)sudo updatedb

Step 5:-

Open a new terminal and type

a)gksudo gedit ./bashrc

When the file opens,add the following to the end of it

export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
export PATH=$PATH:"/usr/local/lib64"
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"/usr/local/lib":"/usr/local/lib64"
export PLAYERPATH="/usr/local/lib":"/usr/local/lib64"
export STAGEPATH="/usr/local/lib":"/usr/local/lib64"

Step 6:-

Checking installation

in the treminal : $ pkg-config –libs playercore
(output: -L/usr/local/lib64 -lplayercore -lpthread -lltdl -ldl -lplayerinterface -lplayercommon)
In the terminal : $ pkg-config –cflags playercore
(output: -I/usr/local/include/player-3.0)

Step 7:-

Install Stage

In the terminal,type the following

a)sudo apt-get update
b)sudo apt-get upgrade
c)tar xzvf Stage-3.2.2-Source.tar.gz
d)cd Stage-3.2.2-Source/
e)mkdir build
f)cd build/
g)cmake ../
h)sudo make


NOTE:-Error bugs for make(if errors dont appear in ‘make’,please skip this part)

–error bugs while installation(if no errors skip this part)

–error with undefined reference to various libs and functions

In the same terminal,type
a)cd ..
c)sudo gedit CMakeLists.txt

Note:-This CMakeListestxt file will be in the folder player-3.0.2,make sure to do the changes in the correct one if you open a new terminal
change the three lines:

SET (CMAKE_CXX_FLAGS_PROFILE " -O3 -ggdb -pg ${WALL} " CACHE INTERNAL "C Flags for profile" FORCE)


SET (CMAKE_CXX_FLAGS_RELEASE " -O3 -DNDEBUG -Wl,--no-as-needed" CACHE INTERNAL "C Flags for release" FORCE)
SET (CMAKE_CXX_FLAGS_DEBUG " -ggdb -Wl,--no-as-needed " CACHE INTERNAL "C Flags for debug" FORCE)
SET (CMAKE_CXX_FLAGS_PROFILE " -O3 -ggdb -pg -Wl,--no-as-needed " CACHE INTERNAL "C Flags for profile" FORCE)

(save and close the file)

********************* END OF ERROR BUGS*******************************

i)cd build

j)sudo make

k)sudo make install

Step 8:-

Testing installation
open a new terminal
a)cd src/Stage-3.2.2-Source/worlds
b)player simple.cfg



player: error while loading shared libraries: libplayerdrivers.so.3.0: cannot open shared object file: No such file or directory.

open a terminal and write:-

export LD_LIBRARY_PATH+=/usr/local/lib64:/usr/local/lib

Step 9:-

Installing gazebo(1.9.1)
open a new terminal

a)sudo sh -c ‘echo “deb http://packages.osrfoundation.org/gazebo/ubuntu precise main” > /etc/apt/sources.list.d/gazebo-latest.list’
b)wget http://packages.osrfoundation.org/gazebo.key -O – | sudo apt-key add –
c)sudo apt-get update
d)sudo apt-get install gazebo

Step 10 :-

Testing gazebo
open a new terminal

(for the first run it takes time to open the gui,keep patience)

NOTE:-to add models manually to gazebo

open a terminal and type

a)cd ~/.gazebo/models

b)wget -R *index.html*,*.tar.gz –cut-dirs=1 –no-parent -r -x -nH http://gazebosim.org/models/HERE YOU ENTER THE MODEL NAME/

You have now succeeded in installing player/stage/gazebo.

For any further queries please let me know in the blog or mail me at “abhishek4273@gmail.com”.


Thank you 🙂

See also :- http://blindperception.wordpress.com/