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.


[source]

MatchPoses

paz.processors.pose.MatchPoses(prior_boxes, iou=0.5)

Match prior boxes with ground truth poses.

Arguments

  • prior_boxes: Numpy array of shape (num_boxes, 4).
  • iou: Float in [0, 1]. Intersection over union in which prior boxes will be considered positive. A positive box is box with a class different than background.

[source]

RotationMatrixToAxisAngle

paz.processors.pose.RotationMatrixToAxisAngle(num_pose_dims)

Computes axis angle rotation vector from a rotation matrix.

Arguments:

  • num_pose_dims: Int, number of dimensions of pose.

Returns:

  • transformed_rotations: Array of shape (5,) containing transformed rotation.

[source]

ConcatenatePoses

paz.processors.pose.ConcatenatePoses()

Concatenates rotations and translations into a single array.

Returns:

  • poses_combined: Array of shape (num_boxes, 10) containing the transformed rotation.

[source]

ConcatenateScale

paz.processors.pose.ConcatenateScale()

Concatenates poses with image scale into a single array.

Returns:

  • poses_combined: Array of shape (num_prior_boxes, 11) containing the transformed rotation.

[source]

AugmentPose6D

paz.processors.pose.AugmentPose6D(camera_matrix, scale_min=0.7, scale_max=1.3, angle_min=0, angle_max=360, probability=0.5, mask_value=255, input_size=512)

Augment images, boxes, rotation and translation vector for pose estimation.

Arguments

  • camera_matrix: Array with camera matrix of shape (3, 3).
  • scale_min: Float, minimum value to scale image.
  • scale_max: Float, maximum value to scale image.
  • angle_min: Int, minimum degree to rotate image.
  • angle_max: Int, maximum degree to rotate image.
  • probability: Float, probability of data transformation.
  • mask_value: Int, pixel gray value of foreground in mask image.
  • input_size: Int, input image size of the model.

[source]

ToPose6D

paz.processors.pose.ToPose6D(class_names=None, one_hot_encoded=False, default_score=1.0, default_class=None, box_method=0)

Transforms poses i.e rotations and translations into Pose6D messages.

Arguments

  • class_names: List of class names ordered with respect to the class indices from the dataset boxes.
  • one_hot_encoded: Bool, indicating if scores are one hot vectors.
  • default_score: Float, score to set.
  • default_class: Str, class to set.
  • box_method: Int, method to convert boxes to Boxes2D.

Properties

  • one_hot_encoded: Bool.
  • box_processor: Callable.

Methods

call()


[source]

BoxesWithOneHotVectorsToPose6D

paz.processors.pose.BoxesWithOneHotVectorsToPose6D(arg_to_class)

Transforms poses into Pose6D messages given boxes with scores as one hot vectors.

Arguments

  • arg_to_class: List, of classes.

Properties

  • arg_to_class: List.

Methods

call()


[source]

BoxesToPose6D

paz.processors.pose.BoxesToPose6D(default_score=1.0, default_class=None)

Transforms poses into Pose6D messages given no class names and score.

Arguments

  • default_score: Float, score to set.
  • default_class: Str, class to set.

Properties

  • default_score: Float.
  • default_class: Str.

Methods

call()


[source]

BoxesWithClassArgToPose6D

paz.processors.pose.BoxesWithClassArgToPose6D(arg_to_class, default_score=1.0)

Transforms poses into Pose6D messages given boxes with class argument.

Arguments

  • default_score: Float, score to set.
  • arg_to_class: List, of classes.

Properties

  • default_score: Float.
  • arg_to_class: List.

Methods

call()