369 views

Uploaded by pi194043

description and implementation of mean shift tracking algorithm

save

You are on page 1of 8

Pi19404

September 25, 2013

Contents

Contents

Mean Shift Tracking

0.1 Introduction . . . . . . . . . . . . . 0.2 Mean shift . . . . . . . . . . . . . . 0.3 Using Similarity for tracking 0.3.1 Implementation . . . . . . 0.4 Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

3

3 3 4 5 7

2|8

0.1 Introduction

In the article we will look at the application of Mean Shift Tracking for color based tracking.

The object model used in mean shift tracking is color probability distribution. Now we have a object model,given an image we can compute the likelihood image Each pixel in likelihood image represents the likelihood that pixel belongs to the object model/histogram.

Lu (yi ) = pu

(b(y ) u)

i

object model. It is reasonable to assume that the region in which the highest similarity measure or highest density is observed is a good estimate of object location.

3|8

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

//building the object appearance model void ocvmeanShift::buildModel(Mat image,Rect rect) { //input region of interest region=rect; //center of region is current location estimate p.x=region.x+region.width/2; p.y=region.y+region.height/2; //extract ROI Mat roi=image(rect); //compute the histogram ,h is object of type Histogram h.BuildHistogram(roi); } //call to compute the likelihood after computing the model Mat sim=h.likeyhoodImage(image);

Thus if we consider a small window and move towards the mean value ie along the mean shift vector we should eventually reach the region of maximum similarity. The likelihood surface is not smooth,we can give it properties of smoothness using kernel density estimation. Now we can find the modes of the similarity surface using standard mean shift algorithm. Let us assume that current estimate of mode of function is at y . Thus we consider a small rectangular window about y ,compute the mean shift vector and take a small step along the mean shift vector. In principle this should enable to find the local maximum. Similarity surface is discontinuous and to do this we need to perform KDE over entire image consisting of dense grid of points ,which is a expensive operation.(We need to perform convolution at each point with Gaussian with suitably large aperture)

The concept of similarity surface can be made useful in tracking application.

4|8

Let us consider a small region of interest about a present location y, we can compute the similarity score about this region,perform KDE on this small region,obtain a similarity surface and compute the mean shift vector. If object is not present in region,similarity surface will be flat and mean shift vector will be zero. If there is object present in some part of region,it will correspond to modes of similarity surface .The mean shift vector will give us direction to move along. Now instead of trying to estimate the mode,say we translate the region of interest along direction provided by the mean shift vector. This would typically lead to large portion of object being visible and would expose the region of global similarity surface where a large maximum would lie. This is the basis of mean shift tracking,keen on translating the region of interest ,till we reach local maximum of similarity surface. For tracking applications ,since fast computation is required, we can consider a rectangular window with bandwidth equal to that of the region of interest.The present location of point point is the center of the rectangular region.

0.3.1 Implementation

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

//compute the likelihood Mat sim=h.likeyhoodImage(image); //perform iteratively till convergence for(int i=0;i<criteria.maxCount;i++) { //extracting the region of interest Mat roi=sim(region); //compute the moments cv::Moments m; m=cv::moments(roi,false); //threshold m00 which is weighted mean, //exit since no similar pixels present if(fabs(m.m00)<region.width*region.height*0.05) break;

5|8

16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54

//computing the mean values int x=cvRound(m.m10/m.m00); int y=cvRound(m.m01/m.m00); //computing the mean shift int dx=region.width/2-x; int dy=region.height/2-y; //displacement from current position int nx=p.x-dx; int ny=p.y-dy; //bounday of the image if(nx-region.width/2<=0) nx=region.width/2; if(nx+region.width/2>=image.cols) nx=image.cols-region.width/2-1; if(ny-region.height/2<=0) ny=region.height/2; if(ny+region.height/2>=image.rows) ny=image.rows-region.height/2-1; //recalculating the mean shift dx=-nx+p.x; dy=-ny+p.y; //checking magnitude of mean shift vector. float mag=dx*dx+dy*dy; //no change in mean,reached local maxima if(mag<criteria.epsilon*criteria.epsilon) break; //updating the position p.x=nx; p.y=ny; //updating the region of interest region.x=p.x-region.width/2; region.y=p.y-region.height/2; }

A video of mean shift tracking is shown below.A naive object model based on color probability in HS color space using first frame of the video https://googledrive.com/host/0B-pfqaQBbAAtNkg2bUJvWERmNFU/ video00001.ogv

6|8

Another issue is that if the object is moving too fast and significant part of the object moves out of ROI in successive frames,the object will not be tracked. This can be seen in the following videos https: //googledrive.com/host/0B-pfqaQBbAAtNkg2bUJvWERmNFU/video00002.ogv If we encounter a larger object or object that exhibits higher density ,tracking will be lost.In the below case the tracking is lost when object passes over a large blue background which is similar to object color. https://googledrive.com/host/0B-pfqaQBbAAtNkg2bUJvWERmNFU/video00003. ogv There are many other cases where mean shift tracking will fail As will all tracking approaches ,the performance heavily depends on the object model. The better we are able to model the object and obtain a likelyhood/similarity which does not show high probability for background or other objects in the scene,the more accurate will be the tracking

0.4 Code

For further image processing application a library consisting of high level interface to opencv will be used.The library is called OpenVisionLibrary. https://github.com/pi19404/OpenVision The project cmake file is included in the repository. the build will create the library and test files in the bin directory To run demo program for mean shift run the binary meanShiftTest The files for mean shift algorithm are meanshift.cpp and meanshift.hpp https://github.com/pi19404/OpenVision/tree/master/ImgProc/ repository. To run the test program :

1 2

meanShift - to run using camera input meanShiftTest {video file name} - to run using a video file

