ClassesClasses | | Operators

image_to_world_planeT_image_to_world_planeImageToWorldPlaneImageToWorldPlane (Operator)

Name

image_to_world_planeT_image_to_world_planeImageToWorldPlaneImageToWorldPlane — Rectify an image by transforming it into the plane z=0 of a world coordinate system.

Signature

image_to_world_plane(Image : ImageWorld : CameraParam, WorldPose, Width, Height, Scale, Interpolation : )

Herror T_image_to_world_plane(const Hobject Image, Hobject* ImageWorld, const Htuple CameraParam, const Htuple WorldPose, const Htuple Width, const Htuple Height, const Htuple Scale, const Htuple Interpolation)

void ImageToWorldPlane(const HObject& Image, HObject* ImageWorld, const HTuple& CameraParam, const HTuple& WorldPose, const HTuple& Width, const HTuple& Height, const HTuple& Scale, const HTuple& Interpolation)

HImage HImage::ImageToWorldPlane(const HCamPar& CameraParam, const HPose& WorldPose, Hlong Width, Hlong Height, const HTuple& Scale, const HString& Interpolation) const

HImage HImage::ImageToWorldPlane(const HCamPar& CameraParam, const HPose& WorldPose, Hlong Width, Hlong Height, const HString& Scale, const HString& Interpolation) const

HImage HImage::ImageToWorldPlane(const HCamPar& CameraParam, const HPose& WorldPose, Hlong Width, Hlong Height, const char* Scale, const char* Interpolation) const

HImage HCamPar::ImageToWorldPlane(const HImage& Image, const HPose& WorldPose, Hlong Width, Hlong Height, const HTuple& Scale, const HString& Interpolation) const

HImage HCamPar::ImageToWorldPlane(const HImage& Image, const HPose& WorldPose, Hlong Width, Hlong Height, const HString& Scale, const HString& Interpolation) const

HImage HCamPar::ImageToWorldPlane(const HImage& Image, const HPose& WorldPose, Hlong Width, Hlong Height, const char* Scale, const char* Interpolation) const

HImage HPose::ImageToWorldPlane(const HImage& Image, const HCamPar& CameraParam, Hlong Width, Hlong Height, const HTuple& Scale, const HString& Interpolation) const

HImage HPose::ImageToWorldPlane(const HImage& Image, const HCamPar& CameraParam, Hlong Width, Hlong Height, const HString& Scale, const HString& Interpolation) const

HImage HPose::ImageToWorldPlane(const HImage& Image, const HCamPar& CameraParam, Hlong Width, Hlong Height, const char* Scale, const char* Interpolation) const

static void HOperatorSet.ImageToWorldPlane(HObject image, out HObject imageWorld, HTuple cameraParam, HTuple worldPose, HTuple width, HTuple height, HTuple scale, HTuple interpolation)

HImage HImage.ImageToWorldPlane(HCamPar cameraParam, HPose worldPose, int width, int height, HTuple scale, string interpolation)

HImage HImage.ImageToWorldPlane(HCamPar cameraParam, HPose worldPose, int width, int height, string scale, string interpolation)

HImage HCamPar.ImageToWorldPlane(HImage image, HPose worldPose, int width, int height, HTuple scale, string interpolation)

HImage HCamPar.ImageToWorldPlane(HImage image, HPose worldPose, int width, int height, string scale, string interpolation)

HImage HPose.ImageToWorldPlane(HImage image, HCamPar cameraParam, int width, int height, HTuple scale, string interpolation)

HImage HPose.ImageToWorldPlane(HImage image, HCamPar cameraParam, int width, int height, string scale, string interpolation)

Description

image_to_world_planeimage_to_world_planeImageToWorldPlaneImageToWorldPlaneImageToWorldPlane rectifies an image ImageImageImageImageimage by transforming it into the plane z=0 (plane of measurements) in a world coordinate system. The resulting rectified image ImageWorldImageWorldImageWorldImageWorldimageWorld shows neither radial nor perspective distortions; it corresponds to an image acquired by a distortion-free camera that looks perpendicularly onto the plane of measurements. The world coordinate system is chosen by passing its 3D pose relative to the camera coordinate system in WorldPoseWorldPoseWorldPoseWorldPoseworldPose. In CameraParamCameraParamCameraParamCameraParamcameraParam you must pass the internal camera parameters (see calibrate_camerascalibrate_camerasCalibrateCamerasCalibrateCamerasCalibrateCameras for the sequence of the parameters and the underlying camera model).

In many cases CameraParamCameraParamCameraParamCameraParamcameraParam and WorldPoseWorldPoseWorldPoseWorldPoseworldPose are the result of calibrating the camera with the operator calibrate_camerascalibrate_camerasCalibrateCamerasCalibrateCamerasCalibrateCameras. See below for an example.

The pixel position of the upper left corner of the output image ImageWorldImageWorldImageWorldImageWorldimageWorld is determined by the origin of the world coordinate system. The size of the output image ImageWorldImageWorldImageWorldImageWorldimageWorld can be chosen by the parameters WidthWidthWidthWidthwidth, HeightHeightHeightHeightheight, and ScaleScaleScaleScalescale. WidthWidthWidthWidthwidth and HeightHeightHeightHeightheight must be given in pixels.

With the parameter ScaleScaleScaleScalescale you can specify the size of a pixel in the transformed image. There are two typical scenarios: First, you can scale the image such that pixel coordinates in the transformed image directly correspond to metric units, e.g., that one pixel corresponds to one micron. This is useful if you want to perform measurements in the transformed image which will then directly result in metric results. The second scenario is to scale the image such that its content appears in a size similar to the original image. This is useful, e.g., if you want to perform shape-based matching in the transformed image.

