1
$\begingroup$

I have video recordings of a behavioral experiment on mice. The camera is rigidly attached to the ceiling. Below the camera is a round table with round holes. Unfortunately, the camera is not strictly above the middle of the table and has geometric distortions.

example image

Is there any way to remove the distortions programmatically? Later I plan to analyze the already recorded videos for the coordinates of the mouse running around the table.

$\endgroup$

1 Answer 1

2
$\begingroup$

Simply, you need to undistort your images first to correct the fish-eye distortion. Then, align your image plane to be coplanar with the table.

Both of the mentioned operations are geometrical transforms, and you need to know the transform's parameters. To calculate these parameters, you need a set of points with known actual coordinates and their projected coordinates onto the image. Personally, I find printing a checkerboard pattern and using the corner's coordinates to be the simplest method (There are image processing libraries that can automatically find the corner coordinates in the image).

Pose the checkerboard in front of camera with different orientations and take a few pictures. Using checkersboard's corners coordinates, you can determine the distortion parameters and use these distortion parameters to undistort images. Next place the printed checkerboard on the table and take another picture. Undistort this image, then find corners coordinates from undistorted image and use them to find a projective transform prameters, where this transform aligns the image plane with the table. Finally warp the undistorted image using the obtained projective transform.

Finally, you can combine these two geometric transformations into a single transform to reduce computational cost. By doing this you would apply single transform to the images instead of two cascaded transform.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.