get_circle_poseT_get_circle_poseGetCirclePoseGetCirclePose (Operator)

Name

get_circle_poseT_get_circle_poseGetCirclePoseGetCirclePose — 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)

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_poseGetCirclePoseGetCirclePoseGetCirclePose determines the 3D positions and orientations of these two circles. First, each ContourContourContourContourcontour is approximated by an ellipse. Then, based on the internal camera parameters (CameraParamCameraParamCameraParamCameraParamcameraParam) and the radius of the circle in 3D (RadiusRadiusRadiusRadiusradius), the 3D positions and orientations (Pose1Pose1Pose1Pose1pose1,Pose2Pose2Pose2Pose2pose2) are determined in camera coordinates.

Depending on the value of the parameter OutputTypeOutputTypeOutputTypeOutputTypeoutputType, the position and orientation is returned as a 3D pose (OutputTypeOutputTypeOutputTypeOutputTypeoutputType = '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 (OutputTypeOutputTypeOutputTypeOutputTypeoutputType = '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 Pose1Pose1Pose1Pose1pose1 and Pose2Pose2Pose2Pose2pose2 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 OutputTypeOutputTypeOutputTypeOutputTypeoutputType is set to 'center_normal'"center_normal""center_normal""center_normal""center_normal", the output parameters Pose1Pose1Pose1Pose1pose1 and Pose2Pose2Pose2Pose2pose2 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 OutputTypeOutputTypeOutputTypeOutputTypeoutputType is set to 'pose'"pose""pose""pose""pose".

If more than one contour is passed in ContourContourContourContourcontour, RadiusRadiusRadiusRadiusradius 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 Pose1Pose1Pose1Pose1pose1 and Pose2Pose2Pose2Pose2pose2, i.e., Pose1Pose1Pose1Pose1pose1 and Pose2Pose2Pose2Pose2pose2 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_pixEdgesSubPixEdgesSubPixEdgesSubPix) 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_gaussLaplaceOfGaussLaplaceOfGaussLaplaceOfGauss followed by zero_crossing_sub_pixzero_crossing_sub_pixZeroCrossingSubPixZeroCrossingSubPixZeroCrossingSubPix) 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_edgesInfoEdgesInfoEdgesInfoEdges).

Execution Information

Parameters

ContourContourContourContourcontour (input_object)  xld(-array) objectHXLDHXLDHobject

Contours to be examined.

CameraParamCameraParamCameraParamCameraParamcameraParam (input_control)  campar HCamPar, HTupleHTupleHtuple (real / integer / string) (double / int / long / string) (double / Hlong / HString) (double / Hlong / char*)

Internal camera parameters.

RadiusRadiusRadiusRadiusradius (input_control)  number(-array) HTupleHTupleHtuple (real) (double) (double) (double)

Radius of the circle in object space.

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

Restriction: Radius > 0.0

OutputTypeOutputTypeOutputTypeOutputTypeoutputType (input_control)  string HTupleHTupleHtuple (string) (string) (HString) (char*)

Type of output parameters.

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

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

Pose1Pose1Pose1Pose1pose1 (output_control)  real-array HTupleHTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

3D pose of the first circle.

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

Pose2Pose2Pose2Pose2pose2 (output_control)  real-array HTupleHTupleHtuple (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_poseGetCirclePoseGetCirclePoseGetCirclePose returns 2 (H_MSG_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_pixEdgesSubPixEdgesSubPixEdgesSubPix

Alternatives

find_marks_and_posefind_marks_and_poseFindMarksAndPoseFindMarksAndPoseFindMarksAndPose, camera_calibrationcamera_calibrationCameraCalibrationCameraCalibrationCameraCalibration

See also

get_rectangle_poseget_rectangle_poseGetRectanglePoseGetRectanglePoseGetRectanglePose, fit_ellipse_contour_xldfit_ellipse_contour_xldFitEllipseContourXldFitEllipseContourXldFitEllipseContourXld

Module

3D Metrology