Skip to content

find_marks_and_poseFindMarksAndPoseFindMarksAndPosefind_marks_and_poseT_find_marks_and_poseπŸ”—

Short descriptionπŸ”—

find_marks_and_poseFindMarksAndPoseFindMarksAndPosefind_marks_and_poseT_find_marks_and_pose β€” Extract rectangularly arranged 2D calibration marks from the image and calculate initial values for the external camera parameters.

SignatureπŸ”—

find_marks_and_pose( image Image, region CalPlateRegion, filename.read CalPlateDescr, campar StartCamParam, number StartThresh, number DeltaThresh, number MinThresh, real Alpha, real MinContLength, real MaxDiamMarks, out real RCoord, out real CCoord, out pose StartPose )void FindMarksAndPose( const HObject& Image, const HObject& CalPlateRegion, const HTuple& CalPlateDescr, const HTuple& StartCamParam, const HTuple& StartThresh, const HTuple& DeltaThresh, const HTuple& MinThresh, const HTuple& Alpha, const HTuple& MinContLength, const HTuple& MaxDiamMarks, HTuple* RCoord, HTuple* CCoord, HTuple* StartPose )static void HOperatorSet.FindMarksAndPose( HObject image, HObject calPlateRegion, HTuple calPlateDescr, HTuple startCamParam, HTuple startThresh, HTuple deltaThresh, HTuple minThresh, HTuple alpha, HTuple minContLength, HTuple maxDiamMarks, out HTuple RCoord, out HTuple CCoord, out HTuple startPose )def find_marks_and_pose( image: HObject, cal_plate_region: HObject, cal_plate_descr: str, start_cam_param: Sequence[Union[int, float, str]], start_thresh: int, delta_thresh: int, min_thresh: int, alpha: float, min_cont_length: float, max_diam_marks: float ) -> Tuple[Sequence[float], Sequence[float], Sequence[Union[float, int]]]

Herror T_find_marks_and_pose( const Hobject Image, const Hobject CalPlateRegion, const Htuple CalPlateDescr, const Htuple StartCamParam, const Htuple StartThresh, const Htuple DeltaThresh, const Htuple MinThresh, const Htuple Alpha, const Htuple MinContLength, const Htuple MaxDiamMarks, Htuple* RCoord, Htuple* CCoord, Htuple* StartPose )

HTuple HImage::FindMarksAndPose( const HRegion& CalPlateRegion, const HString& CalPlateDescr, const HCamPar& StartCamParam, Hlong StartThresh, Hlong DeltaThresh, Hlong MinThresh, double Alpha, double MinContLength, double MaxDiamMarks, HTuple* CCoord, HPose* StartPose ) const

HTuple HImage::FindMarksAndPose( const HRegion& CalPlateRegion, const char* CalPlateDescr, const HCamPar& StartCamParam, Hlong StartThresh, Hlong DeltaThresh, Hlong MinThresh, double Alpha, double MinContLength, double MaxDiamMarks, HTuple* CCoord, HPose* StartPose ) const

HTuple HImage::FindMarksAndPose( const HRegion& CalPlateRegion, const wchar_t* CalPlateDescr, const HCamPar& StartCamParam, Hlong StartThresh, Hlong DeltaThresh, Hlong MinThresh, double Alpha, double MinContLength, double MaxDiamMarks, HTuple* CCoord, HPose* StartPose ) const (Windows only)

HTuple HCamPar::FindMarksAndPose( const HImage& Image, const HRegion& CalPlateRegion, const HString& CalPlateDescr, Hlong StartThresh, Hlong DeltaThresh, Hlong MinThresh, double Alpha, double MinContLength, double MaxDiamMarks, HTuple* CCoord, HPose* StartPose ) const

HTuple HCamPar::FindMarksAndPose( const HImage& Image, const HRegion& CalPlateRegion, const char* CalPlateDescr, Hlong StartThresh, Hlong DeltaThresh, Hlong MinThresh, double Alpha, double MinContLength, double MaxDiamMarks, HTuple* CCoord, HPose* StartPose ) const

