CVB++ 15.0
Loading...
Searching...
No Matches
metric_aqs12.hpp
1#pragma once
2
3#include "../calibrator_3d.hpp"
4
5#include "metric.hpp"
6#include "_decl/decl_metric_calibration_configuration.hpp"
7#include "_decl/decl_metric_segmentor_dense_point_cloud_aqs12.hpp"
8#include "_decl/decl_metric_segmentor_range_map_aqs12.hpp"
9#include "_detail/detail_metric_segmentor.hpp"
10
11namespace Cvb
12{
13 CVB_BEGIN_INLINE_NS
14
15 namespace Foundation
16 {
17 namespace Metric
18 {
19 using AQS12DensePointCloudSegmentorPtr = std::shared_ptr<AQS12DensePointCloudSegmentor>;
20 using AQS12RangeMapSegmentorPtr = std::shared_ptr<AQS12RangeMapSegmentor>;
21
23
27
28 } // namespace Metric
29 } // namespace Foundation
30
31 namespace Foundation
32 {
33 namespace Metric
34 {
37
54 const AQS12RangeMapSegmentor &segmentor,
55 const CalibrationConfiguration &config)
56 {
59 Internal::DoResCallShareOut<Calibrator3D>([&](void *&handle) {
60 return CVB_CALL_CAPI(CVMAQS12CreateIntrinsicCalibratorFromPiece(
61 imagePlane.Handle(), 0, segmentor.Handle(), config.Handle(), handle,
62 reinterpret_cast<CExports::CVC3DPointD *>(result.second.data())));
63 }));
64
65 return result;
66 }
67
70
88 const AQS12RangeMapSegmentor &segmentor,
89 const CalibrationConfiguration &config, Rect<int> aoi)
90 {
91
94 Internal::DoResCallShareOut<Calibrator3D>([&](void *&handle) {
95 return CVB_CALL_CAPI(CVMAQS12CreateIntrinsicCalibratorFromPieceRect(
96 imagePlane.Handle(), 0, aoi.Left(), aoi.Top(), aoi.Right(), aoi.Bottom(), segmentor.Handle(),
97 config.Handle(), handle, reinterpret_cast<CExports::CVC3DPointD *>(result.second.data())));
98 }));
99
100 return result;
101 }
102
105
124 const AQS12DensePointCloudSegmentor &segmentor,
125 const CalibrationConfiguration &config)
126 {
127 AffineMatrix3D trafo;
129 std::vector<Point3D<double>> residuals(12);
130
131 Internal::DoResCall([&]() {
132 return CVB_CALL_CAPI(CVMAQS12CalculateCorrectionOfLaserPlaneInclinationWithParamsFromPiece(
133 cloud.Handle(), segmentor.Handle(), config.Handle(),
134 *reinterpret_cast<CExports::CVC3DTransformation *>(&trafo),
135 *reinterpret_cast<CExports::CVC3DAffineTransformationParameters *>(&trafoPara),
136 reinterpret_cast<CExports::CVC3DPointD *>(residuals.data())));
137 });
138
139 // move transformation parameters if valid (in case of SpecificTransformationParameters)
140 if (!std::isnan(trafoPara.InclinationX))
141 return std::make_tuple(std::move(trafo), std::move(residuals), std::move(trafoPara));
142
143 return std::make_tuple(std::move(trafo), std::move(residuals), Cvb::optional<AffineTransformationParameters>{});
144 }
145
148
172 const AQS12DensePointCloudSegmentor &segmentor,
173 const CalibrationConfiguration &config, Rect<int> aoi)
174 {
175 AffineMatrix3D trafo;
177 std::vector<Point3D<double>> residuals(12);
178
179 Internal::DoResCall([&]() {
180 return CVB_CALL_CAPI(CVMAQS12CalculateCorrectionOfLaserPlaneInclinationWithParamsFromPieceRect(
181 cloud.Handle(), aoi.Left(), aoi.Top(), aoi.Right(), aoi.Bottom(), segmentor.Handle(), config.Handle(),
182 *reinterpret_cast<CExports::CVC3DTransformation *>(&trafo),
183 *reinterpret_cast<CExports::CVC3DAffineTransformationParameters *>(&trafoPara),
184 reinterpret_cast<CExports::CVC3DPointD *>(residuals.data())));
185 });
186
187 // move transformation parameters if valid (in case of SpecificTransformationParameters)
188 if (!std::isnan(trafoPara.InclinationX))
189 return std::make_tuple(std::move(trafo), std::move(residuals), std::move(trafoPara));
190
191 return std::make_tuple(std::move(trafo), std::move(residuals), Cvb::optional<AffineTransformationParameters>{});
192 }
193
196
206 const DensePointCloud &cloud, const AQS12DensePointCloudSegmentor &segmentor, const AQS12Piece &aqs12)
207 {
208 AffineMatrix3D trafo;
210 std::vector<Point3D<double>> residuals(12);
211
212 Internal::DoResCall([&]() {
213 return CVB_CALL_CAPI(CVMAQS12CalculateRigidBodyTransformationWithParamsFromPiece(
214 cloud.Handle(), segmentor.Handle(),
215 reinterpret_cast<const CExports::CVC3DPointD *>(aqs12.Points().data()), aqs12.TopBasePlaneDistance(),
216 *reinterpret_cast<CExports::CVC3DTransformation *>(&trafo),
217 *reinterpret_cast<CExports::CVC3DAffineTransformationParameters *>(&trafoPara),
218 reinterpret_cast<CExports::CVC3DPointD *>(residuals.data())));
219 });
220
221 return std::make_tuple(std::move(trafo), std::move(residuals), std::move(trafoPara));
222 }
223
226
241 const AQS12DensePointCloudSegmentor &segmentor,
242 const AQS12Piece &aqs12, Cvb::Rect<int> aoi)
243 {
244 AffineMatrix3D trafo;
246 std::vector<Point3D<double>> residuals(12);
247
248 Internal::DoResCall([&]() {
249 return CVB_CALL_CAPI(CVMAQS12CalculateRigidBodyTransformationWithParamsFromPieceRect(
250 cloud.Handle(), aoi.Left(), aoi.Top(), aoi.Right(), aoi.Bottom(), segmentor.Handle(),
251 reinterpret_cast<const CExports::CVC3DPointD *>(aqs12.Points().data()), aqs12.TopBasePlaneDistance(),
252 *reinterpret_cast<CExports::CVC3DTransformation *>(&trafo),
253 *reinterpret_cast<CExports::CVC3DAffineTransformationParameters *>(&trafoPara),
254 reinterpret_cast<CExports::CVC3DPointD *>(residuals.data())));
255 });
256
257 return std::make_tuple(std::move(trafo), std::move(residuals), std::move(trafoPara));
258 }
259 } // namespace Metric
260 } // namespace Foundation
261 CVB_END_INLINE_NS
262} // namespace Cvb
Affine transformation for 3D containing a transformation matrix and a translation vector.
Definition affine_matrix_3d.hpp:140
An organized dense Cartesian 3D point cloud object.
Definition decl_dense_point_cloud.hpp:35
Object to collect all input parameters for the AQS12 calibration piece.
Definition decl_metric_aqs12_calibration_piece.hpp:22
double TopBasePlaneDistance() const noexcept
Gets the distance between the top and base plane.
Definition decl_metric_aqs12_calibration_piece.hpp:50
const std::array< Point3D< double >, 12 > & Points() const noexcept
Gets array with AQS12 points.
Definition decl_metric_aqs12_calibration_piece.hpp:40
Segmentor object to configure face segmentation of AQS12 calibration piece on dense point clouds.
Definition decl_metric_segmentor_dense_point_cloud_aqs12.hpp:19
Segmentor object to configure face segmentation of AQS12 calibration piece on range maps.
Definition decl_metric_segmentor_range_map_aqs12.hpp:19
Calibration configuration object.
Definition decl_metric_calibration_configuration.hpp:41
void * Handle() const noexcept
Returns C-API style handle to Node Object.
Definition decl_metric_calibration_configuration.hpp:313
void * Handle() const noexcept
Returns C-API style handle to Node Object.
Definition decl_metric_segmentor_dense_point_cloud.hpp:123
void * Handle() const noexcept
Returns C-API style handle to Node Object.
Definition decl_metric_segmentor_range_map.hpp:133
Image plane information container.
Definition decl_image_plane.hpp:29
void * Handle() const noexcept override
Classic API image handle.
Definition detail_image_plane.hpp:35
void * Handle() const noexcept
Returns C-API style handle to Node Object.
Definition decl_point_cloud.hpp:764
Rectangle object.
Definition rect.hpp:24
T Bottom() const noexcept
Gets bottom row of the rectangle (still inside the rectangle).
Definition rect.hpp:144
T Top() const noexcept
Gets first row of the rectangle.
Definition rect.hpp:104
T Right() const noexcept
Gets rightmost column of the rectangle (still inside the rectangle).
Definition rect.hpp:124
T Left() const noexcept
Gets first column of the rectangle.
Definition rect.hpp:84
T isnan(T... args)
T make_tuple(T... args)
T move(T... args)
Namespace for metric calibration.
Definition decl_metric_aqs12_calibration_piece.hpp:13
std::pair< LaserPlaneHomographyCalibrator3DPtr, std::array< Point3D< double >, 12 > > AQS12CalibratorResult
Result for calculating the calibrator based on the AQS12 calibration piece.
Definition metric_aqs12.hpp:26
TransformationResult CalculateCorrectionOfLaserPlaneInclinationFromAqs12Piece(const DensePointCloud &cloud, const AQS12DensePointCloudSegmentor &segmentor, const CalibrationConfiguration &config)
Calculates an extrinsic calibration and the correction for the laser plane inclination (affine transf...
Definition metric_aqs12.hpp:123
AQS12CalibratorResult CreateCalibratorFromAqs12Piece(const ImagePlane &imagePlane, const AQS12RangeMapSegmentor &segmentor, const CalibrationConfiguration &config)
Calculates intrinsic and extrinsic calibration parameters from the given range map image of an AQS12 ...
Definition metric_aqs12.hpp:53
RigidBodyTransformationResult CalculateRigidBodyTransformationFromAqs12Piece(const DensePointCloud &cloud, const AQS12DensePointCloudSegmentor &segmentor, const AQS12Piece &aqs12)
Calculates a rigid body transformation from a given dense point cloud of an AQS12 calibration piece.
Definition metric_aqs12.hpp:205
std::tuple< AffineMatrix3D, Cvb::optional< std::vector< Point3D< double > > >, Cvb::optional< AffineTransformationParameters > > TransformationResult
Result for calculating an extrinsic transformation.
Definition metric.hpp:41
std::tuple< AffineMatrix3D, Cvb::optional< std::vector< Point3D< double > > >, AffineTransformationParameters > RigidBodyTransformationResult
Result for calculating a rigid body transformation.
Definition metric.hpp:49
Namespace for the Foundation package.
Definition decl_metric_aqs12_calibration_piece.hpp:11
Root namespace for the Image Manager interface.
Definition version.hpp:11
T dynamic_pointer_cast(T... args)
Parameters of a 3D affine transformation matrix correcting an inclined laser plane.
Definition affine_matrix_3d.hpp:36
double InclinationX
Inclination of laser plane (rotation about x axis) in [degree].
Definition affine_matrix_3d.hpp:50