Ocean
Loading...
Searching...
No Matches
Ocean::CameraProjectionCheckerT< T > Class Template Reference

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.
 

Detailed Description

template<typename T>
class Ocean::CameraProjectionCheckerT< T >

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.

Template Parameters
TThe data type of a scalar, 'float' or 'double'

Constructor & Destructor Documentation

◆ CameraProjectionCheckerT() [1/2]

template<typename T >
Ocean::CameraProjectionCheckerT< T >::CameraProjectionCheckerT ( )
default

Default constructor creating an invalid object.

◆ CameraProjectionCheckerT() [2/2]

template<typename T >
Ocean::CameraProjectionCheckerT< T >::CameraProjectionCheckerT ( const SharedAnyCameraT< T > &  camera,
const size_t  segmentSteps = 10 
)
explicit

Creates a new checker object for a specified camera model.

Parameters
cameraThe camera model defining the projection, must be valid
segmentStepsThe number of segments to be used to determine the camera boundary, with range [2, infinity)

Member Function Documentation

◆ camera()

template<typename T >
const SharedAnyCameraT< T > & Ocean::CameraProjectionCheckerT< T >::camera ( ) const

Returns the camera model of this checker.

Returns
The checker's camera model, nullptr if no camera model has been set

◆ cameraBoundarySegments()

template<typename T >
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.

Returns
The camera boundary segments

◆ determineCameraBoundary()

template<typename T >
bool Ocean::CameraProjectionCheckerT< T >::determineCameraBoundary ( const AnyCameraT< T > &  camera,
FiniteLinesT2< T > &  cameraBoundarySegments,
const size_t  segmentSteps 
)
staticprotected

Determines the camera boundary of a given camera model in normalized image coordinates.

Parameters
cameraThe camera model for which the boundary will be determined, must be valid
cameraBoundarySegmentsThe resulting 2D line segments defining the camera's boundary
segmentStepsThe number of segments to be used to determine the camera boundary, with range [1, infinity)
Returns
True, if succeeded

◆ isInside()

template<typename T >
bool Ocean::CameraProjectionCheckerT< T >::isInside ( const FiniteLinesT2< T > &  cameraBoundarySegments,
const VectorT2< T > &  imagePoint 
)
staticprotected

Returns whether a given normalized image point lies inside the camera's boundary.

Parameters
cameraBoundarySegmentsThe 2D line segments defining the camera's boundary, at least three
imagePointThe normalized image point to be checked
Returns
True, if if so

◆ isValid()

template<typename T >
bool Ocean::CameraProjectionCheckerT< T >::isValid ( ) const

Returns whether this checker holds a valid camera model and is ready to be used.

Returns
True, if so

◆ projectToImageIF()

template<typename T >
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.

Parameters
flippedCamera_T_worldThe 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
objectPointThe 3D object point to be checked, defined in world
imagePointOptional resulting 2D projected image point inside the camera image, nullptr if not of interest
Returns
True, if the object point projects into the camera image; False, if the object point is behind the camera or projects outside the camera image

Field Documentation

◆ camera_

template<typename T >
SharedAnyCameraT<T> Ocean::CameraProjectionCheckerT< T >::camera_
protected

The actual camera model this checker is based on.

◆ cameraBoundarySegments_

template<typename T >
FiniteLinesT2<T> Ocean::CameraProjectionCheckerT< T >::cameraBoundarySegments_
protected

The 2D line segments defined in the camera's normalized image plane defining the camera's boundary.


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