Skip to content

Pose

Processors for pose estimation

[source]

SolvePNP

paz.processors.pose.SolvePNP(points3D, camera, solver=0)

Calculates 6D pose from 3D points and 2D keypoints correspondences.

Arguments

  • model_points: Numpy array of shape [num_points, 3]. Model 3D points known in advance.
  • camera: Instance of ''paz.backend.Camera'' containing as properties the camera_intrinsics a Numpy array of shape [3, 3] usually calculated from the openCV calibrateCamera function, and the distortion a Numpy array of shape [5] in which the elements are usually obtained from the openCV calibrateCamera function.
  • solver: Flag specifying solvers. Current solvers are: paz.processors.LEVENBERG_MARQUARDT and paz.processors.UPNP.

Returns

Instance from Pose6D message.


[source]

SolveChangingObjectPnPRANSAC

paz.processors.pose.SolveChangingObjectPnPRANSAC(camera_intrinsics, inlier_thresh=5, num_iterations=100)

Returns rotation (Roc) and translation (Toc) vectors that transform 3D points in object frame to camera frame.

O------------O /| /| / | / | O------------O | | | z | | | O_|_|__O | / |___y| / object | / / | / coordinates |/ x |/ O------------O


Z | / | Rco, Tco /_____X <------| | | camera Y coordinates

Arguments

  • object_points3D: Array (num_points, 3). Points 3D in object reference frame. Represented as (0) in image above.
  • image_points2D: Array (num_points, 2). Points in 2D in camera UV space.
  • camera_intrinsics: Array of shape (3, 3). Diagonal elements represent focal lenghts and last column the image center translation.
  • inlier_threshold: Number of inliers for RANSAC method.
  • num_iterations: Maximum number of iterations.

Returns

Boolean indicating success, rotation vector in axis-angle form (3) and translation vector (3).


[source]

Translation3DFromBoxWidth

paz.processors.pose.Translation3DFromBoxWidth(camera, real_width=0.3)

Computes 3D translation from box width and real width ratio.

Arguments

  • camera: Instance of ''paz.backend.Camera'' containing as properties the camera_intrinsics a Numpy array of shape [3, 3] usually calculated from the openCV calibrateCamera function, and the distortion a Numpy array of shape [5] in which the elements are usually obtained from the openCV calibrateCamera function.
  • real_width: Real width of the predicted box2D.

Returns

Array (num_boxes, 3) containing all 3D translations.