8 #ifndef META_OCEAN_TEST_TESTGEOMETRY_TEST_JACOBIAN_H
9 #define META_OCEAN_TEST_TESTGEOMETRY_TEST_JACOBIAN_H
24 namespace TestGeometry
40 static bool test(
const double testDuration);
156 template <
typename T>
249 template <
typename T>
265 template <
typename T,
typename TDerivative>
266 static inline bool checkAccuracy(
const VectorT2<T>& original,
const VectorT2<T>& offset,
const T eps,
const TDerivative derivativeX,
const TDerivative derivativeY);
279 template <
typename T,
typename TDerivative>
280 static inline bool checkAccuracy(
const VectorT3<T>& original,
const VectorT3<T>& offset,
const T eps,
const TDerivative derivativeX,
const TDerivative derivativeY,
const TDerivative derivativeZ);
296 template <
bool tUseBorderDistortionIfOuts
ide>
303 static constexpr
double successThreshold();
306 template <
typename T,
typename TDerivative>
309 static_assert(
sizeof(TDerivative) <=
sizeof(T),
"The derivative should not have more precision than epsilon");
316 const T calculatedDerivativeX = (offset.
x() - original.
x()) / eps;
317 const T calculatedDerivativeY = (offset.
y() - original.
y()) / eps;
358 template <
typename T,
typename TDerivative>
361 static_assert(
sizeof(TDerivative) <=
sizeof(T),
"The derivative should not have more precision than epsilon");
368 const T calculatedDerivativeX = (offset.
x() - original.
x()) / eps;
369 const T calculatedDerivativeY = (offset.
y() - original.
y()) / eps;
370 const T calculatedDerivativeZ = (offset.
z() - original.
z()) / eps;
428 template <
bool tUseBorderDistortionIfOuts
ide>
431 ocean_assert(jx !=
nullptr && jy !=
nullptr);
432 ocean_assert(flippedCamera_T_world.
isValid());
441 const Vector2 imagePoint(pinholeCamera.
projectToImageIF<tUseBorderDistortionIfOutside>(flippedCamera_T_world, objectPoint, distortImagePoint));
443 for (
unsigned int n = 0u; n < 3u; ++n)
445 Vector3 dObjectPoint(objectPoint);
447 dObjectPoint[n] += eps;
449 const Vector2 dImagePoint(pinholeCamera.
projectToImageIF<tUseBorderDistortionIfOutside>(flippedCamera_T_world, dObjectPoint, distortImagePoint));
451 const Scalar dx = (dImagePoint.
x() - imagePoint.
x()) / eps;
452 const Scalar dy = (dImagePoint.
y() - imagePoint.
y()) / eps;
This class implements function to calculate the jacobian matrices for geometry functions.
Definition: Jacobian.h:37
bool isValid() const
Returns whether this matrix is a valid homogeneous transformation.
Definition: HomogenousMatrix4.h:1806
This class provides basic numeric functionalities.
Definition: Numeric.h:57
static constexpr T weakEps()
Returns a weak epsilon.
static T abs(const T value)
Returns the absolute value of a given value.
Definition: Numeric.h:1220
VectorT2< T > projectToImageIF(const HomogenousMatrixT4< T > &flippedCamera_T_world, const VectorT3< T > &objectPoint, const bool distortImagePoint, const T zoom=T(1)) const
Projects a 3D object point to the 2D image plane of the camera by a given inverse camera pose.
Definition: PinholeCamera.h:1816
This class implements Jacobian tests.
Definition: TestJacobian.h:32
static bool testOrientationCameraJacobian2x11(const double testDuration)
Tests the Jacobian for the rotational part of the extrinsic camera matrix, intrinsic and radial and t...
static bool testIdentityHomography2x8(const double testDuration)
Tests the 2x8 Jacobian for the identity homography.
static bool testSphericalObjectPointOrientation2x3IF(const double testDuration)
Tests the Jacobian for an exponential map representing a 3D object point which is projected into the ...
static bool checkAccuracy(const VectorT2< T > &original, const VectorT2< T > &offset, const T eps, const TDerivative derivativeX, const TDerivative derivativeY)
Determines the derivative for a given 2D position and compares the accuracy with the precise derivati...
Definition: TestJacobian.h:307
static bool testPinholeCameraObjectTransformation2nx6(const double testDuration)
Tests the 2x6 Jacobian for a 6-DOF transformation with fixed camera pose.
static void calculatePointJacobian2x3(Scalar *jx, Scalar *jy, const PinholeCamera &pinholeCamera, const HomogenousMatrix4 &flippedCamera_T_world, const Vector3 &objectPoint, const bool distortImagePoint)
Calculates the two Jacobian rows for a given pose and dynamic object point.
Definition: TestJacobian.h:429
static bool testPosesPointsJacobian2nx12(const double testDuration)
Tests the Jacobian for two 6DOF poses and a set of 3D object points.
static bool testAnyCameraPoseJacobian2nx6(const double testDuration)
Tests the Jacobian for the extrinsic camera parameters and any camera.
static bool testFisheyeCameraPointJacobian2x3(const double testDuration)
Tests the Jacobian for an 2D image point projection in relation to an object point using a fisheye ca...
static bool testCalculateFisheyeDistortNormalized2x2(const double testDuration)
Tests the 2x2 Jacobian of the distortion of a normalized image point for a fisheye camera.
static bool testHomography2x9(const double testDuration)
Tests the 2x9 Jacobian for the homography.
static bool testPoseZoomJacobian2nx7(const double testDuration)
Tests the Jacobian for the extrinsic camera parameters (including the zoom parameter).
static bool testSphericalObjectPoint3x3(const double testDuration)
Tests the Jacobian for an exponential map representing a 3D object point.
static bool testHomography2x8(const double testDuration)
Tests the 2x8 Jacobian for the homography.
static bool testAnyCameraPointJacobian2x3(const double testDuration)
Tests the Jacobian for an 2D image point projection in relation to an object point using any camera.
static bool testSimilarity2x4(const double testDuration)
Tests the 2x4 Jacobian of a similarity transformation.
static bool test(const double testDuration)
Tests the entire Jacobian functionality.
static bool testCameraJacobian2x8(const double testDuration)
Tests the Jacobian for the intrinsic and radial and tangential distortion camera parameters.
static bool testFisheyeCameraObjectTransformation2nx6(const double testDuration)
Tests the 2x6 Jacobian for a 6-DOF transformation with fixed camera pose.
static bool testCameraJacobian2x6(const double testDuration)
Tests the Jacobian for the intrinsic and radial distortion camera parameters.
static bool testOrientationJacobian2nx3(const double testDuration)
Tests the Jacobian for the orientation of a camera.
static bool testPoseCameraJacobian2x12(const double testDuration)
Tests the Jacobian for the extrinsic, intrinsic and radial camera parameters.
static bool testPinholeCameraPointJacobian2nx3(const double testDuration)
Tests the Jacobian for an 2D image point projection in relation to an object point using a pinhole ca...
static bool testPoseCameraJacobian2x14(const double testDuration)
Tests the Jacobian for the extrinsic, intrinsic and radial and tangential distortion camera parameter...
static bool testIdentityHomography2x9(const double testDuration)
Tests the 2x9 Jacobian for the identity homography.
static bool testCameraJacobian2x7(const double testDuration)
Tests the Jacobian for the intrinsic and radial and tangential distortion camera parameters.
static bool testFisheyeCameraPoseJacobian2x6(const double testDuration)
Deprecated.
static bool testOrientationalJacobian2x3(const double testDuration)
Tests the Jacobian for the rotational part of extrinsic camera parameters.
static bool testPinholeCameraPoseJacobian2nx6(const double testDuration)
Deprecated.
static constexpr double successThreshold()
Returns the minimal threshold necessary to succeed a verification.
Definition: TestJacobian.h:459
static bool testPoseJacobianDampedDistortion2nx6(const double testDuration)
Tests the Jacobian for the extrinsic camera parameters using a damped distortion.
static bool testCameraDistortionJacobian2x4(const double testDuration)
Tests the Jacobian for the radial and tangential distortion camera parameters.
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
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
const T & z() const noexcept
Returns the z value.
Definition: Vector3.h:824
float Scalar
Definition of a scalar type.
Definition: Math.h:128
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15