HTuple HCamPar::FindMarksAndPose( const HImage& Image, const HRegion& CalPlateRegion, const wchar_t* CalPlateDescr, Hlong StartThresh, Hlong DeltaThresh, Hlong MinThresh, double Alpha, double MinContLength, double MaxDiamMarks, HTuple* CCoord, HPose* StartPose ) const (Windows only)

HTuple HPose::FindMarksAndPose( const HImage& Image, const HRegion& CalPlateRegion, const HString& CalPlateDescr, const HCamPar& StartCamParam, Hlong StartThresh, Hlong DeltaThresh, Hlong MinThresh, double Alpha, double MinContLength, double MaxDiamMarks, HTuple* CCoord )

HTuple HPose::FindMarksAndPose( const HImage& Image, const HRegion& CalPlateRegion, const char* CalPlateDescr, const HCamPar& StartCamParam, Hlong StartThresh, Hlong DeltaThresh, Hlong MinThresh, double Alpha, double MinContLength, double MaxDiamMarks, HTuple* CCoord )

HTuple HPose::FindMarksAndPose( const HImage& Image, const HRegion& CalPlateRegion, const wchar_t* CalPlateDescr, const HCamPar& StartCamParam, Hlong StartThresh, Hlong DeltaThresh, Hlong MinThresh, double Alpha, double MinContLength, double MaxDiamMarks, HTuple* CCoord ) (Windows only)

HTuple HImage.FindMarksAndPose( HRegion calPlateRegion, string calPlateDescr, HCamPar startCamParam, int startThresh, int deltaThresh, int minThresh, double alpha, double minContLength, double maxDiamMarks, out HTuple CCoord, out HPose startPose )

HTuple HCamPar.FindMarksAndPose( HImage image, HRegion calPlateRegion, string calPlateDescr, int startThresh, int deltaThresh, int minThresh, double alpha, double minContLength, double maxDiamMarks, out HTuple CCoord, out HPose startPose )

HTuple HPose.FindMarksAndPose( HImage image, HRegion calPlateRegion, string calPlateDescr, HCamPar startCamParam, int startThresh, int deltaThresh, int minThresh, double alpha, double minContLength, double maxDiamMarks, out HTuple CCoord )

DescriptionπŸ”—

find_marks_and_poseFindMarksAndPose is used to determine the input data for a subsequent camera calibration using a calibration plate with rectangularly arranged marks (see Calibration or camera_calibrationCameraCalibration): First, the 2D center points [RCoordRCoordrcoord,CCoordCCoordccoord] of the calibration marks within the region CalPlateRegioncalPlateRegioncal_plate_region of the input image Imageimageimage are extracted and ordered. Secondly, a rough estimate for the external camera parameters (StartPosestartPosestart_pose) is computed, i.e., the 3D pose (= position and orientation) of the calibration plate relative to the camera coordinate system (see create_poseCreatePose for more information about 3D poses).

In the input image Imageimageimage an edge detector is applied (see edges_imageEdgesImage, mode β€˜lanser2’) to the region CalPlateRegioncalPlateRegioncal_plate_region, which can be found by applying the operator find_caltabFindCaltab. The filter parameter for this edge detection can be tuned via Alphaalphaalpha. Use a smaller value for Alphaalphaalpha to achieve a stronger smoothing effect. In the edge image closed contours are searched for: The number of closed contours must correspond to the number of calibration marks as described in the calibration plate description file CalPlateDescrcalPlateDescrcal_plate_descr and the contours have to be elliptically shaped. Contours shorter than MinContLengthminContLengthmin_cont_length are discarded, just as contours enclosing regions with a diameter larger than MaxDiamMarksmaxDiamMarksmax_diam_marks (e.g., the border of the calibration plate).

For the detection of contours a threshold operator is applied on the resulting amplitudes of the edge detector. All points with a high amplitude (i.e., borders of marks) are selected.

