Вы находитесь на странице: 1из 6

Shape Classication using Histogram of Oriented Gradients

Pi19404
January 12, 2013

Contents

Contents
Shape Classication using Histogram of Oriented Gradients
0.1 0.2 0.3 0.4 0.5 Introduction . . . . . . . . . . . . . . . . . Pre-Processing . . . . . . . . . . . . . . . . Feature Extraction . . . . . . . . . . . . . . 0.3.1 Histogram of Oriented Gradients Classication Task . . . . . . . . . . . . . Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

2
2 2 3 3 4 6

Shape Classication using Histogram of Oriented Gradients


0.1 Introduction
To classify global shape we look at shape classication techniques for approaches similar to hand digit classication techniques. We know the co-ordinates of the pixels that form the shape . We look at Histogram of oriented gradients approach and HuMoments approach for global gesture shape classication.The sequence of the path taken to perform the gestures are not modeled only the nal shape of gesture is modeled.

0.2 Pre-Processing
We can take two approaches a visual approach or a geometric approach. In geometric approach we make use of the co-ordinates and construct a model for the shape. Then Given a unknown set of pixels we can determine if it ts the model or not. In visual approach we construct a image from the captured-coordinates and use visual

2|6

Shape Classication using Histogram of Oriented Gradients


techniques for shape classication. The vision based approach provides good generalization while model based approach would provide good accuracy and compact representation. The processing step includes scaling,translation and re-sampling. The pixel co-ordinates are scaled for xed size,translated to origin,this is mainly to align all the shapes wrt each other. The size to be scaled down is chosen as 160x120.The centroid is translated to (80,60). This can be reduced further based on processing restrictions etc.But for demonstration this size was chose. Now the image is constructed from the pre-processed set of points A Training set is constructed for following two gesture.

0.3 Feature Extraction


Different Features can be used to represent the shape.Here we will use Histogram of oriented gradients for shape classication.
0.3.1 Histogram of Oriented Gradients

As the name suggests it a histogram of gradients in different orientation directions. The Hog descriptor has become one of the most popular low-level image representations in computer vision. Local shape information often well described by the distribution of intensity gradients or edge directions even without precise information about the location of the edges themselves.Shape information is encoded by HOG and spatial information is encoded by sliding windows The derivative of images is computed along x and y directions.Applying Cartesian to polar transformation we obtain magnitude and orientation of the gradient at every point of the image. We consider the orientations along 9 orientation directions,a orientation resolution of 200 . We compute the histogram of oriented gradients that lie along these predened orientations. This will give a feature vector of length 9. The image is subdivided into block and HOG is computed over the each block To encapsulate correlation amongst neighborhood block simple techniques of sliding windows is used. To speed up the computation integral images are used to compute sum of pixels ie histogram bin count quickly over the windows. The most basic features are raw pixel feature .If we used raw pixels directly we would

3|6

Shape Classication using Histogram of Oriented Gradients


get a very long feature vector.Using HOG feature representation we get a relatively small feature representation. Below is a example of HOG feature vector computed for 9 images and relatively small training set of 20 samples per class are used for training.The training time required is also very small can be performed in real time. Following are the parameters : 1. Image Size : 160x120 2. Num of Orientations : 12 3. Number of Blocks : 3x3=9 4. Feature descriptor : 12x9=108

Figure 1: Normalized gesture plots

The descriptors can be computed for set of training images,the image as well class label is written to the csv le.

0.4 Classication Task


Given feature set corresponding to unknown gesture we are required to classify it to one of the known classes. We will use SVM as a classication tool.LibSVM software

4|6

Shape Classication using Histogram of Oriented Gradients


package is used to train the classier and test accuracy for a small gesture set.We will use the java classes provided by LibSVM software package. The le earlier generate is in format suitable for LibSVM package. The le contains the feature label number followed by the feature value. The First task is to perform feature scaling so that all the feature lie in a predened range This is required to ensure than feature value along one dimension does not bias the classier. Along each dimension the features are scaled to lie in a xed range .The default value of provided by the LibSVM tool is (-1,1).

1. train.le - input training data lename 2. test.le - input test data lename 3. t1.range - le containing feature scaling parameters 4. t1.scale - output data le name after performing feature scaling on training data le 5. t2.scake - output data le name after performing feature scaling on test data le 6. t1.model - SVM classier model le command to perform feature scaling is Java svm_scale -s t1.range train.le > t1.scale command to train the classier java svm_train t1.scale t1.model Command for feature scaling the test data java svm_scale -r t1.range test.le > t2.scale command to perform prediction on test data Java svm_predict t2.scale t1.model test.out we obtain perfect classication on this small data set. In the future the method can be tested on larger number of classes with more complex gesture and large test data set.

5|6

Bibliography

Bibliography
[1] N. Dalal and B. Triggs, Histograms of oriented gradients for human detection, in In CVPR, pp. 886893, 2005. [2] O. Ludwig, Hog descriptor for matlab, September 2010. 6 [3] O. Ludwig, D. Delgado, V. Goncalves, and U. Nunes, Trainable classier-fusion schemes: An application to pedestrian detection, in Intelligent Transportation Systems, 2009. ITSC 09. 12th International IEEE Conference on, pp. 1 6, oct. 2009. [4] C.-C. Chang and C.-J. Lin, LIBSVM: A library for support vector machines, ACM Transactions on Intelligent Systems and Technology, vol. 2, pp. 27:127:27, 2011. Software available at http://www.csie.ntu.edu.tw/~cjlin/libsvm.

0.5 Code
The code for Histogram of oriented gradients was adapted for opencv images from following link [2] . The training les and test les are placed in directories labelled 1-10 correpondingly. The appliation takes as input name of the training/test base directory and outputs a le containing the feature descriptor in libsvm format. The training and testing is performed using libsvm tools. C/C++ based inplementation of HOG is embedded in PDF .In the java based implmentation itegral images were used to provide performance improvements. The code can be found at http://code.google.com/p/m19404/source/browse/HOG/

6|6

Вам также может понравиться