PhysTrack is an Open Source Matlab Library for Video Tracking Developed by PhysLab (Lahore University of management sciences, Pakistan).
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
Releases Delete +PhysTrack Sep 10, 2018
SampleVideos Added Details Sep 10, 2018
Source Code Bug fixes Sep 10, 2018
.gitattributes First Upload to GIT Feb 1, 2017
.gitignore Rearranged the codes Feb 10, 2017
Changelog.txt Minro changes Sep 10, 2018
LICENSE Initial commit Feb 1, 2017
PhysTrack -- Experimenter's Reference Manual 2017-1.pdf 2017-1 release of the user manual Apr 13, 2017

PhysTrack Logo

What is PhysTrack?

PhysTrack is a Matlab based video tracking solution for analyzing kinematics of moving bodies. Since Matlab is a very popular analysis tool in physics laboratories around the globe, we have tried to combine the robustness of Matlab computation power with such a friendly user interface which can be found in commercial video tracking software.

Who should use it?

PhysTrack is used in numerous physics experiments of Smart Physics Lab section of PhysLab.

Physics teachers, students and researchers can use PhysTrack to track the motion of moving bodies and investigate the underlying physics in many kinds of experiments. Typical examples of these experiments are rotating and translating discs [1], spring pendulum systems [2], bodies colliding on a plane and projectiles [3], microspheres exhibiting Brownian motion [4], liquid droplets falling down a stream and the movement of a fruitfly [5].

Examples of some experiments can be viewed on the Smart Physics Lab website on This Link.

[June 2015] EJP (European Journal of Physics) publishes "PhysTrack: A Matlab based environment for video tracking of kinematics in physics laboratory", a paper which discusses PhysTrack and related concepts in detail.

Requirements for performing an experiment with PhysTrack

  • In addition to having primary knowledge of kinematics, we assume that the user is accustomed with the basics of Matlab as well.

  • To capture videos a good slow motion camera is required. In PhysLab, we usually use a Canon PowerShot SX280HS mounted on a tripod stand which works very well with most of the mechanics experiments. This camera can capture video at as high a frame rate as 240fps with a frame size of 320x240 pixels.

  • For investigating microscopic motion, a video microscope is also required. In PhysLab, we usually use a Motic BA210 Trinocular for investigating the Brownian motion of micro particles.

  • Usually, to move the objects in required fashion, an apparatus is also recommended.

  • A computer with RAM >=3GB and an installation of Matlab 2006 (or above) with Image Acquisition Toolbox and Computer Vision Toolbox is also required.

Getting started

You are only a couple of steps away from using PhysTrack for your own experiments.

  • Download and extract the latest PhysTrack source from the downloads section. It also contains some additional experiment scripts which serve as an example for creating your own experiments.

  • Also, choose and download a sample video from the this link.

  • Open Matlab and change the current directory to the downloaded package. You should see the "+PhysTrack" and "GUIs" directory along with some "analyze motion" scripts in the current address window.

  • Depending upon the type of experiment required, select any script from the window and run it. (Or you can type in the name of that experiment in the command window and hit "Enter".

  • The scripts are designed to be user interactive. They communicate with the user through GUI's and message boxes and guide through the whole process. The script will also ask to load the experiment video you downloaded in the previous steps.

  • Once done, peruse the sample scripts, which are well commented, and try to understand how you can modify the codes for your own experiment. You will also find help on the usage of each function from the PhysTrack Wiki.

  • Capture your own experiment's video and start making robust video tracking experiment scripts.


PhysTrack Package Complete package including the sample videos (this Git)

PhysTrack Package The latest PhysTrack Package (without videos)

PhysTrack Package Sample Videos

PhysTrack Package Experimenter's Reference Manual

Performing a physics experiment with PhysTrack

Process Flow

Performing a classical mechanics experiments using video tracking and performing advance analysis is very simple.

  • We capture video of the moving object using a digital camera,
  • use one of the automated trackers of PhysTrack to track the objects and generate position and orientation data,
  • to investigate the motion, use the in-built Matlab tools or those included in PhysTrack like numerical differentiation, curve fitting, object stitching and coordinate system transformation and
  • present the results using Matlab plots and video plots included in PhysTrack.

Sample experiments

Experiment Title Student manual and resources Sample Analysis Codes Sample Videos
Spring pendulum [Link] ( [analyze1DSHM.m] ( [Link] (
2D Collisions [Link] ( [analyze2DCollision.m] ( [Link] (
Projectile Motion [Link] ( [analyzeProjectileMotion.m] ( [Link] (
Sliding Friction [Link] ( [analyzeSlidingFriction.m] ( [Link] (
Rotation on a Fixed Pivot [Link] ( [analyzeRotationOnAFixedPivot.m] ( [Link] (
Brownian Motion [Link] ( [analyzeBrownianMotion.m] ( [Link] (
Rotational Friction [analyzeRotationalFriction.m] ( [Link] (
Wilberforce Pendulum [analyzeWilberforcePendulum.m] ( [Link] (

Video demonstration

Once the video is captured, PhysTrack is used in Matlab for extracting data, performing analysis and presenting the results. When using the sample "analyze motion" scripts from the previous section, the process is similar for all the experiments. Users can also take these experiments as a base for creating new scrips and automated experiments.

Video Demonstration on YouTube



The whole work is an effort of PhysLab of the Lahore University of Management Sciences (LUMS), Lahore, Pakistan. Kindly feel free to contact in case you wish to contribute in the development and improvement of this library.


M. Umar Hassan, M. Sabieh Anwar.


[1] J. Poonyawatpornkul and P. Wattanakasiwich, "High-speed video analysis of a rolling disc in three dimensions", Eur. J. Phys. 36 065027 (2015).

[2] J. Poonyawatpornkul and P. Wattanakasiwich, "High-speed video analysis of damped harmonic motion", Eur. J. Phys. 48 6 (2013).

[3] Loo Kang Wee, Charles Chew, Giam Hwee Goh, Samuel Tan and Tat Leong Lee, "Using Tracker as a pedagogical tool for understanding projectile motion" Eur. J. Phys. 47 448 (2012).

[4] Paul Nakroshis, Matthew Amoroso, Jason Legere and Christian Smith, "Measuring Boltzmann’s constant using video microscopy of Brownian motion", Am. J. Phys, 71, 568 (2003).

[5] "Tracking kinematics of a fruitfly using video analysis".

The first version uploaded on GitHub is v2.1 and a comprehensive documentation of this code can be viewed on PhysTrack Wiki on This Link.