get_circle_poseT_get_circle_poseGetCirclePoseGetCirclePoseget_circle_pose (Operator)

Name

get_circle_poseT_get_circle_poseGetCirclePoseGetCirclePoseget_circle_pose — Determine the 3D pose of a circle from its perspective 2D projection.

Signature

get_circle_pose(Contour : : CameraParam, Radius, OutputType : Pose1, Pose2)

Herror T_get_circle_pose(const Hobject Contour, const Htuple CameraParam, const Htuple Radius, const Htuple OutputType, Htuple* Pose1, Htuple* Pose2)

void GetCirclePose(const HObject& Contour, const HTuple& CameraParam, const HTuple& Radius, const HTuple& OutputType, HTuple* Pose1, HTuple* Pose2)

HTuple HXLD::GetCirclePose(const HCamPar& CameraParam, const HTuple& Radius, const HString& OutputType, HTuple* Pose2) const

HTuple HXLD::GetCirclePose(const HCamPar& CameraParam, double Radius, const HString& OutputType, HTuple* Pose2) const

HTuple HXLD::GetCirclePose(const HCamPar& CameraParam, double Radius, const char* OutputType, HTuple* Pose2) const

HTuple HXLD::GetCirclePose(const HCamPar& CameraParam, double Radius, const wchar_t* OutputType, HTuple* Pose2) const   (Windows only)

HTuple HCamPar::GetCirclePose(const HXLD& Contour, const HTuple& Radius, const HString& OutputType, HTuple* Pose2) const

HTuple HCamPar::GetCirclePose(const HXLD& Contour, double Radius, const HString& OutputType, HTuple* Pose2) const

HTuple HCamPar::GetCirclePose(const HXLD& Contour, double Radius, const char* OutputType, HTuple* Pose2) const

HTuple HCamPar::GetCirclePose(const HXLD& Contour, double Radius, const wchar_t* OutputType, HTuple* Pose2) const   (Windows only)

static void HOperatorSet.GetCirclePose(HObject contour, HTuple cameraParam, HTuple radius, HTuple outputType, out HTuple pose1, out HTuple pose2)

HTuple HXLD.GetCirclePose(HCamPar cameraParam, HTuple radius, string outputType, out HTuple pose2)

HTuple HXLD.GetCirclePose(HCamPar cameraParam, double radius, string outputType, out HTuple pose2)

HTuple HCamPar.GetCirclePose(HXLD contour, HTuple radius, string outputType, out HTuple pose2)

HTuple HCamPar.GetCirclePose(HXLD contour, double radius, string outputType, out HTuple pose2)

def get_circle_pose(contour: HObject, camera_param: Sequence[Union[int, float, str]], radius: MaybeSequence[float], output_type: str) -> Tuple[Sequence[Union[float, int]], Sequence[Union[float, int]]]

Description

Each ellipse in an image can be interpreted as the perspective projection of a circle into the image. In fact, for a given radius of the circle, there exist two differently oriented circles in 3D that result in the same projection. get_circle_poseget_circle_poseGetCirclePoseGetCirclePoseGetCirclePoseget_circle_pose determines the 3D positions and orientations of these two circles. First, each ContourContourContourContourcontourcontour is approximated by an ellipse. Then, based on the internal camera parameters (CameraParamCameraParamCameraParamCameraParamcameraParamcamera_param) and the radius of the circle in 3D (RadiusRadiusRadiusRadiusradiusradius), the 3D positions and orientations (Pose1Pose1Pose1Pose1pose1pose_1,Pose2Pose2Pose2Pose2pose2pose_2) are determined in camera coordinates.

Depending on the value of the parameter OutputTypeOutputTypeOutputTypeOutputTypeoutputTypeoutput_type, the position and orientation is returned as a 3D pose (OutputTypeOutputTypeOutputTypeOutputTypeoutputTypeoutput_type = 'pose'"pose""pose""pose""pose""pose") or in the form of the center of the 3D circle and the normal vector of the plane in which the circle lies (OutputTypeOutputTypeOutputTypeOutputTypeoutputTypeoutput_type = 'center_normal'"center_normal""center_normal""center_normal""center_normal""center_normal"). In the former case, the angle for the rotation around the z axis is set to zero, because it cannot be determined. In the latter case, the first three elements of the output parameters Pose1Pose1Pose1Pose1pose1pose_1 and Pose2Pose2Pose2Pose2pose2pose_2 contain the position of the center of the circle. The following three elements contain the normal vector. The normal vectors are normalized and oriented such that they point away from the optical center which is the origin of the camera coordinate system. If OutputTypeOutputTypeOutputTypeOutputTypeoutputTypeoutput_type is set to 'center_normal'"center_normal""center_normal""center_normal""center_normal""center_normal", the output parameters Pose1Pose1Pose1Pose1pose1pose_1 and Pose2Pose2Pose2Pose2pose2pose_2 contain only six elements which describe the position and orientation of the circle instead of the seven elements of the 3D pose that are returned if OutputTypeOutputTypeOutputTypeOutputTypeoutputTypeoutput_type is set to 'pose'"pose""pose""pose""pose""pose".

If more than one contour is passed in ContourContourContourContourcontourcontour, RadiusRadiusRadiusRadiusradiusradius must either contain a tuple that contains a value for each contour or only one value which is then used for all contours. The resulting positions and orientations are stored one after another in Pose1Pose1Pose1Pose1pose1pose_1 and Pose2Pose2Pose2Pose2pose2pose_2, i.e., Pose1Pose1Pose1Pose1pose1pose_1 and Pose2Pose2Pose2Pose2pose2pose_2 contain first the pose or the position and the normal vector of the first contour, followed by the respective values for the second contour and so on.

Attention

The accuracy of the determined poses depends heavily on the accuracy of the extracted contours. The extraction of curved edges using relatively large filter masks leads to a slightly shifted edge position. Edge extraction approaches that are based on the first derivative of the image function (e.g., edges_sub_pixedges_sub_pixEdgesSubPixEdgesSubPixEdgesSubPixedges_sub_pix) yield edges that are shifted towards the center of curvature, i.e., extracted ellipses will be slightly to small. Approaches that are based on the second derivative of the image function (laplace_of_gausslaplace_of_gaussLaplaceOfGaussLaplaceOfGaussLaplaceOfGausslaplace_of_gauss followed by zero_crossing_sub_pixzero_crossing_sub_pixZeroCrossingSubPixZeroCrossingSubPixZeroCrossingSubPixzero_crossing_sub_pix) result in edges that are shifted away from the center of curvature, i.e., extracted ellipses will be slightly too large.

These effects increase with the curvature of the edge and with the size of the filter mask that is used for the edge extraction. Therefore, to achieve high accuracy, the ellipses should appear large in the image and the filter parameter should be chosen such that small filter masks are used (see info_edgesinfo_edgesInfoEdgesInfoEdgesInfoEdgesinfo_edges).

Execution Information

Parameters

ContourContourContourContourcontourcontour (input_object)  xld(-array) objectHXLDHObjectHXLDHobject

Contours to be examined.

CameraParamCameraParamCameraParamCameraParamcameraParamcamera_param (input_control)  campar HCamPar, HTupleSequence[Union[int, float, str]]HTupleHtuple (real / integer / string) (double / int / long / string) (double / Hlong / HString) (double / Hlong / char*)

Internal camera parameters.

RadiusRadiusRadiusRadiusradiusradius (input_control)  number(-array) HTupleMaybeSequence[float]HTupleHtuple (real) (double) (double) (double)

Radius of the circle in object space.

Number of elements: Radius == Contour || Radius == 1

Restriction: Radius > 0.0

OutputTypeOutputTypeOutputTypeOutputTypeoutputTypeoutput_type (input_control)  string HTuplestrHTupleHtuple (string) (string) (HString) (char*)

Type of output parameters.

Default value: 'pose' "pose" "pose" "pose" "pose" "pose"

List of values: 'center_normal'"center_normal""center_normal""center_normal""center_normal""center_normal", 'pose'"pose""pose""pose""pose""pose"

Pose1Pose1Pose1Pose1pose1pose_1 (output_control)  real-array HTupleSequence[Union[float, int]]HTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

3D pose of the first circle.

Number of elements: Pose1 == 7 * Contour || Pose1 == 6 * Contour

Pose2Pose2Pose2Pose2pose2pose_2 (output_control)  real-array HTupleSequence[Union[float, int]]HTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

3D pose of the second circle.

Number of elements: Pose2 == 7 * Contour || Pose2 == 6 * Contour

Result

get_circle_poseget_circle_poseGetCirclePoseGetCirclePoseGetCirclePoseget_circle_pose returns TRUE if all parameter values are correct and the position of the circle has been determined successfully. If necessary, an exception is raised.

Possible Predecessors

edges_sub_pixedges_sub_pixEdgesSubPixEdgesSubPixEdgesSubPixedges_sub_pix

Alternatives

find_marks_and_posefind_marks_and_poseFindMarksAndPoseFindMarksAndPoseFindMarksAndPosefind_marks_and_pose, camera_calibrationcamera_calibrationCameraCalibrationCameraCalibrationCameraCalibrationcamera_calibration

See also

get_rectangle_poseget_rectangle_poseGetRectanglePoseGetRectanglePoseGetRectanglePoseget_rectangle_pose, fit_ellipse_contour_xldfit_ellipse_contour_xldFitEllipseContourXldFitEllipseContourXldFitEllipseContourXldfit_ellipse_contour_xld

Module

3D Metrology