|
Ocean
|
This class implements a helper class allowing to check whether a 3D object point projects into the camera image (i.e., clipping against the camera's field of view). More...
#include <AnyCamera.h>
Public Member Functions | |
| AnyCameraClipperT ()=default | |
| Default constructor creating an invalid object. | |
| AnyCameraClipperT (const SharedAnyCameraT< T > &camera, const size_t segmentSteps=10) | |
| Creates a new clipper 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 clipper. | |
| unsigned int | width () const |
| Returns the width of the camera profile. | |
| unsigned int | height () const |
| Returns the height of the camera profile. | |
| void | update (const SharedAnyCameraT< T > &camera, const size_t segmentSteps=10) |
| Updates the clipper with a new camera model. | |
| 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 clipper 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 > &normalizedImagePoint) |
| Returns whether a given normalized image point lies inside the camera's boundary. | |
| static bool | isValidForPoint (const AnyCameraT< T > &camera, const VectorT2< T > &imagePoint, const T maximalReprojectionError=T(1), const unsigned int additionalChecksTowardsPrincipalPoint=3u) |
| Returns whether a given camera model is valid for a specified 2D image point in the camera image. | |
Protected Attributes | |
| SharedAnyCameraT< T > | camera_ |
| The actual camera model this clipper is based on. | |
| FiniteLinesT2< T > | cameraBoundarySegments_ |
| The 2D line segments defined in the camera's normalized image plane defining the camera's boundary, defined in the flipped camera coordinate system with y-axis down. | |
This class implements a helper class allowing to check whether a 3D object point projects into the camera image (i.e., clipping against the camera's field of view).
The clipper 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::projectToImageIF() + AnyCamera::isInside(), the clipper 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 clipper 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::AnyCameraClipperT< T >::camera | ( | ) | const |
Returns the camera model of this clipper.
| const FiniteLinesT2< T > & Ocean::AnyCameraClipperT< 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) |
|
inline |
Returns the height of the camera profile.
|
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 |
| normalizedImagePoint | The normalized image point to be checked |
| bool Ocean::AnyCameraClipperT< T >::isValid | ( | ) | const |
Returns whether this clipper holds a valid camera model and is ready to be used.
|
staticprotected |
Returns whether a given camera model is valid for a specified 2D image point in the camera image.
The function does not only check whether the provided image point re-projects back to the same image point but also whether additional image points sampled towards the principal point have the same behavior.
| camera | The camera model to be checked, must be valid |
| imagePoint | The 2D image point to be checked, defined in the camera image, with range [0, width()]x[0, height()] |
| maximalReprojectionError | The maximal allowed re-projection error in pixel, with range [0, infinity) |
| additionalChecksTowardsPrincipalPoint | The number of additional image points sampled towards the principal point to be checked, with range [1, infinity) |
| bool Ocean::AnyCameraClipperT< 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 |
| void Ocean::AnyCameraClipperT< T >::update | ( | const SharedAnyCameraT< T > & | camera, |
| const size_t | segmentSteps = 10 |
||
| ) |
Updates the clipper with a new camera model.
If the new camera is equal to the current camera, the function will return immediately without any updates.
| 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 [1, infinity) |
|
inline |
Returns the width of the camera profile.
|
protected |
The actual camera model this clipper is based on.
|
protected |
The 2D line segments defined in the camera's normalized image plane defining the camera's boundary, defined in the flipped camera coordinate system with y-axis down.