find_marks_and_poseT_find_marks_and_poseFindMarksAndPoseFindMarksAndPosefind_marks_and_pose (算子)

名称

find_marks_and_poseT_find_marks_and_poseFindMarksAndPoseFindMarksAndPosefind_marks_and_pose — 从图像中提取矩形排列的二维标定标记,并计算外部相机参数的初始值。

签名

find_marks_and_pose(Image, CalPlateRegion : : CalPlateDescr, StartCamParam, StartThresh, DeltaThresh, MinThresh, Alpha, MinContLength, MaxDiamMarks : RCoord, CCoord, StartPose)

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)

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)

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)

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)

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)

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]]]

描述

find_marks_and_posefind_marks_and_poseFindMarksAndPoseFindMarksAndPoseFindMarksAndPosefind_marks_and_pose is used to determine the input data for a subsequent camera calibration using a calibration plate with rectangularly arranged marks (see 标定 or camera_calibrationcamera_calibrationCameraCalibrationCameraCalibrationCameraCalibrationcamera_calibration): First, the 2D center points [RCoordRCoordRCoordRCoordRCoordrcoord,CCoordCCoordCCoordCCoordCCoordccoord] of the calibration marks within the region CalPlateRegionCalPlateRegionCalPlateRegionCalPlateRegioncalPlateRegioncal_plate_region of the input image ImageImageImageImageimageimage are extracted and ordered. Secondly, a rough estimate for the external camera parameters (StartPoseStartPoseStartPoseStartPosestartPosestart_pose) is computed, i.e., the 3D pose (= position and orientation) of the calibration plate relative to the camera coordinate system (see create_posecreate_poseCreatePoseCreatePoseCreatePosecreate_pose for more information about 3D poses).

In the input image ImageImageImageImageimageimage an edge detector is applied (see edges_imageedges_imageEdgesImageEdgesImageEdgesImageedges_image, mode 'lanser2') to the region CalPlateRegionCalPlateRegionCalPlateRegionCalPlateRegioncalPlateRegioncal_plate_region, which can be found by applying the operator find_caltabfind_caltabFindCaltabFindCaltabFindCaltabfind_caltab。The filter parameter for this edge detection can be tuned via AlphaAlphaAlphaAlphaalphaalpha. Use a smaller value for AlphaAlphaAlphaAlphaalphaalpha 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 CalPlateDescrCalPlateDescrCalPlateDescrCalPlateDescrcalPlateDescrcal_plate_descr and the contours have to be elliptically shaped. Contours shorter than MinContLengthMinContLengthMinContLengthMinContLengthminContLengthmin_cont_length are discarded, just as contours enclosing regions with a diameter larger than MaxDiamMarksMaxDiamMarksMaxDiamMarksMaxDiamMarksmaxDiamMarksmax_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 StartThreshStartThreshStartThreshStartThreshstartThreshstart_thresh. If the search for the closed contours or the successive pose estimate fails, this threshold value is successively decreased by DeltaThreshDeltaThreshDeltaThreshDeltaThreshdeltaThreshdelta_thresh down to a minimum value of MinThreshMinThreshMinThreshMinThreshminThreshmin_thresh

Each of the found contours is refined with subpixel accuracy (see edges_sub_pixedges_sub_pixEdgesSubPixEdgesSubPixEdgesSubPixedges_sub_pix) and subsequently approximated by an ellipse. The center points of these ellipses represent a good approximation of the desired 2D image coordinates [RCoordRCoordRCoordRCoordRCoordrcoord,CCoordCCoordCCoordCCoordCCoordccoord] 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 CalPlateDescrCalPlateDescrCalPlateDescrCalPlateDescrcalPlateDescrcal_plate_descr, since this fixes the correspondences between extracted image marks and known model marks (given by caltab_pointscaltab_pointsCaltabPointsCaltabPointsCaltabPointscaltab_points)! If a triangular orientation mark is defined in a corner of the plate by the plate description file (see gen_caltabgen_caltabGenCaltabGenCaltabGenCaltabgen_caltab), 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 StartPoseStartPoseStartPoseStartPosestartPosestart_pose describes the pose of the calibration plate in the camera coordinate system as required by the operator camera_calibrationcamera_calibrationCameraCalibrationCameraCalibrationCameraCalibrationcamera_calibration

