Skip to content

image_points_to_world_planeimage_points_to_world_planeImagePointsToWorldPlaneImagePointsToWorldPlaneimage_points_to_world_planeT_image_points_to_world_planeπŸ”—

Short descriptionπŸ”—

image_points_to_world_planeimage_points_to_world_planeImagePointsToWorldPlaneImagePointsToWorldPlaneimage_points_to_world_planeT_image_points_to_world_plane β€” Transform image points into the plane z=0 of a world coordinate system.

SignatureπŸ”—

image_points_to_world_plane( campar CameraParam, pose WorldPose, coordinates.y Rows, coordinates.x Cols, number Scale, out coordinates.x X, out coordinates.y Y )image_points_to_world_plane( : : CameraParam, WorldPose, Rows, Cols, Scale : X, Y )void ImagePointsToWorldPlane( const HTuple& CameraParam, const HTuple& WorldPose, const HTuple& Rows, const HTuple& Cols, const HTuple& Scale, HTuple* X, HTuple* Y )static void HOperatorSet.ImagePointsToWorldPlane( HTuple cameraParam, HTuple worldPose, HTuple rows, HTuple cols, HTuple scale, out HTuple x, out HTuple y )def image_points_to_world_plane( camera_param: Sequence[Union[int, float, str]], world_pose: Sequence[Union[int, float]], rows: Sequence[Union[int, float]], cols: Sequence[Union[int, float]], scale: Union[int, float, str] ) -> Tuple[Sequence[float], Sequence[float]]

Herror T_image_points_to_world_plane( const Htuple CameraParam, const Htuple WorldPose, const Htuple Rows, const Htuple Cols, const Htuple Scale, Htuple* X, Htuple* Y )

void HCamPar::ImagePointsToWorldPlane( const HPose& WorldPose, const HTuple& Rows, const HTuple& Cols, const HTuple& Scale, HTuple* X, HTuple* Y ) const

void HCamPar::ImagePointsToWorldPlane( const HPose& WorldPose, const HTuple& Rows, const HTuple& Cols, const HString& Scale, HTuple* X, HTuple* Y ) const

void HCamPar::ImagePointsToWorldPlane( const HPose& WorldPose, const HTuple& Rows, const HTuple& Cols, const char* Scale, HTuple* X, HTuple* Y ) const

void HCamPar::ImagePointsToWorldPlane( const HPose& WorldPose, const HTuple& Rows, const HTuple& Cols, const wchar_t* Scale, HTuple* X, HTuple* Y ) const (Windows only)

void HCamPar.ImagePointsToWorldPlane( HPose worldPose, HTuple rows, HTuple cols, HTuple scale, out HTuple x, out HTuple y )

void HCamPar.ImagePointsToWorldPlane( HPose worldPose, HTuple rows, HTuple cols, string scale, out HTuple x, out HTuple y )

DescriptionπŸ”—

The operator image_points_to_world_planeImagePointsToWorldPlane transforms image points which are given in Rowsrowsrows and Colscolscols into the plane z=0 in a world coordinate system and returns their 3D coordinates in Xxx and Yyy. The world coordinate system is chosen by passing its pose relative to the camera coordinate system in WorldPoseworldPoseworld_pose. Hence, latter one is expected in the form \(\mvPoseVar{{ccs}}{wcs}\), where ccs denotes the camera coordinate system and wcs the world coordinate system (see [``Solving machine vision tasks > Machine vision basics

Transformations > 3D Transformationsβ€™β€˜](https://docs.mvtec.com/hdevelopevo/26.11/content/mvtasks/machine_vision_basics/transformations/3d/index.html)). In CameraParamcameraParamcamera_param you must pass the internal camera parameters (see Calibration for the sequence of the parameters and the underlying camera model).

In many cases CameraParamcameraParamcamera_param and WorldPoseworldPoseworld_pose are the result of calibrating the camera with the operator calibrate_camerasCalibrateCameras. See below for an example.

With the parameter Scalescalescale you can scale the resulting 3D coordinates. The parameter Scalescalescale must be specified as the ratio desired unit/original unit. The original unit is determined by the coordinates of the calibration object. If the original unit is meters (which is the case if you use the standard calibration plate), you can set the desired unit directly by selecting 'm'"m", 'cm'"cm", 'mm'"mm" or 'um'"um" for the parameter Scalescalescale.

Internally, the operator first computes the line of sight between the projection center and the image contour points in the camera coordinate system, taking into account the radial distortions. The line of sight is then transformed into the world coordinate system specified in WorldPoseworldPoseworld_pose. By intersecting the plane z=0 with the line of sight the 3D coordinates Xxx and Yyy are obtained.

It is recommended to use only those image points Rowsrowsrows and Colscolscols, that lie within the calibrated image size. The mathematical model does only work well for image points, that lie within the calibration range.

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πŸ”—

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

Internal camera parameters.

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

3D pose of the world coordinate system in camera coordinates.

Number of elements: 7

Rowsrowsrows (input_control) coordinates.y-array β†’ (real / integer)(real / integer)HTuple (double / Hlong)HTuple (double / int / long)Sequence[Union[int, float]]Htuple (double / Hlong)

Row coordinates of the points to be transformed.

Default: 100.0100.0

Colscolscols (input_control) coordinates.x-array β†’ (real / integer)(real / integer)HTuple (double / Hlong)HTuple (double / int / long)Sequence[Union[int, float]]Htuple (double / Hlong)

Column coordinates of the points to be transformed.

Default: 100.0100.0

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

Scale or dimension

Default: 'm'"m"
Suggested values: 'm', 'cm', 'mm', 'microns', 'um', 1.0, 0.01, 0.001, 1.0e-6, 0.0254, 0.3048, 0.9144"m", "cm", "mm", "microns", "um", 1.0, 0.01, 0.001, 1.0e-6, 0.0254, 0.3048, 0.9144
Restriction: Scale > 0

Xxx (output_control) coordinates.x-array β†’ (real)(real)HTuple (double)HTuple (double)Sequence[float]Htuple (double)

X coordinates of the points in the world coordinate system.

Yyy (output_control) coordinates.y-array β†’ (real)(real)HTuple (double)HTuple (double)Sequence[float]Htuple (double)

Y coordinates of the points in the world coordinate system.

ExampleπŸ”—

(HDevelop)


*  Perform camera calibration (with standard calibration plate).
calibrate_cameras (CalibDataID, Error)
get_calib_data (CalibDataID, 'camera', 0, 'params', CamParam)
* Get reference pose (pose 2 of calibration object 0).
get_calib_data (CalibDataID, 'calib_obj_pose',\
                [0,2], 'pose', WorldPose)
*  Compensate thickness of plate.
set_origin_pose(ObjInCameraPose, 0, 0, 0.0006, WorldPose)
*  Transform image points into world coordinate system (unit mm).
image_points_to_world_plane(CamParam, WorldPose, PointRows, PointColumns, \
                            'mm', PointXCoord, PointYCoord)

ResultπŸ”—

image_points_to_world_planeImagePointsToWorldPlane returns 2 (H_MSG_TRUE) if all parameter values are correct. If necessary, an exception is raised.

Combinations with other operatorsπŸ”—

Combinations

Possible predecessors

create_poseCreatePose, hom_mat3d_to_poseHomMat3dToPose, camera_calibrationCameraCalibration, hand_eye_calibrationHandEyeCalibration, set_origin_poseSetOriginPose

See also

contour_to_world_plane_xldContourToWorldPlaneXld, project_3d_pointProject3dPoint

ModuleπŸ”—

Calibration