First, the threshold value is set to StartThreshstartThreshstart_thresh. If the search for the closed contours or the successive pose estimate fails, this threshold value is successively decreased by DeltaThreshdeltaThreshdelta_thresh down to a minimum value of MinThreshminThreshmin_thresh.

Each of the found contours is refined with subpixel accuracy (see edges_sub_pixEdgesSubPix) and subsequently approximated by an ellipse. The center points of these ellipses represent a good approximation of the desired 2D image coordinates [RCoordRCoordrcoord,CCoordCCoordccoord] of the calibration mark center points. The order of the values within these two tuples must correspond to the order of the 3D coordinates of the calibration marks in the calibration plate description file CalPlateDescrcalPlateDescrcal_plate_descr, since this fixes the correspondences between extracted image marks and known model marks (given by caltab_pointsCaltabPoints)! If a triangular orientation mark is defined in a corner of the plate by the plate description file (see gen_caltabGenCaltab), the mark will be detected and the point order is returned in row-major order beginning with the corner mark in the (barycentric) negative quadrant with respect to the defined coordinate system of the plate. Else, if no orientation mark is defined, the order of the center points is in row-major order beginning at the upper left corner mark in the image.

Based on the ellipse parameters for each calibration mark, a rough estimate for the external camera parameters is finally computed. For this purpose the fixed correspondences between extracted image marks and known model marks are used. The estimate StartPosestartPosestart_pose describes the pose of the calibration plate in the camera coordinate system as required by the operator camera_calibrationCameraCalibration.

Execution informationπŸ”—

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Processed without parallelization.

ParametersπŸ”—

Imageimageimage (input_object) singlechannelimage β†’ object (byte / uint2)HObject (byte / uint2)HImage (byte / uint2)HObject (byte / uint2)Hobject (byte / uint2)

Input image.

CalPlateRegioncalPlateRegioncal_plate_region (input_object) region β†’ objectHObjectHRegionHObjectHobject

Region of the calibration plate.

CalPlateDescrcalPlateDescrcal_plate_descr (input_control) filename.read β†’ (string)HTuple (HString)HTuple (string)strHtuple (char*)

File name of the calibration plate description.

Default: 'caltab_100.descr'"caltab_100.descr"
List of values: 'caltab_100mm.descr', 'caltab_10mm.descr', 'caltab_200mm.descr', 'caltab_2500um.descr', 'caltab_30mm.descr', 'caltab_650um.descr', 'caltab_6mm.descr', 'caltab_800mm.descr', 'caltab_big.descr', 'caltab_small.descr'"caltab_100mm.descr", "caltab_10mm.descr", "caltab_200mm.descr", "caltab_2500um.descr", "caltab_30mm.descr", "caltab_650um.descr", "caltab_6mm.descr", "caltab_800mm.descr", "caltab_big.descr", "caltab_small.descr"
File extension: .descr

StartCamParamstartCamParamstart_cam_param (input_control) campar β†’ (real / integer / string)HTuple (double / Hlong / HString)HCamPar, HTuple (double / int / long / string)Sequence[Union[int, float, str]]Htuple (double / Hlong / char*)

Initial values for the internal camera parameters.