执行信息

参数

ImageImageImageImageimageimage (输入对象)  singlechannelimage objectHImageHObjectHImageHobject (byte / uint2)

输入图像。

CalPlateRegionCalPlateRegionCalPlateRegionCalPlateRegioncalPlateRegioncal_plate_region (输入对象)  region objectHRegionHObjectHRegionHobject

Region of the calibration plate.

CalPlateDescrCalPlateDescrCalPlateDescrCalPlateDescrcalPlateDescrcal_plate_descr (输入控制)  filename.read HTuplestrHTupleHtuple (string) (string) (HString) (char*)

File name of the calibration plate description.

默认值: 'caltab_100.descr' "caltab_100.descr" "caltab_100.descr" "caltab_100.descr" "caltab_100.descr" "caltab_100.descr"

值列表: 'caltab_100mm.descr'"caltab_100mm.descr""caltab_100mm.descr""caltab_100mm.descr""caltab_100mm.descr""caltab_100mm.descr", 'caltab_10mm.descr'"caltab_10mm.descr""caltab_10mm.descr""caltab_10mm.descr""caltab_10mm.descr""caltab_10mm.descr", 'caltab_200mm.descr'"caltab_200mm.descr""caltab_200mm.descr""caltab_200mm.descr""caltab_200mm.descr""caltab_200mm.descr", 'caltab_2500um.descr'"caltab_2500um.descr""caltab_2500um.descr""caltab_2500um.descr""caltab_2500um.descr""caltab_2500um.descr", 'caltab_30mm.descr'"caltab_30mm.descr""caltab_30mm.descr""caltab_30mm.descr""caltab_30mm.descr""caltab_30mm.descr", 'caltab_650um.descr'"caltab_650um.descr""caltab_650um.descr""caltab_650um.descr""caltab_650um.descr""caltab_650um.descr", 'caltab_6mm.descr'"caltab_6mm.descr""caltab_6mm.descr""caltab_6mm.descr""caltab_6mm.descr""caltab_6mm.descr", 'caltab_800mm.descr'"caltab_800mm.descr""caltab_800mm.descr""caltab_800mm.descr""caltab_800mm.descr""caltab_800mm.descr", 'caltab_big.descr'"caltab_big.descr""caltab_big.descr""caltab_big.descr""caltab_big.descr""caltab_big.descr", 'caltab_small.descr'"caltab_small.descr""caltab_small.descr""caltab_small.descr""caltab_small.descr""caltab_small.descr"

File extension: .descr

StartCamParamStartCamParamStartCamParamStartCamParamstartCamParamstart_cam_param (输入控制)  campar HCamPar, HTupleSequence[Union[int, float, str]]HTupleHtuple (real / integer / string) (double / int / long / string) (double / Hlong / HString) (double / Hlong / char*)

Initial values for the internal camera parameters.

StartThreshStartThreshStartThreshStartThreshstartThreshstart_thresh (输入控制)  number HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Initial threshold value for contour detection.

默认值: 128

建议值: 80, 96, 112, 128, 144, 160

限制: StartThresh > 0

DeltaThreshDeltaThreshDeltaThreshDeltaThreshdeltaThreshdelta_thresh (输入控制)  number HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Loop value for successive reduction of StartThreshStartThreshStartThreshStartThreshstartThreshstart_thresh

默认值: 10

建议值: 6, 8, 10, 12, 14, 16, 18, 20, 22

限制: DeltaThresh > 0

MinThreshMinThreshMinThreshMinThreshminThreshmin_thresh (输入控制)  number HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Minimum threshold for contour detection.

默认值: 18

建议值: 8, 10, 12, 14, 16, 18, 20, 22

限制: MinThresh > 0

AlphaAlphaAlphaAlphaalphaalpha (输入控制)  real HTuplefloatHTupleHtuple (real) (double) (double) (double)

Filter parameter for contour detection, see edges_imageedges_imageEdgesImageEdgesImageEdgesImageedges_image

默认值: 0.9

建议值: 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1

值范围: 0.2 ≤ Alpha Alpha Alpha Alpha alpha alpha ≤ 2.0

限制: Alpha > 0.0

MinContLengthMinContLengthMinContLengthMinContLengthminContLengthmin_cont_length (输入控制)  real HTuplefloatHTupleHtuple (real) (double) (double) (double)

Minimum length of the contours of the marks.

默认值: 15.0

建议值: 10.0, 15.0, 20.0, 30.0, 40.0, 100.0

限制: MinContLength > 0.0

MaxDiamMarksMaxDiamMarksMaxDiamMarksMaxDiamMarksmaxDiamMarksmax_diam_marks (输入控制)  real HTuplefloatHTupleHtuple (real) (double) (double) (double)

Maximum expected diameter of the marks.

默认值: 100.0

建议值: 50.0, 100.0, 150.0, 200.0, 300.0

限制: MaxDiamMarks > 0.0

RCoordRCoordRCoordRCoordRCoordrcoord (输出控制)  real-array HTupleSequence[float]HTupleHtuple (real) (double) (double) (double)

Tuple with row coordinates of the detected marks.

CCoordCCoordCCoordCCoordCCoordccoord (输出控制)  real-array HTupleSequence[float]HTupleHtuple (real) (double) (double) (double)

Tuple with column coordinates of the detected marks.

StartPoseStartPoseStartPoseStartPosestartPosestart_pose (输出控制)  pose HPose, HTupleSequence[Union[float, int]]HTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

Estimation for the external camera parameters.

元素数量: 7

示例(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)

示例(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)

示例(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)

示例(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)

示例(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)

结果

find_marks_and_posefind_marks_and_poseFindMarksAndPoseFindMarksAndPoseFindMarksAndPosefind_marks_and_pose returns 2 ( H_MSG_TRUE) if all parameter values are correct and an estimation for the external camera parameters has been determined successfully。如有必要,则抛出异常。

可能的前趋

find_caltabfind_caltabFindCaltabFindCaltabFindCaltabfind_caltab

可能的后继

camera_calibrationcamera_calibrationCameraCalibrationCameraCalibrationCameraCalibrationcamera_calibration

另见

find_caltabfind_caltabFindCaltabFindCaltabFindCaltabfind_caltab, camera_calibrationcamera_calibrationCameraCalibrationCameraCalibrationCameraCalibrationcamera_calibration, disp_caltabdisp_caltabDispCaltabDispCaltabDispCaltabdisp_caltab, sim_caltabsim_caltabSimCaltabSimCaltabSimCaltabsim_caltab, read_cam_parread_cam_parReadCamParReadCamParReadCamParread_cam_par, read_poseread_poseReadPoseReadPoseReadPoseread_pose, create_posecreate_poseCreatePoseCreatePoseCreatePosecreate_pose, pose_to_hom_mat3dpose_to_hom_mat3dPoseToHomMat3dPoseToHomMat3dPoseToHomMat3dpose_to_hom_mat3d, caltab_pointscaltab_pointsCaltabPointsCaltabPointsCaltabPointscaltab_points, gen_caltabgen_caltabGenCaltabGenCaltabGenCaltabgen_caltab, edges_sub_pixedges_sub_pixEdgesSubPixEdgesSubPixEdgesSubPixedges_sub_pix, edges_imageedges_imageEdgesImageEdgesImageEdgesImageedges_image

模块

基础