Ocean
Ocean::Geometry::StereoscopicGeometry Class Reference

This class implements function for stereoscopic geometry. More...

Static Public Member Functions

static bool cameraPose (const PinholeCamera &pinholeCamera, const ConstIndexedAccessor< Vector2 > &imagePoints0, const ConstIndexedAccessor< Vector2 > &imagePoints1, RandomGenerator &randomGenerator, HomogenousMatrix4 &world_T_camera1, Vectors3 *objectPoints=nullptr, Indices32 *validIndices=nullptr, const Scalar maxRotationalSqrError=Scalar(1.5 *1.5), const Scalar maxArbitrarySqrError=Scalar(3.5 *3.5), const unsigned int iterations=100u, const Scalar rotationalMotionMinimalValidCorrespondencesPercent=Scalar(0.9))
 Determines the pose transformation between two given camera frames from which corresponding image point pairs are given. More...
 
template<typename TAccessorObjectPoints , typename TAccessorImagePoints0 , typename TAccessorImagePoints1 , bool tUseBorderDistortionIfOutside>
static bool determineValidCorrespondencesIF (const PinholeCamera &pinholeCamera, const HomogenousMatrix4 &flippedCamera0_T_world, const HomogenousMatrix4 &flippedCamera1_T_world, const TAccessorObjectPoints &objectPoints, const TAccessorImagePoints0 &imagePoints0, const TAccessorImagePoints1 &imagePoints1, Indices32 &validIndices, const bool useDistortionParameters, const Scalar maxSqrError=Scalar(3.5 *3.5), const bool onlyFrontObjectPoints=true, Scalar *totalSqrError=nullptr, const size_t minimalValidCorrespondences=0)
 Determines valid correspondences between 2D image points and 3D camera points for two individual camera frames concurrently. More...
 

Detailed Description

This class implements function for stereoscopic geometry.

Member Function Documentation

◆ cameraPose()

static bool Ocean::Geometry::StereoscopicGeometry::cameraPose ( const PinholeCamera pinholeCamera,
const ConstIndexedAccessor< Vector2 > &  imagePoints0,
const ConstIndexedAccessor< Vector2 > &  imagePoints1,
RandomGenerator randomGenerator,
HomogenousMatrix4 world_T_camera1,
Vectors3 objectPoints = nullptr,
Indices32 validIndices = nullptr,
const Scalar  maxRotationalSqrError = Scalar(1.5 *1.5),
const Scalar  maxArbitrarySqrError = Scalar(3.5 *3.5),
const unsigned int  iterations = 100u,
const Scalar  rotationalMotionMinimalValidCorrespondencesPercent = Scalar(0.9) 
)
static

Determines the pose transformation between two given camera frames from which corresponding image point pairs are given.

For each image point in the first frame a corresponding image point in the second frame must be provided.
Further, this function determines the 3D object points which belong to the given image points.
The first camera pose is expected to be the identity camera pose (a default camera in the origin, pointing towards the negative z-space with y-axis upwards.
The function can support outliers in the given point correspondences (to some extend).

Parameters
pinholeCameraThe pinhole camera profile defining the projection, must be valid
imagePoints0The image points located in the first frame, at least 5
imagePoints1The image points located in the second frame, each point must have a corresponding image point in the first frame with same index
randomGeneratorRandom generator object
world_T_camera1The resulting camera pose for the second camera, with a default camera pose pointing towards the negative z-space with y-axis upwards
objectPointsOptional resulting 3D locations of the object points which are visible in both camera frames (the image points are the projections of these object points)
validIndicesOptional resulting indices of the given point correspondences which are valid regarding the defined error thresholds
maxRotationalSqrErrorThe maximal squared pixel error between a projected object point and a corresponding image point so that the pair counts as valid for rotational camera motion
maxArbitrarySqrErrorThe maximal squared pixel error between a projected object point and a corresponding image point so that the pair counts as valid for arbitrary camera motion
iterationsThe number of iterations that will be applied finding a better pose result
rotationalMotionMinimalValidCorrespondencesPercentThe minimal number of valid correspondences (defined as percent of the entire number of correspondences) that are necessary so that the camera motion is accepted to be pure rotational, with range [0, 1]
Returns
True, if succeeded

◆ determineValidCorrespondencesIF()

template<typename TAccessorObjectPoints , typename TAccessorImagePoints0 , typename TAccessorImagePoints1 , bool tUseBorderDistortionIfOutside>
bool Ocean::Geometry::StereoscopicGeometry::determineValidCorrespondencesIF ( const PinholeCamera pinholeCamera,
const HomogenousMatrix4 flippedCamera0_T_world,
const HomogenousMatrix4 flippedCamera1_T_world,
const TAccessorObjectPoints &  objectPoints,
const TAccessorImagePoints0 &  imagePoints0,
const TAccessorImagePoints1 &  imagePoints1,
Indices32 validIndices,
const bool  useDistortionParameters,
const Scalar  maxSqrError = Scalar(3.5 * 3.5),
const bool  onlyFrontObjectPoints = true,
Scalar totalSqrError = nullptr,
const size_t  minimalValidCorrespondences = 0 
)
static

Determines valid correspondences between 2D image points and 3D camera points for two individual camera frames concurrently.

Beware: The given camera matrices are not equal to a extrinsic matrix.
Instead, the camera matrices are the extrinsic camera matrix flipped around the x-axis and inverted afterwards.

Parameters
pinholeCameraThe pinhole camera profile defining the projection, must be valid
flippedCamera0_T_worldThe transformation between world and the flipped first camera (a camera pointing towards the positive z-space with y-axis downwards), must be valid
flippedCamera1_T_worldThe transformation between world and the flipped second camera (a camera pointing towards the positive z-space with y-axis downwards), must be valid
objectPointsAccessor providing the 3D object points
imagePoints0Accessor providing the 2D image points for the first camera frame, one image point for each 3D object point
imagePoints1Accessor providing the 2D image points for the second camera frame, on image point for each image point in the first frame (and for each 3D object point)
validIndicesResulting indices of all valid correspondences
useDistortionParametersTrue, to respect the distortion parameters of the given camera during object point projection
maxSqrErrorThe maximal square pixel error between a projected 3D object point and a corresponding 2D image point to count as valid, with range [0, infinity)
onlyFrontObjectPointsTrue, to accept only object points lying in front of both camera frames
totalSqrErrorOptional resulting sum of all square pixel errors for all valid point correspondences (for both frames)
minimalValidCorrespondencesOptional number of valid correspondences that must be reached, otherwise the function stops without providing a useful result, with range [0, objectPoints.size()]
Returns
True, if succeeded; False, if the function stops due to the defined minimal number of thresholds
Template Parameters
TAccessorObjectPointsThe template type of the accessor for the object points
TAccessorImagePoints0The template type of the accessor for the first image points
TAccessorImagePoints1The template type of the accessor for the second image points
tUseBorderDistortionIfOutsideTrue, to apply the camera distortion from the nearest point lying on the frame border if the point lies outside the visible camera area; False, to apply the distortion from the given position

The documentation for this class was generated from the following file: