|
libcamera v0.7.0+1-4ceceb68
Supporting cameras in Linux since 2019
|
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 Rectangle & | effectiveScalerCrop () const |
| Get the effective scaler crop. | |
| void | setOutputSize (const Size &size) |
| Set the output size. | |
| const Size & | outputSize () const |
| Get the output size. | |
| void | setTransform (const Transform &transform) |
| Sets the transform to apply. | |
| const Transform & | transform () 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 Point & | effectiveOffset () 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. | |
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.
The scale modes available for a vertex map.
| 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.
|
inline |
Returns if the dewarp parameters are valid.
|
inline |
Get the effective offset.
Returns the actual offset applied to the input pixels in ScalerCrop coordinates.
|
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.
|
inline |
Get the effective scaler crop.
| std::vector< uint32_t > libcamera::Dw100VertexMap::getVertexMap | ( | ) |
Get the dw100 vertex map.
Calculates the vertex map as a vector of hardware specific entries.
|
inline |
Get the scaling mode.
|
inline |
Get the output size.
|
inline |
Get the rotation.
| int libcamera::Dw100VertexMap::setDewarpParams | ( | const Matrix< double, 3, 3 > & | cm, |
| const Span< const double > & | coeffs | ||
| ) |
Set the dewarp parameters.
| cm | The camera matrix |
| coeffs | The 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.
|
inline |
Set the size of the input data.
| [in] | size | The input size |
To calculate a proper vertex map, the size of the input images must be set.
|
inline |
Enables or disables lens dewarping.
| [in] | enable | Enable or disable lens dewarping |
|
inline |
Sets the scaling mode to apply.
| [in] | mode | The mode |
|
inline |
Sets the offset to apply.
| [in] | offset | The offset |
Set the requested offset. The actually applied offset can be queried using Dw100VertexMap::effectiveOffset() after calling Dw100VertexMap::applyLimits().
|
inline |
Set the output size.
| [in] | size | The size of the output images |
|
inline |
Sets the rotation to apply.
| [in] | rotation | The rotation in degrees |
The rotation is in clockwise direction to allow the same transform as CameraConfiguration::orientation
|
inline |
Sets the scale to apply.
| [in] | scale | The scale |
Set the requested scale. The actually applied scale can be queried using Dw100VertexMap::effectiveScale() after calling Dw100VertexMap::applyLimits().
|
inline |
Set the requested scaler crop.
| [in] | rect |
Set the requested scaler crop. The actually applied scaler crop can be queried using Dw100VertexMap::effectiveScalerCrop() after calling Dw100VertexMap::applyLimits().
|
inline |
Set the crop rectangle that represents the input data.
| [in] | rect |
Set the rectangle that represents the input data in sensor coordinates. This must be specified to properly calculate the vertex map.
|
inline |
Sets the transform to apply.
| [in] | transform | The transform |
|
inline |
Get the transform.