2CVBpy Example Script for AQS12 Calibration - Use Case 1.
4This example shows how to calibrate range maps acquired by a modular laser
5triangulation setup (camera and laser separated), where the intrinsic calibration
6parameters are not given.
8See also use case 1 described in the CVB Metric documentation:
9https://help.commonvisionblox.com/NextGen/14.1/md_theory_of_operation_tools__metric.html#calibration_setup
11This example program estimates homography and an affine transformation.
12The affine transformation:
13- corrects errors induced by an incline laser plane
14- corrects scaling in x, y, z
15- moves the point cloud to the coordinate system given by the reference
42def check_accuracy(residuals, desired_accuracy):
43 for point
in residuals:
44 if abs(point.x) > desired_accuracy
or abs(point.y) > desired_accuracy
or abs(point.z) > desired_accuracy:
52print(
"Estimation of homography and affine transformation (correcting an inclined laser plane)")
55print(
"Loading range map.")
57),
"tutorial",
"Metric",
"Images",
"RangeMapCalibrationPattern.tif"))
64config.is_homography_calculated =
True
65config.is_correction_of_laser_plane_inclination_calculated =
True
68print(
"Estimating homography and affine matrix.")
70 cvb.foundation.SegmentationMethod.KmeansClustering)
74 rangemap.planes[0], segmentor, config)
77desired_accuracy = 0.05
78if check_accuracy(result[1], desired_accuracy):
79 print(
"The calibration was successful and accuracy is < ",
80 desired_accuracy,
"mm.")
83 print(
"Creating calibrated point cloud.")
85 rangemap.planes[0], result[0], cvb.PointCloudFlags.Float)
89 cloud.save(
"cloud.ply")
91 print(
"Results do not have desired accuracy. Check face segmentation and extracted AQS12 points...")
94 print(
"Segmenting AQ12 faces on range map.")
95 facesAqs12 = segmentor.face_segmentation_from_piece(rangemap.planes[0])
99 facesAqs12.save(
"AQS12faces.bmp")
102 print(
"Extracting AQ12 corner points on range map.")
103 aqs12points = segmentor.extract_projected_points_from_piece(
The Common Vision Blox image.
Definition: __init__.py:2038
Multi-purpose 3D vector class.
Definition: __init__.py:4261
Union[cvb.PointCloud, cvb.DensePointCloud, cvb.SparsePointCloud] create(cvb.ImagePlane range_map, cvb.Calibrator3D calibrator, int flags, Optional[Type[cvb.PointCloud|cvb.DensePointCloud|cvb.SparsePointCloud]] point_cloud_type=DensePointCloud)
Creates a new Cartesian 3D point cloud from the given 2.5D range map image.
Definition: __init__.py:4640
Object to collect all input parameters for the AQS12 calibration piece.
Definition: __init__.py:76
cvb.foundation.AQS12RangeMapSegmentor create(int method)
Creates an AQS12 segmentor for range maps based on given segmentation method.
Definition: __init__.py:101
cvb.foundation.CalibrationConfiguration create(cvb.foundation.AQS12Piece aqs12)
Creates a calibration configuration object.
Definition: __init__.py:270
Common Vision Blox Foundation module for Python.
Definition: __init__.py:1
Tuple[cvb.LaserPlaneHomographyCalibrator3D, List[cvb.Point3D]] create_calibrator_from_aqs12_piece(cvb.ImagePlane image_plane, cvb.foundation.AQS12RangeMapSegmentor segmentor, cvb.foundation.CalibrationConfiguration config, Optional[cvb.Rect] aoi)
Calculates intrinsic calibration parameters from the given range map image of an AQS12 calibration pi...
Definition: __init__.py:2851
str install_path()
Directory Common Vision Blox has been installed to.
Definition: __init__.py:8257