libcamera v0.7.0+1-4ceceb68
Supporting cameras in Linux since 2019
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
libcamera::Dw100VertexMap Class Reference

Helper class to compute dw100 vertex maps. More...

Public Types

enum  ScaleMode { Fill = 0 , Crop = 1 }
 The scale modes available for a vertex map. More...
 

Public Member Functions

void applyLimits ()
 Apply limits on scale and offset.
 
void setInputSize (const Size &size)
 Set the size of the input data.
 
void setSensorCrop (const Rectangle &rect)
 Set the crop rectangle that represents the input data.
 
void setScalerCrop (const Rectangle &rect)
 Set the requested scaler crop.
 
const RectangleeffectiveScalerCrop () const
 Get the effective scaler crop.
 
void setOutputSize (const Size &size)
 Set the output size.
 
const SizeoutputSize () const
 Get the output size.
 
void setTransform (const Transform &transform)
 Sets the transform to apply.
 
const Transformtransform () const
 Get the transform.
 
void setScale (const float scale)
 Sets the scale to apply.
 
float effectiveScale () const
 Get the effective scale.
 
void setRotation (const float rotation)
 Sets the rotation to apply.
 
float rotation () const
 Get the rotation.
 
void setOffset (const Point &offset)
 Sets the offset to apply.
 
const PointeffectiveOffset () const
 Get the effective offset.
 
void setMode (const ScaleMode mode)
 Sets the scaling mode to apply.
 
ScaleMode mode () const
 Get the scaling mode.
 
int setDewarpParams (const Matrix< double, 3, 3 > &cm, const Span< const double > &coeffs)
 Set the dewarp parameters.
 
bool dewarpParamsValid ()
 Returns if the dewarp parameters are valid.
 
void setLensDewarpEnable (bool enable)
 Enables or disables lens dewarping.
 
bool lensDewarpEnable ()
 Returns if lens dewarping is enabled.
 
std::vector< uint32_t > getVertexMap ()
 Get the dw100 vertex map.
 

Detailed Description

Helper class to compute dw100 vertex maps.

The vertex map class represents a helper for handling dewarper vertex maps. There are 3 important sizes in the system:

+---------------------—+ |Sensor size | | +-------------—+ | | | Input rect | | | | +----------—+ | | | | ScalerCrop | | | | | | | | +–+----------—+ | +---------------------—+

This class implements a vertex map that forms the following pipeline:

+----------—+ +----------—+ +---------—+ +--------------—+ | | | | | Transform | | Pan/Zoom | | Lens Dewarp | -> | Scaler Crop | -> | (H/V Flip, | -> | (Offset, Scale, | | | | | | Transpose) | | Rotate) | +----------—+ +----------—+ +---------—+ +--------------—+

All parameters are clamped to valid values before creating the vertex map.

The constraints process works as follows:

After applying the limits, the actual values used for processing are stored effectiveXXX members and can be queried using the corresponding functions.

The lens dewarp map is usually calibrated during tuning and is a map that maps from incoming pixels to dewarped pixels.

Member Enumeration Documentation

◆ ScaleMode

The scale modes available for a vertex map.

Enumerator
Fill 

Scale the input to fill the output.

This scale mode does not preserve aspect ratio. Offset and rotation are taken into account.

Crop 

Crop the input.

This scale mode preserves the aspect ratio. Offset, scale, rotation are taken into account within the possible limits.

Member Function Documentation

◆ applyLimits()

void libcamera::Dw100VertexMap::applyLimits ( )

Apply limits on scale and offset.

This function calculates effectiveScalerCrop_, effectiveScale_ and effectiveOffset_ based on the requested scaler crop, scale, rotation, offset and the selected scale mode, so that the whole output area is filled with valid input data.

◆ dewarpParamsValid()

libcamera::Dw100VertexMap::dewarpParamsValid ( )
inline

Returns if the dewarp parameters are valid.

Returns
True if the dewarp parameters are valid, false otherwise

◆ effectiveOffset()

libcamera::Dw100VertexMap::effectiveOffset ( ) const
inline

Get the effective offset.

Returns the actual offset applied to the input pixels in ScalerCrop coordinates.

Returns
The effective offset

◆ effectiveScale()

libcamera::Dw100VertexMap::effectiveScale ( ) const
inline

Get the effective scale.

