Skip to content

Latest commit

 

History

History
22 lines (12 loc) · 1.55 KB

README.md

File metadata and controls

22 lines (12 loc) · 1.55 KB

Common Coordinate Behaviour: arena alignment and fisheye correction

Code to generate and apply a geometric transform to align videos that may be at different positions, angles, and zoom. We use this to analyze escape trajectories from different sessions within the same coordinate space. Includes code to correct for fisheye lens distortion.

Use Register_and_Display_Behavior.py to register videos and display behavioral events

Relevant functions are found in Video_Functions.py. In particular the model_arena() function must be customized to match the particular arena or object in your videos.

Use Calibrate_Fisheye.py to calibrate fisheye distortion in your camera. (Includes code borrowed from Kenneth Jiang medium.com/@kennethjiang/calibrate-fisheye-lens-using-opencv-333b05afa0b0)

To test it out, run the file Register_and_Display_Behavior.py

Lastly, be sure to first install open-cv! (in my case, I pip installed a file called opencv_python-3.4.0+contrib-cp36-cp36m-win_amd64 downloaded from https://www.lfd.uci.edu/~gohlke/pythonlibs/#opencv)


The GUI from the register_arena() function. Clicking on the points on the video frame (left) that correspond to the four points indicated in the model arena (center) transforms the image such that it is aligned and overlaid with the model arena (right)

Example output: escape trajectories plotted within the same coordinate space