All Projects → inayatkh → tracking-python3

inayatkh / tracking-python3

Licence: other
In this repository I will give some implementation of single and multiple object tracking algorithms. These include meanShift, CamShift, Boosting, MIL, KCF, TLD , GoTurn, and MedianFlow. Additionally I will show you how to grab frames at a very high FPS from camera and videos.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to tracking-python3

Face-Detection-and-Tracking
Face Detection and tracking using CamShift, Kalman Filter, Optical Flow
Stars: ✭ 30 (-69.39%)
Mutual labels:  tracking, camshift, meanshift
IMU-VR-Full-Body-Tracker
Inertial Measurement Unit (IMU) based full body tracker for Steam VR.
Stars: ✭ 46 (-53.06%)
Mutual labels:  tracker, tracking
OpenTLD KCF
OpenTLD with KCF tracker
Stars: ✭ 20 (-79.59%)
Mutual labels:  tracking, kcf
Delivery Tracker
🚚 Delivery and Shipping Tracking Service
Stars: ✭ 350 (+257.14%)
Mutual labels:  tracker, tracking
about-time
A cool helper for tracking time and throughput of code blocks, with beautiful human friendly renditions.
Stars: ✭ 36 (-63.27%)
Mutual labels:  tracker, tracking
KCF-Tracking
KCFcpp的Visual Studio2015版本
Stars: ✭ 45 (-54.08%)
Mutual labels:  tracking, kcf
Aitrack
6DoF Head tracking software
Stars: ✭ 262 (+167.35%)
Mutual labels:  tracker, tracking
React Tracker
React specific tracking library, Track user interaction with minimal API!
Stars: ✭ 191 (+94.9%)
Mutual labels:  tracker, tracking
Tf Adnet Tracking
Deep Object Tracking Implementation in Tensorflow for 'Action-Decision Networks for Visual Tracking with Deep Reinforcement Learning(CVPR 2017)'
Stars: ✭ 162 (+65.31%)
Mutual labels:  tracker, tracking
Block
Let's make an annoyance free, better open internet, altogether!
Stars: ✭ 1,849 (+1786.73%)
Mutual labels:  tracker, tracking
cpp-iout
C++ Implementation of IOU Tracker presented in AVSS17
Stars: ✭ 33 (-66.33%)
Mutual labels:  tracking, tracking-algorithm
mailbox
📨 簡易電子報發送系統,使用 #Golang 實作,send campaign mail with open, click tracker.
Stars: ✭ 26 (-73.47%)
Mutual labels:  tracker, tracking
Blacklist
Curated and well-maintained hostfile to block ads, tracking, cryptomining, and more! Updated regularly. ⚡🔒
Stars: ✭ 492 (+402.04%)
Mutual labels:  tracker, tracking
Keen Tracking.js
A light, fast and flexible javascript tracking library
Stars: ✭ 218 (+122.45%)
Mutual labels:  tracker, tracking
corona tracker
COVID-19 tracking app - submission for https://wirvsvirushackathon.org/
Stars: ✭ 13 (-86.73%)
Mutual labels:  tracker, tracking
vue-plausible
Plausible Analytics Vue.js Plugin and NuxtJS Module
Stars: ✭ 107 (+9.18%)
Mutual labels:  tracking
SiamFusion
No description or website provided.
Stars: ✭ 26 (-73.47%)
Mutual labels:  tracker
matomo-tracker
Stand alone library for using matamo tracking in frontend projects
Stars: ✭ 138 (+40.82%)
Mutual labels:  tracking
pytorch-mot-tracking
Demo the Kalman Filter on pedestrian tracking with YOLOv3.
Stars: ✭ 76 (-22.45%)
Mutual labels:  tracking
VIAN
No description or website provided.
Stars: ✭ 18 (-81.63%)
Mutual labels:  tracking

Tracking Using OpenCV >= 3.2 and Python-3.5

In this repository I will give some implementation of single and multiple object tracking algorithms. These include meanShift, CamShift, Boosting, MIL, KCF, TLD , GoTurn, and MedianFlow. Additionally I will show you how to grab frames at a very high FPS from camera and videos.

Directory Structure:

. ├── tracking-py3

└──
   |
   
   ├──  trackers
   	   
   | 
   	   
   ├── utils
   
   | 
   	   
   ├── videos