Select the region of interest and click the build model button to start tracking. For video file initially only the first frame is show ,select the ROI in the first frame and then click on build model button to start the

7|8

Mean Shift Tracking tracking. The button is shown upon clicking on Display properties button on the window.

8|8

- OR ASSIGN-1Uploaded bymilanmotta
- 1Uploaded byManpreet Singh
- 2) Pengendalian Aktivitas ProduksiUploaded byBilqiis Falkhatun Risma
- automatic white balance algorithm 1Uploaded bypi194043
- Pantofaru Caroline 2005 neural network and deep learningUploaded byjukon
- A simple color balance algorithmUploaded bypi194043
- ICAST-2015 - Basuki Rahmat.pdfUploaded bypuslit
- Mean Shift AlgorithmUploaded bypi194043
- Weitzman Theorem ProofUploaded bySaurav Dutt
- fulltext_2Uploaded bychiru1431
- Improving Data Mining Algorithms Using ConstraintsUploaded byko moe
- dsadsadsadsadsaUploaded byDidit Sepiyanto
- Image Processing 2013-2014Uploaded by6ssystems
- 1568-4481-1-SPUploaded bySuman Lokonda
- log1Uploaded byRian El-zar
- Tool Path Generation for Free Form SurfacesUploaded byKush Dewangan

- Markov chain implementation in C++ using EigenUploaded bypi194043
- Implementation of discrete hidden markov model for sequence classification in C++ using EigenUploaded bypi194043
- Fast 2D Separable Symmetric/Anti-Symmmetric ConvolutionUploaded bypi194043
- Continuous Emission Hidden Markov Model for sequence classificationUploaded bypi194043
- Dense optical flow expansion based on polynomial basis approximationUploaded bypi194043
- Adaptive Skin Color DetectorUploaded bypi194043
- ARM Neon Optimization for image interleaving and deinterleavingUploaded bypi194043
- A linear channel filterUploaded bypi194043
- OpenVision Library Gaussian Mixture Model ImplementationUploaded bypi194043
- Multi Class Logistic Regression Training and TestingUploaded bypi194043
- Compiling Native C/C++ library for AndroidUploaded bypi194043
- Gaussian Multivariate Distribution -Part 1Uploaded bypi194043
- Polynomial Approximation of 2D image patch -Part 2Uploaded bypi194043
- Modified Canny Edge DetectionUploaded bypi194043
- Tan and Triggs Illumination normalizationUploaded bypi194043
- Normalized convolution for image interpolationUploaded bypi194043
- Uniform Local Binary Pattern and Spatial Histogram ComputationUploaded bypi194043
- C++ static members and functionUploaded bypi194043
- C++ virtual functions and abstract classUploaded bypi194043
- Embedded Systems Programming with ARM on Linux - Blinking LEDUploaded bypi194043
- Random Ferns for Patch DescriptionUploaded bypi194043
- Integral Image for Computation of Mean And VarianceUploaded bypi194043
- polynomial approximation of a 2D signalUploaded bypi194043
- C++ Const,Volatile Type QualifiersUploaded bypi194043
- Polynomial Approximation of 1D signalUploaded bypi194043
- C++ InheritanceUploaded bypi194043
- Mean Shift AlgorithmUploaded bypi194043
- Local Binary PatternUploaded bypi194043

- The Amazing Mean Shift AlgorithmUploaded byEngr Ebi
- A REVIEW ON OBJECT DETECTION AND TRACKING SYSTEM IN REAL WORLD BY USING CAMERA ROTATION-http://iaetsdjaras.org/Uploaded byiaetsdiaetsd
- Non-Linear Moving Target Tracking: A Particle Filter ApproachUploaded byInternational Journal of Computer and Communication System Engineering
- TermProj FRUploaded byDr-Mahmoud Al-Ewiwi
- IRJET-PicWords: Creating Pictures by its keywordsUploaded byIRJET Journal
- Digital Image Processing Lecture SegmentationUploaded byParth Chona
- graph cut.pdfUploaded byTechnos_Inc
- Bhattachrya CoefficientsUploaded byParthesh Mankodi
- FPGA-based Real-time Object Tracking for Mobile RobotUploaded bylengocanh1991
- The Evaluation Criterion for Color Image Segmentation AlgorithmsUploaded byJorge Leandro
- Introduction to Mean ShiftUploaded bytiendat_20791
- exam_chegg_monday.pdfUploaded byCharan Kilari
- Mean ShiftUploaded byTuyến Đinh
- MironeManUploaded byEdu Massana
- The reviewe of the Camshift algorithm and its improved algorithm of target tracking researchUploaded byInternational Journal of Research in Engineering and Science
- 3D Display Simulation Using Head Tracking With Microsoft Kinect (Printing)Uploaded byManfredas Zabarauskas
- object detect and track pptUploaded byPraveen Pallav
- Moving Object Detection and Tracking in VideosUploaded byCuong Tran
- Deep Learning Approach Model for Vehicle Classification using Artificial Neural NetworkUploaded byIRJET Journal
- k-Nearest Neighbors Search in High DimensionsUploaded by.xml
- Deepika Anand Assign2Uploaded byDeepika Anand
- Single Object Tracking System By Using LabviewUploaded byEditor IJRITCC
- Wound Analysis MethodUploaded byJeyam Siva
- Pam i Mean ShiftUploaded byCuong01011
- Principal Curves and SurfacesUploaded byjmcq89
- SafetyUploaded byutkarsh
- Mean Shift ClusterUploaded bySoumyajit Jagdev
- ICAST-2015 - Basuki Rahmat.pdfUploaded bypuslit
- Meanshif DelphiUploaded byAde Rohmat Eded
- Segmentation TutorialUploaded byAna Maria