Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove lens distortion from images captured by an wide angle (180) camera

I have some images captured from an wide angle appx. (180 degree) camera. I am using opencv 2.4.8 which gives some details about camera matrix n distortion matrix.

MatK = [537.43775285, 0, 327.61133999], [0, 536.95118778, 248.89561998], [0, 0, 1]
MatD = [-0.29741743, 0.14930169, 0, 0, 0]

And this info I have used further to remove the distortion. But the result is not as expected. I have attached some input images of chess board which i have used to calibrate. Or Is there any other tools or library by which it can be removed.

input images

testImg1

testImg2 testImg3 testImg4

from a Normal Camera or even captured by my smart phone without Distortion without Distortion without Distortion

like image 546
Javed Avatar asked Dec 31 '25 04:12

Javed


2 Answers

This is not an answer to the question, but something about the "discussion" of distortion and planarness.

In reality you have some straight lines on a pattern:

enter image description here

With (nearly any) lens you'll get some kind of distortion so that those straight lines aren't straight anymore after projection to your image. This effect is much stronger for wide angle lenses. You could expect something like this (for wide angle stronger but similar):

enter image description here

But the images you provided look more like this, which can be because of your pattern wasnt really planar on the ground, or because the lens has some additional "hills" on your lens.

enter image description here

like image 101
Micka Avatar answered Jan 01 '26 23:01

Micka


The whole point of the calibration process is to tell OpenCV what a straight line looks like under distortion. A chess board is used to present a number of straight lines that are easy for OpenCV to detect. In your image, these lines are simply not straight. I'm moderately sure that OpenCV also needs square boxes.

So, use a real chess board pattern. Print it out, glue it to a piece of wood or hard plastic or whatever. But make sure it's a regular chessboard pattern on a level plane.

like image 36
Andreas Haferburg Avatar answered Jan 02 '26 01:01

Andreas Haferburg