StartThreshstartThreshstart_thresh (input_control) number β†’ (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Initial threshold value for contour detection.

Default: 128128
Suggested values: 80, 96, 112, 128, 144, 16080, 96, 112, 128, 144, 160
Restriction: StartThresh > 0

DeltaThreshdeltaThreshdelta_thresh (input_control) number β†’ (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Loop value for successive reduction of StartThreshstartThreshstart_thresh.

Default: 1010
Suggested values: 6, 8, 10, 12, 14, 16, 18, 20, 226, 8, 10, 12, 14, 16, 18, 20, 22
Restriction: DeltaThresh > 0

MinThreshminThreshmin_thresh (input_control) number β†’ (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Minimum threshold for contour detection.

Default: 1818
Suggested values: 8, 10, 12, 14, 16, 18, 20, 228, 10, 12, 14, 16, 18, 20, 22
Restriction: MinThresh > 0

Alphaalphaalpha (input_control) real β†’ (real)HTuple (double)HTuple (double)floatHtuple (double)

Filter parameter for contour detection, see edges_imageEdgesImage.

Default: 0.90.9
Suggested values: 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.10.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1
Value range: 0.2 ≀ Alpha ≀ 2.0
Restriction: Alpha > 0.0

MinContLengthminContLengthmin_cont_length (input_control) real β†’ (real)HTuple (double)HTuple (double)floatHtuple (double)

Minimum length of the contours of the marks.

Default: 15.015.0
Suggested values: 10.0, 15.0, 20.0, 30.0, 40.0, 100.010.0, 15.0, 20.0, 30.0, 40.0, 100.0
Restriction: MinContLength > 0.0

MaxDiamMarksmaxDiamMarksmax_diam_marks (input_control) real β†’ (real)HTuple (double)HTuple (double)floatHtuple (double)

Maximum expected diameter of the marks.

Default: 100.0100.0
Suggested values: 50.0, 100.0, 150.0, 200.0, 300.050.0, 100.0, 150.0, 200.0, 300.0
Restriction: MaxDiamMarks > 0.0

RCoordRCoordrcoord (output_control) real-array β†’ (real)HTuple (double)HTuple (double)Sequence[float]Htuple (double)

Tuple with row coordinates of the detected marks.

CCoordCCoordccoord (output_control) real-array β†’ (real)HTuple (double)HTuple (double)Sequence[float]Htuple (double)

Tuple with column coordinates of the detected marks.

StartPosestartPosestart_pose (output_control) pose β†’ (real / integer)HTuple (double / Hlong)HPose, HTuple (double / int / long)Sequence[Union[float, int]]Htuple (double / Hlong)

Estimation for the external camera parameters.

Number of elements: 7

ExampleπŸ”—

(HDevelop)


* Read calibration image.
read_image(Image, 'calib/calib_distorted_01')
* Find calibration pattern.
find_caltab(Image,CalPlate, 'caltab_100mm.descr', 3, 112, 5)
* Find calibration marks and start pose.
find_marks_and_pose(Image, CalPlate, 'caltab_100mm.descr' , \
                    ['area_scan_division', 0.008, 0.0, \
                     0.000011, 0.000011, 384, 288, 640, 512], \
                    128, 10, 18, 0.9, 15.0, 100.0, RCoord, CCoord, StartPose)
(C++)
HTuple StartCamPar, RCoord, CCoord, StartPose\;
// Read calibration image.
HImage Image("calib/calib_distorted_01")\;
// Find calibration pattern.
HRegion CalPlate = Image.FindCaltab("caltab_100mm.descr", 3, 112, 5)\;
// Read internal camera parameters from file.
read_cam_par("campar.dat", &StartCamPar)\;
// Find calibration marks and start pose.
RCoord = Image.FindMarksAndPose(CalPlate, "caltab_100mm.descr", StartCamPar,
                                128, 10, 18, 0.9, 15.0, 100.0,
                                &RCoord, &CCoord, &StartPose)\;

ResultπŸ”—

find_marks_and_poseFindMarksAndPose returns 2 (H_MSG_TRUE) if all parameter values are correct and an estimation for the external camera parameters has been determined successfully. If necessary, an exception is raised.

Combinations with other operatorsπŸ”—

Combinations

Possible predecessors

find_caltabFindCaltab

Possible successors

camera_calibrationCameraCalibration

See also

find_caltabFindCaltab, camera_calibrationCameraCalibration, disp_caltabDispCaltab, sim_caltabSimCaltab, read_cam_parReadCamPar, read_poseReadPose, create_poseCreatePose, pose_to_hom_mat3dPoseToHomMat3d, caltab_pointsCaltabPoints, gen_caltabGenCaltab, edges_sub_pixEdgesSubPix, edges_imageEdgesImage

ModuleπŸ”—

Foundation