Skip to content

raisim::CameraPinholeDistortion ​

struct · #include <raisim/sensors/CameraLens.hpp>

OpenCV pinhole distortion of a PINHOLE lens (cv::projectPoints). With x = X/Z and y = Y/Z in the OpenCV optical frame and r2 = x^2 + y^2: radial = (1 + k1 r2 + k2 r2^2 + k3 r2^3) / (1 + k4 r2 + k5 r2^2 + k6 r2^3), xd = x radial + 2 p1 x y + p2 (r2 + 2 x^2) + s1 r2 + s2 r2^2, yd = y radial + p1 (r2 + 2 y^2) + 2 p2 x y + s3 r2 + s4 r2^2, followed by the sensor tilt (tauX, tauY), and u = fx xd + cx, v = fy yd + cy. PLUMB_BOB uses k1, k2, p1, p2 and k3 only; the other coefficients must be zero.

Public member functions ​

openCvCoefficients ​

cpp
std::array<double, 14> openCvCoefficients() const

Returns The 14 coefficients in OpenCV order (k1, k2, p1, p2, k3, k4, k5, k6, s1..s4, tauX, tauY).

setOpenCvCoefficients ​

cpp
void setOpenCvCoefficients(const std::vector<double> &values)

Set the coefficients from an OpenCV distCoeffs vector of 4, 5, 8, 12 or 14 values. Missing coefficients become zero. Four or five values select PLUMB_BOB, more select RATIONAL_POLYNOMIAL, an empty vector selects NONE. Any other count is a fatal error.

Parameters

ParameterDescription
values (in)Coefficients in OpenCV order.

isIdentity ​

cpp
bool isIdentity() const

Returns true if the model is NONE or every coefficient is zero.

Public attributes ​

model ​

cpp
CameraDistortionModel model

Distortion model.

k1 ​

cpp
double k1

Radial coefficient k1.

k2 ​

cpp
double k2

Radial coefficient k2.

p1 ​

cpp
double p1

Tangential coefficient p1.

p2 ​

cpp
double p2

Tangential coefficient p2.

k3 ​

cpp
double k3

Radial coefficient k3.

k4 ​

cpp
double k4

Rational denominator coefficient k4.

k5 ​

cpp
double k5

Rational denominator coefficient k5.

k6 ​

cpp
double k6

Rational denominator coefficient k6.

s1 ​

cpp
double s1

Thin-prism coefficient s1.

s2 ​

cpp
double s2

Thin-prism coefficient s2.

s3 ​

cpp
double s3

Thin-prism coefficient s3.

s4 ​

cpp
double s4

Thin-prism coefficient s4.

tauX ​

cpp
double tauX

Sensor tilt about the x axis in radians.

tauY ​

cpp
double tauY

Sensor tilt about the y axis in radians.

RaiSim — physics for robotics and AI.