mrdja.ransaclp.get_ransac_data_from_np_points_cuda
- mrdja.ransaclp.get_ransac_data_from_np_points_cuda(np_points: ndarray, ransac_iterator: Callable, ransac_iterations: int = 100, threshold: float = 0.1, verbosity_level: int = 0, inherited_verbose_string: str = '', seed: int | None = None) Dict[source]
Gets the ransac data from a file.
The ransac data is a dictionary with the following keys: - ransac_iterations_results: the results of the ransac iterations. It is a list, where each element is a dictionary with the following keys:
current_random_points: the current random points chosen to estimate the line
current_line: the current line estimated from the random points. Right now it is a numpy array with two points, the same as the current_random_points
threshold: the maximum distance from the line to consider a point as an inlier
number_inliers: the number of inliers
indices_inliers: the indices of the inliers in the point cloud
ransac_best_iteration_results: the best iteration results
- Parameters:
np_points (np.ndarray) – The point cloud data.
ransac_iterator (Callable, function that takes the point cloud data and returns the ransac data.) – The ransac iterator.
ransac_iterations (int) – The number of ransac iterations.
threshold (float) – The threshold.
audit_cloud (bool) – Whether to audit the cloud.
verbosity_level (int) – The verbosity level.
inherited_verbose_string (str) – The inherited verbose string.
seed (int) – The seed.
- Returns:
The ransac data.
- Return type:
dict
- Example:
>>> import open3d as o3d >>> import mrdja.ransaclp as ransaclp >>> import mrdja.ransac.coreransac as coreransac >>> office_dataset = o3d.data.OfficePointClouds() >>> office_filename = office_dataset.paths[0] >>> ransac_iterator = coreransac.get_ransac_line_iteration_results >>> ransac_iterations = 200 >>> threshold = 0.02 >>> seed = 42 >>> pcd = o3d.io.read_point_cloud(office_filename) >>> np_points = np.asarray(pcd.points) >>> ransac_data = ransaclp.get_ransac_data_from_filename(np_points, ransac_iterator = ransac_iterator, ransac_iterations = ransac_iterations, threshold = threshold, audit_cloud=True, seed = seed) >>> iterations_results = ransac_data["ransac_iterations_results"] >>> len(iterations_results) 200 >>> first_iteration_results = iterations_results[0] >>> first_iteration_results["current_random_points"] array([[1.88671875, 1.96484375, 1.91060746], [3.18359375, 1.89562058, 2.45703125]]) >>> first_iteration_results["current_line"] array([[1.88671875, 1.96484375, 1.91060746], [3.18359375, 1.89562058, 2.45703125]]) >>> first_iteration_results["threshold"] 0.02 >>> first_iteration_results["number_inliers"] 203 >>> first_iteration_results["indices_inliers"][:5] array([ 58884, 59966, 60516, 61070, 138037]) >>> best_iteration_results = ransac_data["ransac_best_iteration_results"] >>> best_iteration_results["current_random_points"] array([[1.85546875, 2.67396379, 2.08203125], [0.85546875, 2.57869077, 2.52734375]]) >>> best_iteration_results["current_line"] array([[1.85546875, 2.67396379, 2.08203125], [0.85546875, 2.57869077, 2.52734375]]) >>> best_iteration_results["threshold"] 0.02 >>> best_iteration_results["number_inliers"] 2128 >>> best_iteration_results["indices_inliers"][:5] array([24335, 25743, 25746, 25897, 26405])