Skip to content

umartechboy/PhysTrack

Repository files navigation

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 or download all as zip from 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.

  • Option 1. (V3.0 and later) Type in "RunWizard" and hit "Enter". Depending upon the type of experiment required, select any script from the window and run it. A wizard will popup with the experiment sequential steps splitted in separate buttons.

  • Option 2. (Depreciated) 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 "analyzeMotionX" 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.

Downloads

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

Release Updates

  • V3.0 Added a new way of running the MotionScripts, the PhysTrack Wizard. The main function is PhysTrack.Wizard.RunWizard. It presents a GUI which runs the same motion scripts in sequential parts.

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] (http://physlab.org/experiment/spring-pendulum/) [analyze1DSHM.m] (https://github.com/umartechboy/PhysTrack/blob/master/Source%20Code/analyze1DSHM.m) [Link] (https://github.com/umartechboy/PhysTrack/tree/master/SampleVideos/SpringPendulum)
2D Collisions [Link] (http://physlab.org/experiment/colliding-pucks-on-a-carom-board/) [analyze2DCollision.m] (https://github.com/umartechboy/PhysTrack/blob/master/Source%20Code/analyze2DCollision.m) [Link] (https://github.com/umartechboy/PhysTrack/tree/master/SampleVideos/CaromPuck)
Projectile Motion [Link] (http://physlab.org/experiment/projectile-motion/) [analyzeProjectileMotion.m] (https://github.com/umartechboy/PhysTrack/blob/master/Source%20Code/analyzeProjectileMotion.m) [Link] (https://github.com/umartechboy/PhysTrack/tree/master/SampleVideos/Projectile%20Motion)
Sliding Friction [Link] (http://physlab.org/experiment/sliding-friction-2/) [analyzeSlidingFriction.m] (https://github.com/umartechboy/PhysTrack/blob/master/Source%20Code/analyzeSlidingFriction.m) [Link] (https://github.com/umartechboy/PhysTrack/tree/master/SampleVideos/SlidingFriction)
Rotation on a Fixed Pivot [Link] (http://physlab.org/experiment/rotational-motion-about-a-fixed-axis/) [analyzeRotationOnAFixedPivot.m] (https://github.com/umartechboy/PhysTrack/blob/master/Source%20Code/analyzeRotationOnAFixedPivot.m) [Link] (https://github.com/umartechboy/PhysTrack/tree/master/SampleVideos/RotationOnAFixedPivot)
Brownian Motion [Link] (http://physlab.org/experiment/tracking-brownian-motion-through-video-microscopy/) [analyzeBrownianMotion.m] (https://github.com/umartechboy/PhysTrack/blob/master/Source%20Code/analyzeBrownianMotion.m) [Link] (https://github.com/umartechboy/PhysTrack/tree/master/SampleVideos/BrownianMotion)
Rotational Friction [analyzeRotationalFriction.m] (https://github.com/umartechboy/PhysTrack/blob/master/Source%20Code/analyzeRotationalFriction.m) [Link] (https://github.com/umartechboy/PhysTrack/blob/master/SampleVideos/RollingCylinder.MP4)
Wilberforce Pendulum [analyzeWilberforcePendulum.m] (https://github.com/umartechboy/PhysTrack/blob/master/Source%20Code/analyzeWilberforcePendulum.m) [Link] (https://www.youtube.com/watch?v=UNhr9W0W-JE&list=PLImGVzFaOSBwp81p6VPLUukONhXLhCnB8)

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

Resources

Credits

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.

Authors

M. Umar Hassan, M. Sabieh Anwar.

References

[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.

About

PhysTrack is an Open Source Matlab Library for Video Tracking Developed by PhysLab (Lahore University of management sciences, Pakistan).

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages