This class implements function for stereoscopic geometry.
More...
|
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...
|
|
This class implements function for stereoscopic geometry.
◆ 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
-
pinholeCamera | The pinhole camera profile defining the projection, must be valid |
imagePoints0 | The image points located in the first frame, at least 5 |
imagePoints1 | The image points located in the second frame, each point must have a corresponding image point in the first frame with same index |
randomGenerator | Random generator object |
world_T_camera1 | The resulting camera pose for the second camera, with a default camera pose pointing towards the negative z-space with y-axis upwards |
objectPoints | Optional resulting 3D locations of the object points which are visible in both camera frames (the image points are the projections of these object points) |
validIndices | Optional resulting indices of the given point correspondences which are valid regarding the defined error thresholds |
maxRotationalSqrError | The 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 |
maxArbitrarySqrError | The 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 |
iterations | The number of iterations that will be applied finding a better pose result |
rotationalMotionMinimalValidCorrespondencesPercent | The 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
-
pinholeCamera | The pinhole camera profile defining the projection, must be valid |
flippedCamera0_T_world | The 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_world | The transformation between world and the flipped second camera (a camera pointing towards the positive z-space with y-axis downwards), must be valid |
objectPoints | Accessor providing the 3D object points |
imagePoints0 | Accessor providing the 2D image points for the first camera frame, one image point for each 3D object point |
imagePoints1 | Accessor 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) |
validIndices | Resulting indices of all valid correspondences |
useDistortionParameters | True, to respect the distortion parameters of the given camera during object point projection |
maxSqrError | The maximal square pixel error between a projected 3D object point and a corresponding 2D image point to count as valid, with range [0, infinity) |
onlyFrontObjectPoints | True, to accept only object points lying in front of both camera frames |
totalSqrError | Optional resulting sum of all square pixel errors for all valid point correspondences (for both frames) |
minimalValidCorrespondences | Optional 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
-
TAccessorObjectPoints | The template type of the accessor for the object points |
TAccessorImagePoints0 | The template type of the accessor for the first image points |
TAccessorImagePoints1 | The template type of the accessor for the second image points |
tUseBorderDistortionIfOutside | True, 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: