8 #ifndef META_OCEAN_MATH_FISHEYE_CAMERA_H
9 #define META_OCEAN_MATH_FISHEYE_CAMERA_H
24 template <
typename T>
class FisheyeCameraT;
104 template <
typename T>
183 template <
typename U>
203 inline FisheyeCameraT(
const unsigned int width,
const unsigned int height,
const T focalX,
const T focalY,
const T principalX,
const T principalY);
217 template <
typename TParameter>
228 template <
typename TParameter>
330 template <
typename TParameter>
349 template <
bool tUseDistortionParameters = true>
358 template <
bool tUseDistortionParameters = true>
370 template <
bool tUseDistortionParameters = true>
383 template <
bool tUseDistortionParameters = true>
396 template <
bool tUseDistortionParameters = true>
408 template <
bool tUseDistortionParameters = true>
420 template <
bool tUseDistortionParameters = true>
432 template <
bool tUseDistortionParameters = true>
443 template <
bool tUseDistortionParameters = true>
453 template <
bool tUseDistortionParameters = true>
472 template <
bool tUseDistortionParameters = true>
515 explicit inline operator bool()
const;
578 template <
typename T>
579 template <
typename U>
581 cameraWidth_(fisheyeCamera.cameraWidth_),
582 cameraHeight_(fisheyeCamera.cameraHeight_),
583 focalLengthX_(T(fisheyeCamera.focalLengthX_)),
584 focalLengthY_(T(fisheyeCamera.focalLengthY_)),
585 principalPointX_(T(fisheyeCamera.principalPointX_)),
586 principalPointY_(T(fisheyeCamera.principalPointY_)),
587 hasDistortionParameters_(fisheyeCamera.hasDistortionParameters_)
595 for (
unsigned int n = 0u; n < 6u; ++n)
604 template <
typename T>
607 cameraHeight_(height),
614 hasDistortionParameters_(false)
628 const T invFocalLength = T(1) / focalLength;
635 for (
unsigned int n = 0u; n < 6u; ++n)
644 template <
typename T>
647 cameraHeight_(height),
648 focalLengthX_(focalX),
649 focalLengthY_(focalY),
652 principalPointX_(principalX),
653 principalPointY_(principalY),
654 hasDistortionParameters_(false)
663 for (
unsigned int n = 0u; n < 6u; ++n)
672 template <
typename T>
673 template <
typename TParameter>
674 inline FisheyeCameraT<T>::FisheyeCameraT(
const unsigned int width,
const unsigned int height,
const TParameter focalX,
const TParameter focalY,
const TParameter principalX,
const TParameter principalY,
const TParameter* radialDistortion,
const TParameter* tangentialDistortion) :
676 cameraHeight_(height),
677 focalLengthX_(T(focalX)),
678 focalLengthY_(T(focalY)),
681 principalPointX_(T(principalX)),
682 principalPointY_(T(principalY)),
683 hasDistortionParameters_(true)
685 static_assert((std::is_same<TParameter, float>::value) || (std::is_same<TParameter, double>::value),
"Invalid TParameter, must be 'float' or 'double'!");
692 for (
unsigned int n = 0u; n < 6u; ++n)
701 template <
typename T>
702 template <
typename TParameter>
705 cameraHeight_(height),
712 hasDistortionParameters_(false)
714 static_assert((std::is_same<TParameter, float>::value) || (std::is_same<TParameter, double>::value),
"Invalid TParameter, must be 'float' or 'double'!");
717 ocean_assert(parameters !=
nullptr);
719 switch (parameterConfiguration)
794 ocean_assert(
false &&
"Invalid parameter configuration!");
803 template <
typename T>
806 return hasDistortionParameters_;
809 template <
typename T>
815 template <
typename T>
818 return cameraHeight_;
821 template <
typename T>
824 return VectorT2<T>(principalPointX(), principalPointY());
827 template <
typename T>
830 return principalPointX_;
833 template <
typename T>
836 return principalPointY_;
839 template <
typename T>
842 return focalLengthX_;
845 template <
typename T>
848 return focalLengthY_;
851 template <
typename T>
854 return invFocalLengthX_;
857 template <
typename T>
860 return invFocalLengthY_;
863 template <
typename T>
866 return radialDistortion_;
869 template <
typename T>
872 return tangentialDistortion_;
875 template <
typename T>
878 ocean_assert(isValid());
893 if (T(cameraWidth_) <= principalPointX())
895 ocean_assert(
false &&
"Invalid principal point");
896 return T(2) * leftAngle;
899 const T rightAngle =
NumericT<T>::atan((T(cameraWidth_) - principalPointX()) * invFocalLengthX_);
901 return leftAngle + rightAngle;
904 template <
typename T>
907 ocean_assert(isValid());
922 if (T(cameraHeight_) <= principalPointY())
924 ocean_assert(
false &&
"Invalid principal point");
925 return T(2) * topAngle;
928 const T bottomAngle =
NumericT<T>::atan((T(cameraHeight_) - principalPointY()) * invFocalLengthY_);
930 return topAngle + bottomAngle;
933 template <
typename T>
936 const VectorT2<T> topLeft(-principalPointX(), -principalPointY());
937 const VectorT2<T> bottomRight(principalPointX(), principalPointY());
939 const T diagonal = (topLeft - bottomRight).length();
940 const T halfDiagonal = diagonal * T(0.5);
942 const T invFocalLength = (invFocalLengthX_ + invFocalLengthY_) * T(0.5);
947 template <
typename T>
948 template <
typename TParameter>
953 width = cameraWidth_;
954 height = cameraHeight_;
958 TParameter(focalLengthX_),
959 TParameter(focalLengthY_),
961 TParameter(principalPointX_),
962 TParameter(principalPointY_),
964 TParameter(radialDistortion_[0]),
965 TParameter(radialDistortion_[1]),
966 TParameter(radialDistortion_[2]),
967 TParameter(radialDistortion_[3]),
968 TParameter(radialDistortion_[4]),
969 TParameter(radialDistortion_[5]),
971 TParameter(tangentialDistortion_[0]),
972 TParameter(tangentialDistortion_[1]),
975 ocean_assert(parameters.size() == 12);
977 parameterConfiguration = PC_12_PARAMETERS;
986 parameterConfiguration = PC_UNKNOWN;
990 template <
typename T>
993 ocean_assert(isValid());
994 ocean_assert(signedBorder < T(std::min(cameraWidth_ / 2u, cameraHeight_ / 2u)));
996 return imagePoint.
x() >= signedBorder && imagePoint.
y() >= signedBorder
997 && imagePoint.
x() < T(cameraWidth_) - signedBorder && imagePoint.
y() < T(cameraHeight_) - signedBorder;
1000 template <
typename T>
1001 template <
bool tUseDistortionParameters>
1004 ocean_assert(isValid());
1032 const T r2 = undistortedNormalized.
sqr();
1042 if (tUseDistortionParameters && hasDistortionParameters_)
1044 const T theta2 = theta * theta;
1045 const T theta3 = theta2 * theta;
1046 const T theta5 = theta2 * theta3;
1047 const T theta7 = theta2 * theta5;
1048 const T theta9 = theta2 * theta7;
1049 const T theta11 = theta2 * theta9;
1050 const T theta13 = theta2 * theta11;
1052 const T& k3 = radialDistortion_[0];
1053 const T& k5 = radialDistortion_[1];
1054 const T& k7 = radialDistortion_[2];
1055 const T& k9 = radialDistortion_[3];
1056 const T& k11 = radialDistortion_[4];
1057 const T& k13 = radialDistortion_[5];
1059 const T radialDistortionFactor = (theta + k3 * theta3 + k5 * theta5 + k7 * theta7 + k9 * theta9 + k11 * theta11 + k13 * theta13) / r;
1061 const T x_r = undistortedNormalized.
x() * radialDistortionFactor;
1062 const T y_r = undistortedNormalized.
y() * radialDistortionFactor;
1064 const T radius_r2 = x_r * x_r + y_r * y_r;
1066 const T& p1 = tangentialDistortion_[0];
1067 const T& p2 = tangentialDistortion_[1];
1069 const T x_t = p1 * (T(2) * x_r * x_r + radius_r2) + p2 * T(2) * x_r * y_r;
1070 const T y_t = p2 * (T(2) * y_r * y_r + radius_r2) + p1 * T(2) * x_r * y_r;
1076 const T scale = theta / r;
1078 return VectorT2<T>(undistortedNormalized.
x() * scale, undistortedNormalized.
y() * scale);
1082 template <
typename T>
1083 template <
bool tUseDistortionParameters>
1086 ocean_assert(isValid());
1088 if constexpr (tUseDistortionParameters)
1090 const VectorT2<T> distortedTangentialFree = tangentialFreeDistortion(distortedNormalized);
1092 const T& k3 = radialDistortion_[0];
1093 const T& k5 = radialDistortion_[1];
1094 const T& k7 = radialDistortion_[2];
1095 const T& k9 = radialDistortion_[3];
1096 const T& k11 = radialDistortion_[4];
1097 const T& k13 = radialDistortion_[5];
1099 const T r = distortedTangentialFree.
length();
1108 for (
unsigned int n = 0u; n < 10u; ++n)
1110 const T theta2 = theta * theta;
1111 const T theta4 = theta2 * theta2;
1112 const T theta6 = theta4 * theta2;
1113 const T theta8 = theta6 * theta2;
1114 const T theta10 = theta8 * theta2;
1115 const T theta12 = theta10 * theta2;
1117 const T error = theta * (T(1) + k3 * theta2 + k5 * theta4 + k7 * theta6 + k9 * theta8 + k11 * theta10 + k13 * theta12) - r;
1119 const T df = T(1) + T(3) * k3 * theta2 + T(5) * k5 * theta4 + T(7) * k7 * theta6 + T(9) * k9 * theta8 + T(11) * k11 * theta10 + T(13) * k13 * theta12;
1126 const T delta = error / df;
1138 return distortedTangentialFree * scale;
1142 const T r = distortedNormalized.
length();
1151 return distortedNormalized * scale;
1155 template <
typename T>
1156 template <
bool tUseDistortionParameters>
1159 ocean_assert(isValid());
1161 return projectToImageIF<tUseDistortionParameters>(
VectorT3<T>(worldObjectPoint.
x(), -worldObjectPoint.
y(), -worldObjectPoint.
z()));
1164 template <
typename T>
1165 template <
bool tUseDistortionParameters>
1168 ocean_assert(isValid());
1170 ocean_assert(world_T_camera.
isValid());
1174 template <
typename T>
1175 template <
bool tUseDistortionParameters>
1178 ocean_assert(isValid());
1180 ocean_assert(flippedCamera_T_world.
isValid());
1181 return projectToImageIF<tUseDistortionParameters>(flippedCamera_T_world * worldObjectPoint);
1184 template <
typename T>
1185 template <
bool tUseDistortionParameters>
1188 ocean_assert(isValid());
1191 const T invZ = T(1) / cameraFlippedObjectPoint.
z();
1193 const VectorT2<T> undistortedNormalized(cameraFlippedObjectPoint.
x() * invZ, cameraFlippedObjectPoint.
y() * invZ);
1194 const VectorT2<T> distortedNormalizedImagePoint = distortNormalized<tUseDistortionParameters>(undistortedNormalized);
1196 return VectorT2<T>(distortedNormalizedImagePoint.
x() * focalLengthX() + principalPointX(), distortedNormalizedImagePoint.
y() * focalLengthY() + principalPointY());
1199 template <
typename T>
1200 template <
bool tUseDistortionParameters>
1203 ocean_assert(isValid());
1205 const VectorT2<T> distortedNormalized((distortedImagePoint.
x() - principalPointX_) * invFocalLengthX_, (distortedImagePoint.
y() - principalPointY_) * invFocalLengthY_);
1206 const VectorT2<T> undistortedNormalized = undistortNormalized<tUseDistortionParameters>(distortedNormalized);
1214 return VectorT3<T>(undistortedNormalized.
x(), -undistortedNormalized.
y(), T(-1));
1218 template <
typename T>
1219 template <
bool tUseDistortionParameters>
1222 ocean_assert(isValid());
1224 const VectorT2<T> distortedNormalized((distortedImagePoint.
x() - principalPointX_) * invFocalLengthX_, (distortedImagePoint.
y() - principalPointY_) * invFocalLengthY_);
1225 const VectorT2<T> undistortedNormalized = undistortNormalized<tUseDistortionParameters>(distortedNormalized);
1233 return VectorT3<T>(undistortedNormalized.
x(), undistortedNormalized.
y(), T(1));
1237 template <
typename T>
1238 template <
bool tUseDistortionParameters>
1241 ocean_assert(isValid() && world_T_camera.
isValid());
1246 template <
typename T>
1247 template <
bool tUseDistortionParameters>
1250 ocean_assert(isValid());
1252 return LineT3<T>(
Vector3(0, 0, 0), vector<tUseDistortionParameters>(distortedImagePoint));
1255 template <
typename T>
1256 template <
bool tUseDistortionParameters>
1259 ocean_assert(isValid());
1260 ocean_assert(jx !=
nullptr && jy !=
nullptr);
1262 const T fx = focalLengthX();
1263 const T fy = focalLengthY();
1265 const T u = flippedCameraObjectPoint.
x();
1266 const T v = flippedCameraObjectPoint.
y();
1267 const T w = flippedCameraObjectPoint.
z();
1270 const T invW = T(1) / w;
1272 const T u_invW = u * invW;
1273 const T v_invW = v * invW;
1275 if constexpr (tUseDistortionParameters)
1280 jacobianDistortNormalized2x2(u_invW, v_invW, radialDistortion_, tangentialDistortion_, jDistX, jDistY);
1282 const T fx_jDistXx_invW = fx * jDistX[0] * invW;
1283 const T fy_jDistYx_invW = fy * jDistY[0] * invW;
1285 const T fx_jDistXy_invW = fx * jDistX[1] * invW;
1286 const T fy_jDistYy_invW = fy * jDistY[1] * invW;
1288 const T u_fx_jDistXx__ = u_invW * fx_jDistXx_invW + v_invW * fx_jDistXy_invW;
1289 const T u_fy_jDistYx__ = u_invW * fy_jDistYx_invW + v_invW * fy_jDistYy_invW;
1291 jx[0] = fx_jDistXx_invW;
1292 jx[1] = fx_jDistXy_invW;
1293 jx[2] = -u_fx_jDistXx__;
1295 jy[0] = fy_jDistYx_invW;
1296 jy[1] = fy_jDistYy_invW;
1297 jy[2] = -u_fy_jDistYx__;
1301 const T fx_jDistXx_invW = fx * invW;
1302 const T fy_jDistYx_invW = fy * invW;
1304 const T fx_jDistXy_invW = fx * invW;
1305 const T fy_jDistYy_invW = fy * invW;
1307 const T u_fx_jDistXx__ = u_invW * fx_jDistXx_invW + v_invW * fx_jDistXy_invW;
1308 const T u_fy_jDistYx__ = u_invW * fy_jDistYx_invW + v_invW * fy_jDistYy_invW;
1310 jx[0] = fx_jDistXx_invW;
1311 jx[1] = fx_jDistXy_invW;
1312 jx[2] = -u_fx_jDistXx__;
1314 jy[0] = fy_jDistYx_invW;
1315 jy[1] = fy_jDistYy_invW;
1316 jy[2] = -u_fy_jDistYx__;
1320 template <
typename T>
1332 template <
typename T>
1338 return cameraWidth_ != 0u && cameraHeight_ != 0u;
1341 template <
typename T>
1349 && memcmp(radialDistortion_, fisheyeCamera.
radialDistortion_,
sizeof(T) * 6) == 0
1353 template <
typename T>
1356 return !(*
this == fisheyeCamera);
1359 template <
typename T>
1365 template <
typename T>
1378 const T& p1 = tangentialDistortion_[0];
1379 const T& p2 = tangentialDistortion_[1];
1383 return distortedNormalized;
1386 VectorT2<T> distortedTangentialFree(distortedNormalized);
1388 for (
unsigned int n = 0u; n < 2u; ++n)
1390 const T& x_r = distortedTangentialFree.
x();
1391 const T& y_r = distortedTangentialFree.
y();
1393 const T resultX = p1 * T(3) * x_r * x_r + p1 * y_r * y_r + T(2) * p2 * x_r * y_r + x_r - distortedNormalized.
x();
1394 const T resultY = p2 * T(3) * y_r * y_r + p2 * x_r * x_r + T(2) * p1 * x_r * y_r + y_r - distortedNormalized.
y();
1396 const T dxx = p1 * T(6) * x_r + T(2) * p2 * y_r + T(1);
1397 const T dxy = p1 * T(2) * y_r + T(2) * p2 * x_r;
1400 const T dyy = p2 * T(6) * y_r + T(2) * p1 * x_r + T(1);
1405 distortedTangentialFree -= delta;
1413 return distortedTangentialFree;
1416 template <
typename T>
1419 ocean_assert(jx !=
nullptr && jy !=
nullptr);
1420 ocean_assert(radialDistortion !=
nullptr && tangentialDistortion !=
nullptr);
1422 const T& k3 = radialDistortion[0];
1423 const T& k5 = radialDistortion[1];
1424 const T& k7 = radialDistortion[2];
1425 const T& k9 = radialDistortion[3];
1426 const T& k11 = radialDistortion[4];
1427 const T& k13 = radialDistortion[5];
1429 const T& p1 = tangentialDistortion[0];
1430 const T& p2 = tangentialDistortion[1];
1435 const T xy2 = x2 + y2;
1438 const T r3 = r * r * r;
1442 const T t3 = t2 * t;
1443 const T t4 = t3 * t;
1444 const T t5 = t4 * t;
1445 const T t6 = t5 * t;
1446 const T t7 = t6 * t;
1447 const T t8 = t7 * t;
1448 const T t9 = t8 * t;
1449 const T t10 = t9 * t;
1450 const T t11 = t10 * t;
1451 const T t12 = t11 * t;
1452 const T t13 = t12 * t;
1454 const T term0 = k13 * t13 + k11 * t11 + k9 * t9 + k7 * t7 + k5 * t5 + k3 * t3 + t;
1455 const T term1 = 13 * k13 * t12 + 11 * k11 * t10 + 9 * k9 * t8 + 7 * k7 * t6 + 5 * k5 * t4 + 3 * k3 * t2 + 1;
1457 const T term2 = (xy2 + 1) * term0;
1458 const T term3 = r3 * (xy2 + 1);
1459 const T invTerm3 = T(1) / term3;
1461 const T xDistortion_dx = (xy2 * term2 - x2 * term2 + x2 * r * term1) * invTerm3;
1462 const T xDistortion_dy = (x * term1 * y) / (xy2 * (xy2 + 1)) - (x * y * term0) / r3;
1465 const T& yDistortion_dx = xDistortion_dy;
1466 const T yDistortion_dy = (xy2 * term2 - y2 * term2 + y2 * r * term1) * invTerm3;
1468 const T radialDistortionFactor = term0 / r;
1470 const T rx = x * radialDistortionFactor;
1471 const T ry = y * radialDistortionFactor;
1473 const T xTangential_dx = 6 * p1 * rx + 2 * p2 * ry + 1;
1474 const T xTangential_dy = 2 * p1 * ry + 2 * p2 * rx;
1477 const T& yTangential_dx = xTangential_dy;
1478 const T yTangential_dy = 6 * p2 * ry + 2 * p1 * rx + 1;
1484 jx[0] = xTangential_dx * xDistortion_dx + xTangential_dy * yDistortion_dx;
1485 jx[1] = xTangential_dx * xDistortion_dy + xTangential_dy * yDistortion_dy;
1487 jy[0] = yTangential_dx * xDistortion_dx + yTangential_dy * yDistortion_dx;
1488 jy[1] = yTangential_dx * xDistortion_dy + yTangential_dy * yDistortion_dy;
This class implements the base class for all cameras.
Definition: Camera.h:54
bool isValid() const
Returns whether this camera is valid.
Definition: FisheyeCamera.h:1333
FisheyeCameraT(const unsigned int width, const unsigned int height, const T fovX)
Creates a new camera object with known field of view.
Definition: FisheyeCamera.h:605
const T * radialDistortion() const
Returns the six radial distortion parameters of the camera model.
Definition: FisheyeCamera.h:864
T invFocalLengthX_
The horizontal inverse focal length of the camera, with range (0, infinity)
Definition: FisheyeCamera.h:557
T principalPointX() const
Returns the x-value of the principal point of the camera image in the pixel domain.
Definition: FisheyeCamera.h:828
bool operator!=(const FisheyeCameraT< T > &fisheyeCamera) const
Returns whether two fisheye cameras are not identical.
Definition: FisheyeCamera.h:1354
FisheyeCameraT(const FisheyeCameraT< T > &fisheyeCamera)=default
Copy constructor.
unsigned int height() const
Returns the height of the camera image.
Definition: FisheyeCamera.h:816
VectorT2< T > projectToImage(const VectorT3< T > &worldObjectPoint) const
Projects a 3D object point into the camera's image of the fisheye camera.
Definition: FisheyeCamera.h:1157
LineT3< T > ray(const VectorT2< T > &distortedImagePoint, const HomogenousMatrixT4< T > &world_T_camera) const
Returns a ray starting at the camera's center and intersecting a given 2D point in the image.
Definition: FisheyeCamera.h:1239
VectorT2< T > principalPoint() const
Returns the coordinate of the principal point of the camera image in the pixel domain.
Definition: FisheyeCamera.h:822
T Type
Definition of the used data type.
Definition: FisheyeCamera.h:114
FisheyeCameraT(const unsigned int width, const unsigned int height, const ParameterConfiguration parameterConfiguration, const TParameter *parameters)
Creates a new camera object with parameters with specific configuration.
Definition: FisheyeCamera.h:703
VectorT2< T > projectToImage(const HomogenousMatrixT4< T > &world_T_camera, const VectorT3< T > &worldObjectPoint) const
Projects a 3D object point into the camera's image of the fisheye camera.
Definition: FisheyeCamera.h:1166
T fovY() const
Returns the field of view in x direction of the camera.
Definition: FisheyeCamera.h:905
VectorT2< T > projectToImageIF(const HomogenousMatrixT4< T > &flippedCamera_T_world, const VectorT3< T > &worldObjectPoint) const
Projects a 3D object point to the 2D image plane of the fisheye camera by a given inverted (and flipp...
Definition: FisheyeCamera.h:1176
const T * tangentialDistortion() const
Returns the two tangential distortion parameters of the camera model.
Definition: FisheyeCamera.h:870
VectorT3< T > vector(const VectorT2< T > &distortedImagePoint, const bool makeUnitVector=true) const
Returns a unit vector (with length 1) starting at the camera's center and intersecting a given 2D poi...
Definition: FisheyeCamera.h:1201
T focalLengthY_
The vertical focal length of the camera, with range (0, infinity)
Definition: FisheyeCamera.h:554
T principalPointX_
The horizontal principal point of the camera, in pixels, with range [0, width())
Definition: FisheyeCamera.h:563
T fovX() const
Returns the field of view in x direction of the camera.
Definition: FisheyeCamera.h:876
friend class FisheyeCameraT
Definition: FisheyeCamera.h:107
T focalLengthX_
The horizontal focal length of the camera, with range (0, infinity)
Definition: FisheyeCamera.h:551
T radialDistortion_[6]
The six radial distortion parameters.
Definition: FisheyeCamera.h:572
T inverseFocalLengthX() const
Returns the inverse horizontal focal length parameter.
Definition: FisheyeCamera.h:852
VectorT3< T > vectorIF(const VectorT2< T > &distortedImagePoint, const bool makeUnitVector=true) const
Returns a normalized vector (with length 1) starting at the camera's center and intersecting a given ...
Definition: FisheyeCamera.h:1220
bool hasDistortionParameters() const
Returns whether this camera object has specified distortion parameters.
Definition: FisheyeCamera.h:804
T tangentialDistortion_[2]
The two tangential distortion parameters.
Definition: FisheyeCamera.h:575
T principalPointY_
The vertical principal point of the camera, in pixels, with range [0, width())
Definition: FisheyeCamera.h:566
FisheyeCameraT< T > & operator=(const FisheyeCameraT< T > &fisheyeCamera)=default
Copy assignment operator.
T invFocalLengthY_
The vertical inverse focal length of the camera, with range (0, infinity)
Definition: FisheyeCamera.h:560
bool operator==(const FisheyeCameraT< T > &fisheyeCamera) const
Returns whether two fisheye cameras are identical.
Definition: FisheyeCamera.h:1342
unsigned int cameraWidth_
Width of the camera image, in pixel.
Definition: FisheyeCamera.h:545
FisheyeCameraT(const unsigned int width, const unsigned int height, const T focalX, const T focalY, const T principalX, const T principalY)
Creates a new camera object without distortion parameters.
Definition: FisheyeCamera.h:645
T focalLengthX() const
Returns the horizontal focal length parameter.
Definition: FisheyeCamera.h:840
void copyParameters(unsigned int &width, unsigned int &height, std::vector< TParameter > ¶meters, ParameterConfiguration ¶meterConfiguration) const
Copies the parameters of this camera.
Definition: FisheyeCamera.h:949
unsigned int cameraHeight_
Height of the camera image, in pixel.
Definition: FisheyeCamera.h:548
FisheyeCameraT(const unsigned int width, const unsigned int height, const TParameter focalX, const TParameter focalY, const TParameter principalX, const TParameter principalY, const TParameter *radialDistortion, const TParameter *tangentialDistortion)
Creates a new camera object with distortion parameters.
Definition: FisheyeCamera.h:674
VectorT2< T > distortNormalized(const VectorT2< T > &undistortedNormalized) const
Returns the normalized distorted position of a given undistorted normalized position.
Definition: FisheyeCamera.h:1002
VectorT2< T > undistortNormalized(const VectorT2< T > &distortedNormalized) const
Returns the normalized undistorted position of a given distorted normalized position.
Definition: FisheyeCamera.h:1084
FisheyeCameraT()=default
Default constructor creating an invalid camera object.
LineT3< T > ray(const VectorT2< T > &distortedImagePoint) const
Returns a ray starting at the camera's center and intersecting a given 2D point in the image.
Definition: FisheyeCamera.h:1248
bool isEqual(const FisheyeCameraT< T > &fisheyeCamera, const T eps=NumericT< T >::eps()) const
Returns whether two camera profiles are identical up to a given epsilon.
Definition: FisheyeCamera.h:1321
unsigned int width() const
Returns the width of the camera image.
Definition: FisheyeCamera.h:810
T fovDiagonal() const
Returns the diagonal field of view of the camera.
Definition: FisheyeCamera.h:934
T focalLengthY() const
Returns the vertical focal length parameter.
Definition: FisheyeCamera.h:846
static OCEAN_FORCE_INLINE void jacobianDistortNormalized2x2(const T x, const T y, const T *radialDistortion, const T *tangentialDistortion, T *jx, T *jy)
Determines the 2x2 Jacobian of distorting a normalized image point in a fisheye camera with radial an...
Definition: FisheyeCamera.h:1417
FisheyeCameraT(const FisheyeCameraT< U > &fisheyeCamera)
Copy constructor for a fisheye camera with difference element data type than T.
Definition: FisheyeCamera.h:580
bool hasDistortionParameters_
True, if the distortion parameters are defined.
Definition: FisheyeCamera.h:569
VectorT2< T > tangentialFreeDistortion(const VectorT2< T > &distortedNormalized) const
Calculates the tangential-free distortion of a normalized (distorted) image point.
Definition: FisheyeCamera.h:1366
bool isInside(const VectorT2< T > &imagePoint, const T signedBorder=T(0)) const
Returns whether a given 2D image point lies inside the camera frame.
Definition: FisheyeCamera.h:991
T inverseFocalLengthY() const
Returns the inverse vertical focal length parameter.
Definition: FisheyeCamera.h:858
ParameterConfiguration
Definition of individual parameter configurations.
Definition: FisheyeCamera.h:120
@ PC_12_PARAMETERS
12 parameters with order: horizontal focal length, vertical focal length, horizontal principal point,...
Definition: FisheyeCamera.h:162
@ PC_11_PARAMETERS_ONE_FOCAL_LENGTH
11 parameters with order: focal length (one identical value for horizontal and vertical direction),...
Definition: FisheyeCamera.h:151
@ PC_3_PARAMETERS_ONE_FOCAL_LENGTH
3 parameters with order: focal length (one identical value for horizontal and vertical direction),...
Definition: FisheyeCamera.h:132
@ PC_4_PARAMETERS
4 parameters with order: horizontal focal length, vertical focal length, horizontal principal point,...
Definition: FisheyeCamera.h:141
@ PC_UNKNOWN
An unknown parameter configuration.
Definition: FisheyeCamera.h:124
void pointJacobian2x3IF(const VectorT3< T > &flippedCameraObjectPoint, T *jx, T *jy) const
Calculates the 2x3 jacobian matrix for the 3D object point projection into the camera frame.
Definition: FisheyeCamera.h:1257
T principalPointY() const
Returns the y-value of the principal point of the camera image in the pixel domain.
Definition: FisheyeCamera.h:834
VectorT2< T > projectToImageIF(const VectorT3< T > &cameraFlippedObjectPoint) const
Projects a 3D object point to the 2D image plane of the fisheye camera.
Definition: FisheyeCamera.h:1186
This class implements a 4x4 homogeneous transformation matrix using floating point values with the pr...
Definition: HomogenousMatrix4.h:110
SquareMatrixT3< T > rotationMatrix() const
Returns the rotation matrix of the transformation.
Definition: HomogenousMatrix4.h:1493
VectorT3< T > translation() const
Returns the translation of the transformation.
Definition: HomogenousMatrix4.h:1381
bool isValid() const
Returns whether this matrix is a valid homogeneous transformation.
Definition: HomogenousMatrix4.h:1806
This class implements an infinite line in 3D space.
Definition: Line3.h:70
This class provides basic numeric functionalities.
Definition: Numeric.h:57
static T atan(const T value)
Returns the arctangent of a given value.
Definition: Numeric.h:1616
static T pow(const T x, const T y)
Returns x raised to the power of y.
Definition: Numeric.h:1860
static T abs(const T value)
Returns the absolute value of a given value.
Definition: Numeric.h:1220
static T sqrt(const T value)
Returns the square root of a given value.
Definition: Numeric.h:1533
static constexpr T eps()
Returns a small epsilon.
static bool isEqual(const T first, const T second)
Returns whether two values are equal up to a small epsilon.
Definition: Numeric.h:2386
static T tan(const T value)
Returns the tangent of a given value.
Definition: Numeric.h:1600
static constexpr bool isEqualEps(const T value)
Returns whether a value is smaller than or equal to a small epsilon.
Definition: Numeric.h:2087
This class implements a 2x2 square matrix.
Definition: SquareMatrix2.h:73
bool solve(const VectorT2< T > &b, VectorT2< T > &x) const
Solve a simple 2x2 system of linear equations: Ax = b Beware: The system of linear equations is assum...
Definition: SquareMatrix2.h:766
This class implements a vector with two elements.
Definition: Vector2.h:96
const T & x() const noexcept
Returns the x value.
Definition: Vector2.h:698
const T & y() const noexcept
Returns the y value.
Definition: Vector2.h:710
T sqr() const
Returns the square of the vector length.
Definition: Vector2.h:621
T length() const
Returns the length of the vector.
Definition: Vector2.h:615
This class implements a vector with three elements.
Definition: Vector3.h:97
const T & y() const noexcept
Returns the y value.
Definition: Vector3.h:812
const T & x() const noexcept
Returns the x value.
Definition: Vector3.h:800
VectorT3< T > normalized() const
Returns the normalized vector.
Definition: Vector3.h:605
const T & z() const noexcept
Returns the z value.
Definition: Vector3.h:824
FisheyeCameraT< float > FisheyeCameraF
Definition of a FisheyeCamera object using 'float'' as data type.
Definition: FisheyeCamera.h:38
std::vector< FisheyeCamera > FisheyeCameras
Definition of a vector holding camera objects.
Definition: FisheyeCamera.h:59
FisheyeCameraT< Scalar > FisheyeCamera
Definition of a FisheyeCamera object using Scalar as data type.
Definition: FisheyeCamera.h:24
VectorT3< Scalar > Vector3
Definition of a 3D vector.
Definition: Vector3.h:22
FisheyeCameraT< double > FisheyeCameraD
Definition of a FisheyeCamera object using 'double'' as data type.
Definition: FisheyeCamera.h:45
std::vector< FisheyeCameraT< T > > FisheyeCamerasT
Definition of a typename alias for vectors with FisheyeCameraT objects.
Definition: FisheyeCamera.h:53
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15