user2428883
user2428883

Reputation:

How to simulate distortion with opencv based on real data, generated by camera calibration (C++)?

I am looking for a way to create (barrel) distortion with OpenCV in C++ that is based on real camera data, that are generated by camera calibration. So my target is to simulate real lens distortion with opencv. Therefor I calibrated a camera with OpenCV. I've only used the first distortion parameter k1: x' = x * k1*r² With this step I got a calibration file with k1 = 0.129, the extrensic and intrinsic camera matrix.

OpenCV provides a method to calibrate an image. And I would like to "inverse" this method, that the following is possible for testing: Original image -> undistort() -> undistort image -> "distort()" -> original image

Is it possible to negate the k1 factor or is it necessary to develop a new formula?

Thanks.

Upvotes: 5

Views: 1649

Answers (1)

Xale
Xale

Reputation: 359

Short answer, No negating the coefficient won't do it.

However you can test inverting the coefficient and you will get, to shape, an inverse conversion as long as the coefficient is small. The formula do not have a trivial inverse so that path may be rather hard.

Upvotes: 3

Related Questions