Global motion compensation (GMC) removes intentional and unwanted camera motion. GMC is widely applicable for video stitching and, as a pre-processing module, for motion-based video analysis. While state-of-the-art GMC algorithms generally estimate homography satisfactorily between consecutive frames, their performances deteriorate on real-world unconstrained videos, for instance, videos with predominant foreground, e.g., moving objects or human, or uniform background. Since GMC transformation of frames to the global motion-compensated coordinate is done by cascading homographies, failure in GMC of a single frame drastically harms the final result. Thus, we propose a robust GMC, called RGMC, based on homography estimation using keypoint matches.

RGMC first suppresses the foreground impact by clustering the keypoint matches and removing those pertaining to the foreground, as well as erroneous matches. For homography verification, we propose a probabilistic model that combines keypoint matching error, consistency of edges after homograhy transformation, the motion history, and prior camera motion information.

RGMC Flowchart

RGMC algorithm flowchart: (a) color indicates various motion vector clusters, (b) the merged cluster of background, (c) the motion history, and (d) the motion compensated video.

Sample Results

RGMC Source Code

RGMC implementation in Matlab may be downloaded from here.

This project was supported by the research gift from TechSmith Inc.

If you use RGMC code, please cite to the BMVC 2015 paper:


  • Robust Global Motion Compensation in Presence of Predominant Foreground
    Seyed Morteza Safdarnejad, Xiaoming Liu, Lalita Udpa
    Proc. British Machine Vision Conference (BMVC 2015), Swansea, UK, Sep. 2015 (Acceptance rate 33%, Best Poster Award)
    Bibtex | PDF | Project Webpage
  • @inproceedings{ robust-global-motion-compensation-in-presence-of-predominant-foreground,
      author = { Seyed Morteza Safdarnejad and Xiaoming Liu and Lalita Udpa },
      title = { Robust Global Motion Compensation in Presence of Predominant Foreground },
      booktitle = { Proc. British Machine Vision Conference },
      address = { Swansea, UK },
      month = { September },
      year = { 2015 },