Visual Servoing Platform version 3.7.0
Loading...
Searching...
No Matches
visp.python.rbt.TrackedDescriptorMap.TrackedDescriptorMap Class Reference

Public Member Functions

 __init__ (self, int num_points, float reprojection_threshold, float min_dist_new_point, float max_depth_error_visible)
 reset (self)
 parse_settings (self, Dict[str, Any] d)
bool has_points (self)
List[int] update (self, RBFeatureTrackerInput frame, HomogeneousMatrix cMo, ImageFloat render_depth, ImageFloat depth_map, np.ndarray idx_curr_matched, np.ndarray idx_matched_map, np.ndarray current_kps, torch.Tensor current_descriptors)
 mark_points_to_remove (self, indices)
 set_points_to_add (self, Matrix X, torch.tensor descriptors, Matrix normals)
List[int] finalize_update (self)
Matrix get_px_proj (self, np.ndarray indices, CameraParameters cam, HomogeneousMatrix cMo)

Public Attributes

Optional[torch.tensor] descriptors = None
tuple data_for_update = None
 indices_removal = None
float reprojection_threshold = reprojection_threshold
int num_points = num_points
float min_dist_new_point = min_dist_new_point
float max_depth_error_visible = max_depth_error_visible
float max_depth_error_candidates = 0.0
 point_map = PointMap(self.num_points, self.min_dist_new_point, self.max_depth_error_visible, self.max_depth_error_candidates, self.reprojection_threshold)
 max_normal_deg = d.get('maxNormalThresholdVisible', 180)

Detailed Description

A map that associates 3D points in a common frame to a visual descriptive representation (i.e., an XFeat or Sift descriptor).
The map has a maximum number of points that are stored and least recently added points are replaced first when maximum capacity is reached.

Definition at line 46 of file TrackedDescriptorMap.py.

Constructor & Destructor Documentation

◆ __init__()

visp.python.rbt.TrackedDescriptorMap.TrackedDescriptorMap.__init__ ( self,
int num_points,
float reprojection_threshold,
float min_dist_new_point,
float max_depth_error_visible )
_summary_

Args:
    num_points (int): Maximum number of points that can be stored in the map.
    reprojection_threshold (float): Reprojection threshold (in pixels) that is used to filter outliers.
    When map points are matched with points in an image,
    if their reprojection is too far from the actually observed point, then they are marked as outliers and removed.
    min_dist_new_point (float): Minimum distance (in meters) that a point should have to all the map points to be considered as a candidate for addition to the map
    max_depth_error_visible (float): Maximum depth (in meters) error that is tolerated for a point to be considered as visible. Used to filter out self occlusion.

Definition at line 51 of file TrackedDescriptorMap.py.

Member Function Documentation

◆ finalize_update()

List[int] visp.python.rbt.TrackedDescriptorMap.TrackedDescriptorMap.finalize_update ( self)
Actually remove outliers and add new points to the map.
This step needs to be done in one go so as to not invalidate any indexing that was done prior to this.

Returns:
  List[int]: The indices of the points that were removed

Definition at line 183 of file TrackedDescriptorMap.py.

References data_for_update, descriptors, indices_removal, and point_map.

Referenced by update().

◆ get_px_proj()

Matrix visp.python.rbt.TrackedDescriptorMap.TrackedDescriptorMap.get_px_proj ( self,
np.ndarray indices,
CameraParameters cam,
HomogeneousMatrix cMo )
Helper function to compute the pixel coordinates of a set of map points.

Args:
    indices (np.ndarray): The indices of the points for which to compute the projection
    cam (CameraParameters): Camera intrinsics
    cMo (HomogeneousMatrix): Camera to map reference pose

Returns:
    Matrix: a indices.shape[0] x 2 Matrix containing the pixel coordinates of the 3D points in the camera frame

Definition at line 216 of file TrackedDescriptorMap.py.

References point_map.

◆ has_points()

bool visp.python.rbt.TrackedDescriptorMap.TrackedDescriptorMap.has_points ( self)
Returns whether this map stores any points.

Returns:
    bool: _description_

Definition at line 99 of file TrackedDescriptorMap.py.

References point_map.

Referenced by update().

◆ mark_points_to_remove()

visp.python.rbt.TrackedDescriptorMap.TrackedDescriptorMap.mark_points_to_remove ( self,
indices )

Definition at line 173 of file TrackedDescriptorMap.py.

References indices_removal.

Referenced by update().

◆ parse_settings()

visp.python.rbt.TrackedDescriptorMap.TrackedDescriptorMap.parse_settings ( self,
Dict[str, Any] d )
Update map settings from a dictionary

Args:
    d (_type_): Dictionary containing the map parameters

