Ocean
|
This class implements a helper class allowing to check whether a 3D object point projects into the camera image. More...
#include <AnyCamera.h>
Public Member Functions | |
CameraProjectionCheckerT ()=default | |
Default constructor creating an invalid object. | |
CameraProjectionCheckerT (const SharedAnyCameraT< T > &camera, const size_t segmentSteps=10) | |
Creates a new checker object for a specified camera model. | |
bool | projectToImageIF (const HomogenousMatrixT4< T > &flippedCamera_T_world, const VectorT3< T > &objectPoint, VectorT2< T > *imagePoint=nullptr) const |
Returns whether a 3D object point is located in front of the camera and projects into the camera image. | |
const SharedAnyCameraT< T > & | camera () const |
Returns the camera model of this checker. | |
const FiniteLinesT2< T > & | cameraBoundarySegments () const |
Returns the 2D line segments defined in the camera's normalized image plane defining the camera's boundary. | |
bool | isValid () const |
Returns whether this checker holds a valid camera model and is ready to be used. | |
Static Protected Member Functions | |
static bool | determineCameraBoundary (const AnyCameraT< T > &camera, FiniteLinesT2< T > &cameraBoundarySegments, const size_t segmentSteps) |
Determines the camera boundary of a given camera model in normalized image coordinates. | |
static bool | isInside (const FiniteLinesT2< T > &cameraBoundarySegments, const VectorT2< T > &imagePoint) |
Returns whether a given normalized image point lies inside the camera's boundary. | |
Protected Attributes | |
SharedAnyCameraT< T > | camera_ |
The actual camera model this checker is based on. | |
FiniteLinesT2< T > | cameraBoundarySegments_ |
The 2D line segments defined in the camera's normalized image plane defining the camera's boundary. | |
This class implements a helper class allowing to check whether a 3D object point projects into the camera image.
The checker uses normalized coordinates when verifying the projection behavior to avoid numerical issues when object points project far outside the image area.
In contrast to AnyCamera::ptojectToImageIF() + AnyCamera::isInside(), the checker is more precise but also more expensive.
T | The data type of a scalar, 'float' or 'double' |
|
default |
Default constructor creating an invalid object.
|
explicit |
Creates a new checker object for a specified camera model.
camera | The camera model defining the projection, must be valid |
segmentSteps | The number of segments to be used to determine the camera boundary, with range [2, infinity) |
const SharedAnyCameraT< T > & Ocean::CameraProjectionCheckerT< T >::camera | ( | ) | const |
Returns the camera model of this checker.
const FiniteLinesT2< T > & Ocean::CameraProjectionCheckerT< T >::cameraBoundarySegments | ( | ) | const |
Returns the 2D line segments defined in the camera's normalized image plane defining the camera's boundary.
|
staticprotected |
Determines the camera boundary of a given camera model in normalized image coordinates.
camera | The camera model for which the boundary will be determined, must be valid |
cameraBoundarySegments | The resulting 2D line segments defining the camera's boundary |
segmentSteps | The number of segments to be used to determine the camera boundary, with range [1, infinity) |
|
staticprotected |
Returns whether a given normalized image point lies inside the camera's boundary.
cameraBoundarySegments | The 2D line segments defining the camera's boundary, at least three |
imagePoint | The normalized image point to be checked |
bool Ocean::CameraProjectionCheckerT< T >::isValid | ( | ) | const |
Returns whether this checker holds a valid camera model and is ready to be used.
bool Ocean::CameraProjectionCheckerT< T >::projectToImageIF | ( | const HomogenousMatrixT4< T > & | flippedCamera_T_world, |
const VectorT3< T > & | objectPoint, | ||
VectorT2< T > * | imagePoint = nullptr |
||
) | const |
Returns whether a 3D object point is located in front of the camera and projects into the camera image.
flippedCamera_T_world | The inverted and flipped camera pose, the default flipped camera is looking into the positive z-space with y-axis down, transforming world to flipped camera, must be valid |
objectPoint | The 3D object point to be checked, defined in world |
imagePoint | Optional resulting 2D projected image point inside the camera image, nullptr if not of interest |
|
protected |
The actual camera model this checker is based on.
|
protected |
The 2D line segments defined in the camera's normalized image plane defining the camera's boundary.