Returns the actual scale applied to the input pixels in x and y direction. So a value of [2.0, 1.5] means that every input pixel is scaled to cover 2 output pixels in x-direction and 1.5 in y-direction.

Returns
The effective scale

◆ effectiveScalerCrop()

libcamera::Dw100VertexMap::effectiveScalerCrop ( ) const
inline

Get the effective scaler crop.

Returns
The effective scaler crop

◆ getVertexMap()

std::vector< uint32_t > libcamera::Dw100VertexMap::getVertexMap ( )

Get the dw100 vertex map.

Calculates the vertex map as a vector of hardware specific entries.

Returns
The vertex map

◆ mode()

libcamera::Dw100VertexMap::mode ( ) const
inline

Get the scaling mode.

Returns
The scaling mode

◆ outputSize()

libcamera::Dw100VertexMap::outputSize ( ) const
inline

Get the output size.

Returns
The output size

◆ rotation()

libcamera::Dw100VertexMap::rotation ( ) const
inline

Get the rotation.

Returns
The rotation in degrees

◆ setDewarpParams()

int libcamera::Dw100VertexMap::setDewarpParams ( const Matrix< double, 3, 3 > &  cm,
const Span< const double > &  coeffs 
)

Set the dewarp parameters.

Parameters
cmThe camera matrix
coeffsThe dewarp coefficients

Sets the dewarp parameters according to the commonly used dewarp model. See https://docs.opencv.org/4.12.0/d9/d0c/group__calib3d.html for further details on the model. The parameter coeffs must either hold 4,5,8 or 12 values. They represent the parameters k1,k2,p1,p2[,k3[,k4,k5,k6[,s1,s2,s3,s4]]] in the model.

Returns
A negative number on error, 0 otherwise

◆ setInputSize()

libcamera::Dw100VertexMap::setInputSize ( const Size size)
inline

Set the size of the input data.

Parameters
[in]sizeThe input size

To calculate a proper vertex map, the size of the input images must be set.

◆ setLensDewarpEnable()

libcamera::Dw100VertexMap::setLensDewarpEnable ( bool  enable)
inline

Enables or disables lens dewarping.

Parameters
[in]enableEnable or disable lens dewarping

◆ setMode()

libcamera::Dw100VertexMap::setMode ( const ScaleMode  mode)
inline

Sets the scaling mode to apply.

Parameters
[in]modeThe mode

◆ setOffset()

libcamera::Dw100VertexMap::setOffset ( const Point offset)
inline

Sets the offset to apply.

Parameters
[in]offsetThe offset

Set the requested offset. The actually applied offset can be queried using Dw100VertexMap::effectiveOffset() after calling Dw100VertexMap::applyLimits().

◆ setOutputSize()

libcamera::Dw100VertexMap::setOutputSize ( const Size size)
inline

Set the output size.

Parameters
[in]sizeThe size of the output images

◆ setRotation()

libcamera::Dw100VertexMap::setRotation ( const float  rotation)
inline

Sets the rotation to apply.

Parameters
[in]rotationThe rotation in degrees

The rotation is in clockwise direction to allow the same transform as CameraConfiguration::orientation

◆ setScale()

libcamera::Dw100VertexMap::setScale ( const float  scale)
inline

Sets the scale to apply.

Parameters
[in]scaleThe scale

Set the requested scale. The actually applied scale can be queried using Dw100VertexMap::effectiveScale() after calling Dw100VertexMap::applyLimits().

◆ setScalerCrop()

libcamera::Dw100VertexMap::setScalerCrop ( const Rectangle rect)
inline

Set the requested scaler crop.

Parameters
[in]rect

Set the requested scaler crop. The actually applied scaler crop can be queried using Dw100VertexMap::effectiveScalerCrop() after calling Dw100VertexMap::applyLimits().

◆ setSensorCrop()

libcamera::Dw100VertexMap::setSensorCrop ( const Rectangle rect)
inline

Set the crop rectangle that represents the input data.

Parameters
[in]rect

Set the rectangle that represents the input data in sensor coordinates. This must be specified to properly calculate the vertex map.

◆ setTransform()

libcamera::Dw100VertexMap::setTransform ( const Transform transform)
inline

Sets the transform to apply.

Parameters
[in]transformThe transform

◆ transform()

libcamera::Dw100VertexMap::transform ( ) const
inline

Get the transform.

Returns
The transform

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