Definition at line 79 of file TrackedDescriptorMap.py.

References max_depth_error_candidates, max_depth_error_visible, min_dist_new_point, num_points, and reprojection_threshold.

◆ reset()

visp.python.rbt.TrackedDescriptorMap.TrackedDescriptorMap.reset ( self)

Definition at line 73 of file TrackedDescriptorMap.py.

References data_for_update, descriptors, indices_removal, and point_map.

◆ set_points_to_add()

visp.python.rbt.TrackedDescriptorMap.TrackedDescriptorMap.set_points_to_add ( self,
Matrix X,
torch.tensor descriptors,
Matrix normals )

Definition at line 176 of file TrackedDescriptorMap.py.

References data_for_update.

Referenced by update().

◆ update()

List[int] visp.python.rbt.TrackedDescriptorMap.TrackedDescriptorMap.update ( self,
RBFeatureTrackerInput frame,
HomogeneousMatrix cMo,
ImageFloat render_depth,
ImageFloat depth_map,
np.ndarray idx_curr_matched,
np.ndarray idx_matched_map,
np.ndarray current_kps,
torch.Tensor current_descriptors )
 Update the map: Remove outliers and add new points

Args:
    frame (RBFeatureTrackerInput): Input frame
    cMo (HomogeneousMatrix): Current pose corresponding to the acquired frame
    render_depth (ImageFloat): Depth in render
    depth_map (ImageFloat): Depth observed by the camera (can be zero sized image, in which case it isn't used)
    idx_curr_matched (np.ndarray): Indices of the points points that were matched for the set of current keypoints (in the camera frame).
    idx_matched_map (np.ndarray): Indices of the points that were matched for the set of points from this map. After this method has been called it may no longer be valid.
    current_kps (np.ndarray): N x 2 array that contains the pixel locations of all the keypoints detected in the image. Will be indexed with idx_curr_matched
    current_descriptors (torch.Tensor): N x D tensor containing the descriptors associated to the keypoints observed in the image.

Returns:
    List[int]: The indices of the points that were removed

Definition at line 107 of file TrackedDescriptorMap.py.

References descriptors, finalize_update(), has_points(), mark_points_to_remove(), point_map, and set_points_to_add().

Member Data Documentation

◆ data_for_update

tuple visp.python.rbt.TrackedDescriptorMap.TrackedDescriptorMap.data_for_update = None

Definition at line 63 of file TrackedDescriptorMap.py.

Referenced by finalize_update(), reset(), and set_points_to_add().

◆ descriptors

◆ indices_removal

visp.python.rbt.TrackedDescriptorMap.TrackedDescriptorMap.indices_removal = None

Definition at line 64 of file TrackedDescriptorMap.py.

Referenced by finalize_update(), mark_points_to_remove(), and reset().

◆ max_depth_error_candidates

visp.python.rbt.TrackedDescriptorMap.TrackedDescriptorMap.max_depth_error_candidates = 0.0

Definition at line 70 of file TrackedDescriptorMap.py.

Referenced by parse_settings().

◆ max_depth_error_visible

visp.python.rbt.TrackedDescriptorMap.TrackedDescriptorMap.max_depth_error_visible = max_depth_error_visible

Definition at line 69 of file TrackedDescriptorMap.py.

Referenced by parse_settings().

◆ max_normal_deg

visp.python.rbt.TrackedDescriptorMap.TrackedDescriptorMap.max_normal_deg = d.get('maxNormalThresholdVisible', 180)

Definition at line 90 of file TrackedDescriptorMap.py.

◆ min_dist_new_point

visp.python.rbt.TrackedDescriptorMap.TrackedDescriptorMap.min_dist_new_point = min_dist_new_point

Definition at line 68 of file TrackedDescriptorMap.py.

Referenced by parse_settings().

◆ num_points

visp.python.rbt.TrackedDescriptorMap.TrackedDescriptorMap.num_points = num_points

Definition at line 67 of file TrackedDescriptorMap.py.

Referenced by parse_settings().

◆ point_map

visp.python.rbt.TrackedDescriptorMap.TrackedDescriptorMap.point_map = PointMap(self.num_points, self.min_dist_new_point, self.max_depth_error_visible, self.max_depth_error_candidates, self.reprojection_threshold)

Definition at line 71 of file TrackedDescriptorMap.py.

Referenced by finalize_update(), get_px_proj(), has_points(), reset(), and update().

◆ reprojection_threshold

visp.python.rbt.TrackedDescriptorMap.TrackedDescriptorMap.reprojection_threshold = reprojection_threshold

Definition at line 66 of file TrackedDescriptorMap.py.

Referenced by parse_settings().