Skip to content
Behavioural arena alignment and fisheye correction
Python
Branch: master
Clone or download
Latest commit ba39d5c Aug 6, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
behavior videos Clean up for other users Jul 30, 2019
clips Clean up for other users Jul 30, 2019
example fisheye calibration images rearrange files Jul 30, 2019
fisheye calibration maps
Calibrate_Fisheye.py rearrange files Jul 30, 2019
Inverse_Fisheye_Functions.py Clean up for other users Jul 30, 2019
README.md Update README.md Aug 6, 2019
Register_and_Display_Behavior.py
Video_Functions.py Clean up for other users Jul 30, 2019
example.JPG rearrange files Jul 30, 2019
example2.jpg

README.md

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

You can’t perform that action at this time.