Tracking Algos and some Usefull utils


fastframerate.py

Following [1], here I include python code to show how to grab frames from video at a very hight frame per second (FPS)

usage:

$ python fastframerate.py  -v ./videos /boy-walking.mp4


hogdetectory.py

This example shows how to use hog detector for person detection at every frame.

usage:

$ python hogdetectory.py -v ./videos /boy-walking.mp4


Kalman Filtering

Kalman Filtering is a popular signal processing algo. It used to predict the location of a moving object based on prior motion info.

kalmanhogtrack.py

This example, which is a single person tracker, shows the use of Kalman Filter for tracking along with Hog detection for correction

usage:

$ python kalmanhogtracker.py -v ./videos /boy-walking.mp4


Meanshift and CAMshift

The MeanShift algorithm looks to object tracking as mode-seeking problem. Mean-shift was first presented by Fukunaga et al in 1975. It is a non-parametric approach for finding the maxima of a density function. The process is an iterative approach that involves calculating and shifting the mean of a set of data points, which fall in a circle, in the direction of the mean shift vector and thus it is called Meanshift. The radius of the circle is also called window size.

The value of the radius does matter. Very small value will generate local maxima while veray large value of the radius will let the algo to find true maxima. If there are more than one mode then they will be merged. To handle this problem radius of the circle needs to be changed adaptively. This is done by CAMshift algorithm ( Continuously Adaptive Meanshift)

For the widow located at \(x\), the center of the mass \(m(x)\)of the neighboring points \(x_i\) is calculated as

$$m(x) = \frac{\sum_i{K(x - x_i)}x_i}{\sum_i{K(x - x_i)}}$$ where \( K\) is the kernel used to decide the widow size and how the weights of different points will be accumulated

Tracking using MeanShift in OpenCV

We will use the following steps for live tracking of face using web cam:

  1. Detect the face, which we want to track, using dlib face detector. Compute the histogram of the face region using Hue Channel of the HSV color space. However, both H and S can be used. Its worthy to note that color information is very sensitive to lighting variations.

    use calcHist() function of OpenCV for computing the histogram and normalize the values in the range [0,255]

  2. Find the back projected image for every new frame using calcBackPorject() function

  3. Use meanShift() function to find the maxima in the backprojected image in the neigborhood of the old position. This alog finds the mode of the back projected image which obviously a confidence map of similarity between the color distribution of the face and the new image.

Remarks

The MeanShift trackers sometimes fails when the scale of the object of interest changes, because the tracker is initialized to the scale of the object in the first frame. Later when scale of the object is changed then the tracker window size does not match the actual size of the object. This problem is handeled by the CAMshift tracker.

usage:

$ python meanShiftTrack.py

Tracking using CAMshift in OpenCV

CAMshift tries to tackle the scale problem by using varying window size for applying meanshift. CamShift was developed by Gary Bradski in 1998.

Steps 1 and 2 are the same as that of MeanShift. In the third step, we find the backproject image and then use CamShift() openCV function to track the position of the object in the new frame. This function finds the an object center using meanshift and then adjust the window size. This funciton returns the rotaed rectangle that includes the object position, size, and orientation.

usage:

$ python CAMShiftTrack.py


Tracking by using OpenCV 3.2 Api and Python

OpenCV 3.2 has its own implementation of the following six single object tracking methods:

  • BOOSTING based on online AdaBoost HAAR cascade detector
  • Multiple Instance Learning (MIL)
  • Kernelized Correlation Filters (KCF)
  • Tracking, Learning and Detection (TLD)
  • MedianFlow
  • GoTurn (Deep Learning Based tracker)

usage single object tracking:

$ python trackeOneObject.py -t 0  

the input t specifies the methd: 0 for boosting, 1 for MKL, 2 for KCF, 3 for TLD, 4 for MedianFlow, and 5 for GOTURN

This code will track the face in the live video stream from webcam

usage multiple object tracking:

$ python trackMultipleObjects.py -t 0  -v path-to-video-file

the input t specifies the methd: 0 for boosting, 1 for MKL, 2 for KCF, 3 for TLD, 4 for MedianFlow, and 5 for GOTURN

References

  1. Pyimagesearch Adrian Rosebrock

  2. Learn OpenCV, Satya Mallick

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].