ScaleScaleScaleScalescale must be specified as the ratio desired pixel size/original unit. A pixel size of 1um means that a pixel in the transformed image corresponds to the area 1um x 1um in the plane of measurements. 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 use the parameter values 'm'"m""m""m""m", 'cm'"cm""cm""cm""cm", 'mm'"mm""mm""mm""mm", 'microns'"microns""microns""microns""microns", or 'um'"um""um""um""um" to directly set the unit of pixel coordinates in the transformed image.

The parameter InterpolationInterpolationInterpolationInterpolationinterpolation specifies, whether bilinear interpolation ('bilinear'"bilinear""bilinear""bilinear""bilinear") should be applied between the pixels in the input image or whether the gray value of the nearest neighboring pixel ('nearest_neighbor'"nearest_neighbor""nearest_neighbor""nearest_neighbor""nearest_neighbor") should be used.

If several images have to be rectified using the same parameters, gen_image_to_world_plane_mapgen_image_to_world_plane_mapGenImageToWorldPlaneMapGenImageToWorldPlaneMapGenImageToWorldPlaneMap in combination with map_imagemap_imageMapImageMapImageMapImage is much more efficient than the operator image_to_world_planeimage_to_world_planeImageToWorldPlaneImageToWorldPlaneImageToWorldPlane because the mapping function needs to be computed only once.

Attention

image_to_world_planeimage_to_world_planeImageToWorldPlaneImageToWorldPlaneImageToWorldPlane can be executed on OpenCL devices if the input image does not exceed the maximum size of image objects of the selected device. There can be slight differences in the output compared to the execution on the CPU.

Execution Information

Parameters

ImageImageImageImageimage (input_object)  (multichannel-)image(-array) objectHImageHImageHobject (byte / uint2 / real)

Input image.

ImageWorldImageWorldImageWorldImageWorldimageWorld (output_object)  (multichannel-)image(-array) objectHImageHImageHobject * (byte / uint2 / real)

Transformed image.

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

Internal camera parameters.

WorldPoseWorldPoseWorldPoseWorldPoseworldPose (input_control)  pose HPose, HTupleHTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

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

Number of elements: 7

WidthWidthWidthWidthwidth (input_control)  extent.x HTupleHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Width of the resulting image in pixels.

Restriction: Width >= 1

HeightHeightHeightHeightheight (input_control)  extent.y HTupleHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Height of the resulting image in pixels.

Restriction: Height >= 1

ScaleScaleScaleScalescale (input_control)  number HTupleHTupleHtuple (string / integer / real) (string / int / long / double) (HString / Hlong / double) (char* / Hlong / double)

Scale or unit

Default value: 'm' "m" "m" "m" "m"

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

Restriction: Scale > 0

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

Type of interpolation.

Default value: 'bilinear' "bilinear" "bilinear" "bilinear" "bilinear"

List of values: 'bilinear'"bilinear""bilinear""bilinear""bilinear", 'nearest_neighbor'"nearest_neighbor""nearest_neighbor""nearest_neighbor""nearest_neighbor"

Example (HDevelop)

* Calibrate camera.
calibrate_cameras (CalibDataID, Error)
* Obtain camera parameters.
get_calib_data (CalibDataID, 'camera', 0, 'params', CamParam)
* Example values, if no calibration data is available:
CamParam := ['area_scan_division', 0.0087, -1859, 8.65e-006, 8.6e-006, \
             362.5, 291.6, 768, 576]
* Get reference pose (pose 4 of calibration object 0).
get_calib_data (CalibDataID, 'calib_obj_pose',\
                [0,4], 'pose', Pose)
* Example values, if no calibration data is available:
Pose := [-0.11, -0.21, 2.51, 352.73, 346.73, 336.48, 0]
* Compensate thickness of plate.
set_origin_pose (Pose, -1.125, -1.0, 0, PoseNewOrigin)
* Transform the image into the world plane.
read_image (Image, 'calib/calib-3d-coord-04')
image_to_world_plane (Image, ImageWorld, CamParam, PoseNewOrigin,\
                      900, 800, 0.0025, 'bilinear')

Result

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

Possible Predecessors

create_posecreate_poseCreatePoseCreatePoseCreatePose, hom_mat3d_to_posehom_mat3d_to_poseHomMat3dToPoseHomMat3dToPoseHomMat3dToPose, camera_calibrationcamera_calibrationCameraCalibrationCameraCalibrationCameraCalibration, hand_eye_calibrationhand_eye_calibrationHandEyeCalibrationHandEyeCalibrationHandEyeCalibration, set_origin_poseset_origin_poseSetOriginPoseSetOriginPoseSetOriginPose

Alternatives

gen_image_to_world_plane_mapgen_image_to_world_plane_mapGenImageToWorldPlaneMapGenImageToWorldPlaneMapGenImageToWorldPlaneMap, map_imagemap_imageMapImageMapImageMapImage

See also

contour_to_world_plane_xldcontour_to_world_plane_xldContourToWorldPlaneXldContourToWorldPlaneXldContourToWorldPlaneXld, image_points_to_world_planeimage_points_to_world_planeImagePointsToWorldPlaneImagePointsToWorldPlaneImagePointsToWorldPlane

Module

Calibration


ClassesClasses | | Operators