yuhang2685 / Fisheye-Dewarping

Fisheye camera image dewarp with OpenCV-Python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fisheye-Dewarping

Background

There is an object in Lexivalley Inc. which offers real-time alerts to nearby drivers when there is an accident or impaired driving event happening around the area. The project belongs to the categories of Computer Vision and Vehicle-to-Everything (V2X).

Demanded by this project, the circular fisheye camera image should be warped into a flat image. The input is a video from fisheye camera. The output should be a dewarped video.

Useful reference

  1. py-fisheye-dewarp

The main idea is that fisheye image can be treated as a kind of sphere's projection image. Therefore we can imagine the fisheye image as surface of a sphere. Next, the pixel in the spehre surface can be transfered to longitude / latitude coordinate, like world map. In brief, the procedure can be illustrated as below: fisheye → spherical → longitude/latitude.

It seems like the code is unfinished. The based on paper has no public codes.

  1. Calibrate fisheye lens using OpenCV

Progress:

  1. Fork the codes from reference-1.
  2. Study the paper "A practical distortion correcting method from fisheye image to perspective projection image" (which is reference-1 based on) to understand the mechanism of the code, which is essential to modify the code as what we want.
  3. Check OpenCV for converting between vedio and image.
  4. Through experiment, we found reference-1 code is unfinished. The based on paper has no public codes too. Abandon it.
  5. Switch to reference-2 and conduct experiments.
  6. Modify the parameters intrinsic to the camera lens to undistort the captured video image.

  1. Apply YOLOv4 object detection on the undistort image. However, the result is not good:

  1. We rotate the image and try YOLOv4 again, the result is acceptable.

About

Fisheye camera image dewarp with OpenCV-Python