GithubHelp home page GithubHelp logo

mauropfister / trajectory-overlay Goto Github PK

View Code? Open in Web Editor NEW
1.0 3.0 2.0 34 KB

A collection of scripts to overlay videos with trajectories from a motion capture system.

License: MIT License

Python 100.00%
motion-capture video

trajectory-overlay's Introduction

trajectory-overlay

A collection of scripts to overlay videos with trajectories from a motion capture system.

Note: This is still heavily work in progress.

Instructions

1. Intrinsic calibration

If you use a camera for which no intrinsic calibration file is provided, you will need to record a video of the calibration pattern in data. The script intrinsic_calibration.py will guide you through the calibration process and save the results into a json file.

Note that the intrinsic calibration parameters depend on the image resolution. Make sure you use the same settings as you will use to record the video on which trajectories will be drawn.

2. Extrinsic calibration

To determine the pose of the camera in the world frame, you will need to place at least 6 markers in the motion capture arena and write their positions into a json file as follows:

{ 
    "pos": [[-1.459,  0.924, 0.014],
            [ 0.891,  1.781, 0.007],
            [ 3.049,  1.801, 0.011],
            [ 3.513, -1.529, 0.014],
            [ 1.262, -1.794, 0.007],
            [-1.124, -1.865, 0.010]]
}

Take a video of this setup and do not move the camera/phone anymore. Use the script extrinsic_calibration.py to compute and save the extrinsic calibration into a json file. Make sure to visually check the reprojection of the markers (green). If they are totally off the intrinsic calibration is likely to be inaccurate.

You can call extrinsic_calibration.py as follows:

python extrinsic_calibration.py <video_path> <markers_file_path> <intrinsic_calib_file_path>

Optional arguments are:

  • --output <output_folder>

3. Overlay plot

Finally you can use plotter.py to overlay trajectories on a video. The script expects the trajectories to be saved in a hdf5 file. This hdf5 file should contain a separate group for each trajectory (each drone/vehicle). Each group should contain a dataset called pos. This dataset should be a N x 4 array where each row consists of [unix timestamp, x, y, z].

You can call plotter.py as follows:

python plotter.py <video_path> <log_trajectories_path> <intrinsic_calib_file_path>

Optional arguments are:

  • --intrinsic_calib <intrinsic_calib_file_path>
  • --extrinsic_calib <extrinsic_calib_file_path>
  • --output <output_folder>

trajectory-overlay's People

Contributors

enricaso avatar mauropfister avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.