Operator Reference

disparity_to_distanceT_disparity_to_distanceDisparityToDistanceDisparityToDistancedisparity_to_distance (Operator)

disparity_to_distanceT_disparity_to_distanceDisparityToDistanceDisparityToDistancedisparity_to_distance — Transform a disparity value into a distance value in a rectified binocular stereo system.

Signature

disparity_to_distance( : : CamParamRect1, CamParamRect2, RelPoseRect, Disparity : Distance)

Herror T_disparity_to_distance(const Htuple CamParamRect1, const Htuple CamParamRect2, const Htuple RelPoseRect, const Htuple Disparity, Htuple* Distance)

void DisparityToDistance(const HTuple& CamParamRect1, const HTuple& CamParamRect2, const HTuple& RelPoseRect, const HTuple& Disparity, HTuple* Distance)

HTuple HCamPar::DisparityToDistance(const HCamPar& CamParamRect2, const HPose& RelPoseRect, const HTuple& Disparity) const

double HCamPar::DisparityToDistance(const HCamPar& CamParamRect2, const HPose& RelPoseRect, double Disparity) const

HTuple HPose::DisparityToDistance(const HCamPar& CamParamRect1, const HCamPar& CamParamRect2, const HTuple& Disparity) const

double HPose::DisparityToDistance(const HCamPar& CamParamRect1, const HCamPar& CamParamRect2, double Disparity) const

def disparity_to_distance(cam_param_rect_1: Sequence[Union[int, float, str]], cam_param_rect_2: Sequence[Union[int, float, str]], rel_pose_rect: Sequence[Union[int, float]], disparity: MaybeSequence[Union[int, float]]) -> Sequence[float]

def disparity_to_distance_s(cam_param_rect_1: Sequence[Union[int, float, str]], cam_param_rect_2: Sequence[Union[int, float, str]], rel_pose_rect: Sequence[Union[int, float]], disparity: MaybeSequence[Union[int, float]]) -> float

Description

disparity_to_distancedisparity_to_distanceDisparityToDistanceDisparityToDistancedisparity_to_distance transforms a disparity value into a distance of an object point to the binocular stereo system. The cameras of this system must be rectified and are defined by the rectified internal parameters CamParamRect1CamParamRect1CamParamRect1camParamRect1cam_param_rect_1 of camera 1 and CamParamRect2CamParamRect2CamParamRect2camParamRect2cam_param_rect_2 of camera 2, and the external parameters RelPoseRectRelPoseRectRelPoseRectrelPoseRectrel_pose_rect. Latter specifies the relative pose of both cameras to each other by defining a point transformation from rectified camera system 2 to rectified camera system 1. These parameters can be obtained from the operator calibrate_camerascalibrate_camerasCalibrateCamerasCalibrateCamerascalibrate_cameras and gen_binocular_rectification_mapgen_binocular_rectification_mapGenBinocularRectificationMapGenBinocularRectificationMapgen_binocular_rectification_map. The disparity value DisparityDisparityDisparitydisparitydisparity is defined by the column difference of the image coordinates of two corresponding points on an epipolar line according to the equation (see also binocular_disparitybinocular_disparityBinocularDisparityBinocularDisparitybinocular_disparity). This value characterises a set of 3D object points of an equal distance to a plane being parallel to the rectified image plane of the stereo system. The distance to the subset plane z=0 which is parallel to the rectified image plane and contains the optical centers of both cameras is returned in DistanceDistanceDistancedistancedistance.

Attention

If using cameras with telecentric lenses, the DistanceDistanceDistancedistancedistance is not defined as the distance of a point to the camera but as the distance from the point to the plane, defined by the y-axes of both cameras and their baseline (see gen_binocular_rectification_mapgen_binocular_rectification_mapGenBinocularRectificationMapGenBinocularRectificationMapgen_binocular_rectification_map).

For a stereo setup of mixed type (i.e., for a stereo setup in which one of the original cameras is a perspective camera and the other camera is a telecentric camera; see gen_binocular_rectification_mapgen_binocular_rectification_mapGenBinocularRectificationMapGenBinocularRectificationMapgen_binocular_rectification_map), the rectifying plane of the two cameras is in a position with respect to the object that would lead to very unintuitive distances. Therefore, disparity_to_distancedisparity_to_distanceDisparityToDistanceDisparityToDistancedisparity_to_distance does not support stereo setups of mixed type. For stereo setups of mixed type, disparity_to_point_3ddisparity_to_point_3dDisparityToPoint3dDisparityToPoint3ddisparity_to_point_3d should be used instead.

Additionally, stereo setups that contain cameras with and without hypercentric lenses at the same time are not supported.

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

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

Rectified internal camera parameters of camera 1.

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

Rectified internal camera parameters of camera 2.

RelPoseRectRelPoseRectRelPoseRectrelPoseRectrel_pose_rect (input_control)  pose HPose, HTupleSequence[Union[int, float]]HTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

Point transformation from the rectified camera 2 to the rectified camera 1.

Number of elements: 7

DisparityDisparityDisparitydisparitydisparity (input_control)  number(-array) HTupleMaybeSequence[Union[int, float]]HTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

Disparity between the images of the world point.

DistanceDistanceDistancedistancedistance (output_control)  real(-array) HTupleSequence[float]HTupleHtuple (real) (double) (double) (double)

Distance of a world point to the rectified camera system.

Result

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

Possible Predecessors

binocular_calibrationbinocular_calibrationBinocularCalibrationBinocularCalibrationbinocular_calibration, gen_binocular_rectification_mapgen_binocular_rectification_mapGenBinocularRectificationMapGenBinocularRectificationMapgen_binocular_rectification_map, map_imagemap_imageMapImageMapImagemap_image, binocular_disparitybinocular_disparityBinocularDisparityBinocularDisparitybinocular_disparity

Alternatives

binocular_distancebinocular_distanceBinocularDistanceBinocularDistancebinocular_distance

See also

distance_to_disparitydistance_to_disparityDistanceToDisparityDistanceToDisparitydistance_to_disparity, disparity_to_point_3ddisparity_to_point_3dDisparityToPoint3dDisparityToPoint3ddisparity_to_point_3d

Module

3D Metrology