-
Notifications
You must be signed in to change notification settings - Fork 337
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
undistortion for fisheye images is not Right? #531
Comments
thanks pinged relevant people who can check this |
In this context, undistortion is a bit of a misnomer. We want to remap distorted fisheye images to ideal fisheye images to retain FOV. Looks like you are following the equations from OpenCV's website here. Those are the equations for remapping distorted fisheye images to ideal pinhole images, which is not what we want. This implementation is a numpy version of the preprocessing used by the original Fisheye-GS repository. |
@jefequien |
When I first saw the de distortion code provided in his link, I was stunned. At first glance, I thought its undistortion code was wrong. Why could he still get the rendering results that looked good in the paper |
An ideal fisheye camera uses equidistant projection. An ideal pinhole camera uses rectilinear projection. If you collect a dataset with a wide-angle lens, you can undistort it to rectilinear image and train the splat normally but you'd be throwing away a lot of FOV. With Fisheye-GS, you can undistort it to an equidistant image and train a splat with a wider FOV. |
|
All of the information in the original image is retained. The black areas in the corners were never captured. Since the corners lack supervision, if you find them distracting, you can crop them away after rendering. Or you can try to invert the undistortion. Undistortion is hard to invert because it is not one-to-one, (see the 8-degree polynomial). However, it looks one-to-one so it feels like it should be invertable. I've looked into it before but haven't found a satisfactory solution. See stackoverflow discussions. |
@jefequien Thanks.
If we directly call OpenCV functions instead of implementing equidistant projection with handwritten code, you can do it this way, but this is not the effect I want. What I get is a completely distortion free effect, similar to a pinhole projection image
|
I found that the code for removing distortion from fish eyes has been changed several times, but I still find it to be incorrect。
x1 = (grid_x - cx) / fx y1 = (grid_y - cy) / fy theta = np.sqrt(x1**2 + y1**2) r = ( 1.0 + params[0] * theta**2 + params[1] * theta**4 + params[2] * theta**6 + params[3] * theta**8 ) mapx = (fx * x1 * r + width // 2).astype(np.float32) mapy = (fy * y1 * r + height // 2).astype(np.float32)
My code:
x1 = (grid_x - cx) / fx y1 = (grid_y - cy) / fy r = np.sqrt(x1**2 + y1**2) theta = np.arctan2(r,1) rd = (1.0 *theta + params[0] * theta**3 + params[1] * theta**5 + params[2] * theta**7 + params[3] * theta**9) scale = rd/r if r!=0 else 1.0 mapx = (fx * x1 * scale + width // 2).astype(np.float32) mapy = (fy * y1 * scale + height // 2).astype(np.float32)
The text was updated successfully, but these errors were encountered: