22 #pragma warning(disable : 4715)
29 #ifdef CV_RANSAC_SUPPORT
30 py::class_<geometry::RansacResult> ransacResult(m,
"RansacResult",
32 py::detail::bind_default_constructor<geometry::RansacResult>(ransacResult);
33 py::detail::bind_copy_functions<geometry::RansacResult>(ransacResult);
34 ransacResult.def(py::init<>())
36 [](
const geometry::RansacResult&
result) {
38 "geometry::RansacResult with "
39 "points indices size = ") +
41 " , drawing precision = " +
43 " and primitive type = " +
result.getTypeName();
45 .def(
"get_type_name", &geometry::RansacResult::getTypeName,
46 "Returns type name (sphere, cylinder, etc.).")
47 .def(
"get_drawing_Precision",
48 &geometry::RansacResult::getDrawingPrecision,
49 "Returns drawing precision (or 0 if feature is not "
51 .def(
"set_drawing_Precision",
52 &geometry::RansacResult::setDrawingPrecision,
53 "Sets drawing precision."
54 "Warning: steps should always be >= "
55 "ccGenericPrimitive::MIN_DRAWING_PRECISION = 4",
57 .def_readwrite(
"indices", &geometry::RansacResult::indices,
59 .def_readwrite(
"primitive", &geometry::RansacResult::primitive,
60 "The ransac primitive mesh shape.");
64 m,
"RansacResult",
"set_drawing_Precision",
65 {{
"steps",
"The steps drawing precision."}});
68 py::class_<geometry::RansacParams> ransacParam(m,
"RansacParams",
69 "Ransac SD Parameters.");
70 py::detail::bind_default_constructor<geometry::RansacParams>(ransacParam);
71 py::detail::bind_copy_functions<geometry::RansacParams>(ransacParam);
72 ransacParam.def(py::init<float>(),
"scale"_a)
74 [](
const geometry::RansacParams& param) {
76 "geometry::RansacParams with "
79 " and bitmapEpsilon = " +
81 " and supportPoints = " +
83 " and maxNormalDev_deg = " +
85 " and probability = " +
87 " and randomColor = " +
94 .def_readwrite(
"epsilon", &geometry::RansacParams::epsilon,
95 "Distance threshold.")
96 .def_readwrite(
"bit_map_epsilon",
97 &geometry::RansacParams::bitmapEpsilon,
99 .def_readwrite(
"support_points",
100 &geometry::RansacParams::supportPoints,
101 "This is the minimal numer of points required for a "
104 "max_normal_deviation_deg",
105 &geometry::RansacParams::maxNormalDev_deg,
106 "Maximal normal deviation from ideal shape (in degrees).")
107 .def_readwrite(
"probability", &geometry::RansacParams::probability,
108 "Probability that no better candidate was "
109 "overlooked during sampling.")
110 .def_readwrite(
"random_color", &geometry::RansacParams::randomColor,
111 "Should the resulting detected shapes sub point "
112 "cloud be colored randomly.")
113 .def_readwrite(
"prim_enabled_list",
114 &geometry::RansacParams::primEnabled,
115 "RANSAC PRIMITIVE TYPES.")
116 .def_readwrite(
"min_radius", &geometry::RansacParams::minRadius,
117 "Minimum radius threshold.")
118 .def_readwrite(
"max_radius", &geometry::RansacParams::maxRadius,
119 "Maximum radius threshold.");
122 py::native_enum<geometry::RansacParams::RANSAC_PRIMITIVE_TYPES>(
123 ransacParam,
"RANSAC_PRIMITIVE_TYPES",
"enum.Enum",
124 "Enum class for Ransac Primitive types.")
125 .value(
"Plane", geometry::RansacParams::RPT_PLANE)
126 .value(
"Sphere", geometry::RansacParams::RPT_SPHERE)
127 .value(
"Cylinder", geometry::RansacParams::RPT_CYLINDER)
128 .value(
"Cone", geometry::RansacParams::RPT_CONE)
129 .value(
"Torus", geometry::RansacParams::RPT_TORUS)
134 py::class_<ccPointCloud, PyGeometry<ccPointCloud>,
136 pointcloud(m,
"ccPointCloud", py::multiple_inheritance(),
137 "ccPointCloud class. A point cloud consists of point "
138 "coordinates, and optionally point colors and point "
140 py::detail::bind_default_constructor<ccPointCloud>(pointcloud);
141 py::detail::bind_copy_functions<ccPointCloud>(pointcloud);
143 .def(py::init([](
const std::string&
name) {
147 .def(py::init<
const std::vector<Eigen::Vector3d>&,
148 const std::string&>(),
149 "Create a PointCloud from points",
"points"_a,
153 return std::string(
"ccPointCloud with ") +
156 .def(py::self + py::self)
157 .def(py::self += py::self)
159 "Returns ``True`` if the point cloud contains covariances.")
161 "Normalize point normals to length 1.")
164 "Assigns each point in the PointCloud the same color.")
166 "Function to select points from input pointcloud into output "
168 "indices"_a,
"invert"_a =
false)
170 "Function to downsample input pointcloud into output "
172 "a voxel. Normals and colors are averaged if they exist.",
174 .def(
"voxel_down_sample_and_trace",
176 "Function to downsample using "
177 "ccPointCloud::VoxelDownSample. Also records point "
178 "cloud index before down sampling",
179 "voxel_size"_a,
"min_bound"_a,
"max_bound"_a,
180 "approximate_class"_a =
false)
182 "Function to downsample input pointcloud into output "
184 "uniformly. The sample is performed in the order of the "
186 "the 0-th point always chosen, not at random.",
189 "Function to downsample input pointcloud into output "
191 "randomly. The sample is generated by randomly sampling "
192 "the indexes from the point cloud.",
194 .def(
"farthest_point_down_sample",
196 "Downsamples input pointcloud into output pointcloud with a "
197 "set of points has farthest distance. The sample is performed "
198 "by selecting the farthest point from previous selected "
199 "points iteratively.",
201 "Index to start downsampling from. Valid index is a "
202 "non-negative number less than number of points in the "
209 "Function to crop input pointcloud into output pointcloud",
215 "Function to crop input pointcloud into output pointcloud",
217 .def(
"remove_non_finite_points",
219 "Function to remove non-finite points from the PointCloud",
220 "remove_nan"_a =
true,
"remove_infinite"_a =
true)
222 "Function to remove points that have less than nb_points"
223 " in a given sphere of a given radius",
224 "nb_points"_a,
"radius"_a)
225 .def(
"remove_statistical_outlier",
227 "Function to remove points that are further away from their "
228 "neighbors in average",
229 "nb_neighbors"_a,
"std_ratio"_a)
231 "Function to compute the normals of a point cloud. Normals "
232 "are oriented with respect to the input point cloud if "
235 "fast_normal_computation"_a =
true)
236 .def(
"orient_normals_to_align_with_direction",
238 "Function to orient the normals of a point cloud",
239 "orientation_reference"_a = Eigen::Vector3d(0.0, 0.0, 1.0))
240 .def(
"orient_normals_towards_camera_location",
242 "Function to orient the normals of a point cloud",
243 "camera_location"_a = Eigen::Vector3d(0.0, 0.0, 0.0))
244 .def(
"orient_normals_consistent_tangent_plane",
246 "Function to orient the normals with respect to consistent "
249 .def(
"compute_point_cloud_distance",
251 "For each point in the source point cloud, compute the "
253 "the target point cloud.",
255 .def(
"compute_mahalanobis_distance",
257 "Function to compute the Mahalanobis distance for points in a "
260 "https://en.wikipedia.org/wiki/Mahalanobis_distance.")
261 .def(
"compute_nearest_neighbor_distance",
263 "Function to compute the distance from a point to its nearest "
264 "neighbor in the point cloud")
266 "Function to compute the point cloud resolution.")
268 "Computes the convex hull of the point cloud.")
270 "Removes hidden points from a point cloud and returns a mesh "
271 "of the remaining points. Based on Katz et al. 'Direct "
272 "Visibility of Point Sets', 2007. Additional information "
273 "about the choice of radius for noisy point clouds can be "
274 "found in Mehra et. al. 'Visibility of Noisy Point Cloud "
276 "camera_location"_a,
"radius"_a)
278 "Cluster PointCloud using the DBSCAN algorithm Ester et al., "
279 "'A Density-Based Algorithm for Discovering Clusters in Large "
280 "Spatial Databases with Noise', 1996. Returns a list of point "
281 "labels, -1 indicates noise according to the algorithm.",
282 "eps"_a,
"min_points"_a,
"print_progress"_a =
false)
283 #ifdef CV_RANSAC_SUPPORT
284 .def(
"execute_ransac", &ccPointCloud::ExecuteRANSAC,
285 "Cluster ccPointCloud using the RANSAC algorithm, "
286 "Wrapper to Schnabel et al. library for automatic"
287 " shape detection in point cloud ,Efficient RANSAC"
288 " for Point - Cloud Shape Detection, Ruwen Schnabel, "
289 "Roland Wahl, Returns a list of ransac point labels"
290 " and shape entity(ccGenericPrimitive)",
291 "params"_a = geometry::RansacParams(),
292 "print_progress"_a =
false)
295 "Segments a plane in the point cloud using the RANSAC "
297 "distance_threshold"_a,
"ransac_n"_a,
"num_iterations"_a)
299 "set point coordinate by given index.",
"index"_a,
"point"_a)
301 "get point coordinate by given index.",
"index"_a)
303 "get point coordinate by given index.",
"index"_a)
305 py::overload_cast<
const std::vector<Eigen::Vector3d>&>(
307 "``float64`` array of shape ``(num_points, 3)``, "
308 "use ``numpy.asarray()`` to access data: Points "
312 "``float64`` array of shape ``(num_points, 3)``, "
313 "use ``numpy.asarray()`` to access data: Points "
316 "``float64`` array of shape ``(num_points, 3)``, "
317 "use ``numpy.asarray()`` to access data: Points "
320 "set point color by given index.",
"index"_a,
"color"_a)
322 "get point color by given index.",
"index"_a)
324 "get point color by given index.",
"index"_a)
326 "``float64`` array of shape ``(num_points, 3)``, "
327 "range ``[0, 1]`` , use ``numpy.asarray()`` to access "
328 "data: RGB colors of points.",
331 "``float64`` array of shape ``(num_points, 3)``, "
332 "range ``[0, 1]`` , use ``numpy.asarray()`` to access "
333 "data: RGB colors of points.")
335 "``float64`` array of shape ``(num_points, 3)``, "
336 "range ``[0, 1]`` , use ``numpy.asarray()`` to access "
337 "data: RGB colors of points.")
339 "set point normal by given index.",
"index"_a,
"normal"_a)
341 "get point normal by given index.",
"index"_a)
343 "get point normal by given index.",
"index"_a)
345 "``float64`` array of shape ``(num_points, 3)``, "
346 "use ``numpy.asarray()`` to access data: Points normals.",
349 "``float64`` array of shape ``(num_points, 3)``, "
350 "use ``numpy.asarray()`` to access data: Points normals.")
352 "``float64`` array of shape ``(num_points, 3)``, "
353 "use ``numpy.asarray()`` to access data: Points normals.")
355 "Erases the cloud points.")
357 "Erases the cloud colors.")
359 "Erases the cloud normals.")
361 R
"(Notify a modification of color/scalar field display parameters or contents.)")
363 "Notify a modification of normals display parameters or "
366 "Notify a modification of points display parameters or "
369 "Reserves memory for all the active features.",
372 "Reserves memory to store the points coordinates.",
375 "Reserves memory to store the RGB colors.")
377 "Reserves memory to store the compressed normals.")
379 "Resizes all the active features arrays.",
"points_number"_a)
381 "Resizes the RGB colors array.",
"fill_with_white"_a =
false)
383 "Resizes the compressed normals array.")
385 "Removes unused capacity.")
388 "Returns cloud capacity (i.e. reserved size).")
390 "Invalidates bounding box.")
391 .def(
"set_current_input_sf_index",
393 " Sets the INPUT scalar field index (or -1 if none).",
395 .def(
"get_current_input_sf_index",
397 "Returns current INPUT scalar field index (or -1 if none).")
398 .def(
"set_current_output_sf_index",
400 " Sets the OUTPUT scalar field index (or -1 if none).",
402 .def(
"get_current_output_sf_index",
404 "Returns current OUTPUT scalar field index (or -1 if none).")
406 " Sets both the INPUT & OUTPUT scalar field.",
"index"_a)
408 "Returns the number of associated (and active) scalar fields.")
414 static_cast<int>(index)));
417 "[ccPointCloud] Do not have any scalar "
421 "Returns a pointer to a specific scalar field.",
"index"_a)
426 static_cast<int>(index)));
428 "Returns the name of a specific scalar field.",
"index"_a)
430 "get_sf_index_by_name",
434 "Returns the index of a scalar field represented by its "
438 "get_current_input_sf",
444 "[ccPointCloud] cloud input does not have "
445 "any scalar field!");
448 "Returns the scalar field currently associated to the "
451 "get_current_output_sf",
457 "[ccPointCloud] cloud output does not have "
458 "any scalar field!");
461 "Returns the scalar field currently associated to the "
466 const std::string&
name) {
470 "Renames a specific scalar field.",
"index"_a,
"name"_a)
472 "get_current_displayed_sf",
479 "[ccPointCloud] Do not have scalar "
483 "Returns the currently displayed scalar (or 0 if none).")
484 .def(
"set_current_displayed_sf",
486 "Sets the currently displayed scalar field.",
"index"_a)
487 .def(
"get_current_sf_index",
489 "Returns the currently displayed scalar field index (or -1 if "
492 "Deletes a specific scalar field.",
"index"_a)
494 "Deletes all scalar fields associated to this cloud.")
497 [](
ccPointCloud& cloud,
const std::string& unique_name) {
500 "Creates a new scalar field and registers it.",
507 "Creates a new scalar field and registers it.",
"sf"_a)
509 "Returns whether color scale should be displayed or not.")
511 "Sets whether color scale should be displayed or not.",
514 "compute_gravity_center",
519 "Returns the cloud gravity center")
523 unsigned char ortho_dim,
bool inside) {
525 cloud.
crop2D(&polyline, ortho_dim, inside);
526 if (!ref || ref->
size() == 0) {
533 "[ccPointCloud::crop2D] Invalid input "
538 "[ccPointCloud::crop2D] Invalid input "
543 "[ccPointCloud::crop2D] Cloud is "
547 return std::ref(cloud);
557 "[ccPointCloud::crop2D] Not enough "
559 return std::ref(cloud);
562 return std::ref(*croppedCloud);
564 "Crops the cloud inside (or outside) a 2D polyline",
565 "polyline"_a,
"ortho_dim"_a,
"inside"_a =
true)
567 "compute_closest_points",
569 unsigned char octree_level) {
571 other_cloud,
nullptr, octree_level));
573 "Computes the closest point of this cloud relatively to "
575 "other_cloud"_a,
"octree_level"_a = 0)
579 unsigned start_count,
bool ignore_children) {
580 return cloud.
append(&input_cloud, start_count,
583 "Appends a cloud to this one",
"input_cloud"_a,
584 "start_count"_a,
"ignore_children"_a =
false)
586 "interpolate_colors_from",
588 unsigned char octree_level) {
592 "Interpolate colors from another cloud (nearest neighbor "
594 "other_cloud"_a,
"octree_level"_a = 0)
596 "Converts normals to RGB colors.")
597 .def(
"convert_rgb_to_grey_scale",
599 "Converts RGB to grey scale colors.")
601 "Pushes a grey color on stack (shortcut).",
"grey"_a)
603 "Multiplies all color components of all points by "
607 "Assigns color to points by 'banding'.",
"dim"_a,
610 "Returns whether the mesh as an associated sensor or not.")
612 "Inverts normals (if any).")
613 .def(
"convert_current_sf_to_colors",
615 "Converts current scalar field (values & display parameters) "
617 "mix_with_existing_color"_a =
false)
618 .def(
"set_color_with_current_sf",
620 "Sets RGB colors with current scalar field (values & "
622 "mix_with_existing_color"_a =
false)
626 ScalarType max_val) {
629 "Hides points whose scalar values falls into an interval.",
630 "min_val"_a,
"max_val"_a)
633 [](
ccPointCloud& cloud, std::vector<ScalarType> values) {
636 "Hides points whose scalar values falls into an interval.",
639 "filter_points_by_sf",
641 ScalarType max_val,
bool outside) {
642 return std::shared_ptr<ccPointCloud>(
644 min_val, max_val, outside));
646 "Filters out points whose scalar values falls into an "
648 "min_val"_a,
"max_val"_a,
"outside"_a =
false)
650 "filter_points_by_sf",
653 return std::shared_ptr<ccPointCloud>(
657 "Filters out points whose scalar values falls into an "
659 "values"_a,
"outside"_a =
false)
661 "convert_normal_to_dipdir_sfs",
667 "[ccPointCloud] Failed to convert normal "
668 "to Dip and DipDir scalar fields!");
670 return std::make_tuple(
671 std::unique_ptr<ccScalarField, py::nodelete>(
673 std::unique_ptr<ccScalarField, py::nodelete>(
676 "Converts normals to two scalar fields: 'dip' and 'dip "
681 return std::shared_ptr<ccPointCloud>(
682 cloud.
cloneThis(
nullptr, ignore_children));
684 "All the main features of the entity are cloned, except "
685 "from the octree and"
686 " the points visibility information.",
687 "ignore_children"_a =
true)
691 std::shared_ptr<cloudViewer::ReferenceCloud> selection) {
692 return std::shared_ptr<ccPointCloud>(
695 "Creates a new point cloud object from a ReferenceCloud "
699 "enhance_rgb_with_intensity_sf",
701 bool use_intensity_range,
double min_intensity,
702 double max_intensity) {
704 sf_index, use_intensity_range, min_intensity,
707 "Enhances the RGB colors with the current scalar field "
708 "(assuming it's intensities).",
709 "sf_index"_a,
"use_intensity_range"_a =
false,
710 "min_intensity"_a = 0.0,
"max_intensity"_a = 1.0)
712 "export_coord_to_sf",
716 exportDims[0] = export_x;
717 exportDims[1] = export_y;
718 exportDims[2] = export_z;
721 "Exports the specified coordinate dimension(s) to scalar "
723 "export_x"_a =
false,
"export_y"_a =
false,
724 "export_z"_a =
false)
726 "export_normal_to_sf",
730 exportDims[0] = export_x;
731 exportDims[1] = export_y;
732 exportDims[2] = export_z;
735 "Exports the specified normal dimension(s) to scalar "
737 "export_x"_a =
false,
"export_y"_a =
false,
738 "export_z"_a =
false)
740 "Function to compute the covariance matrix for each point "
741 "in the point cloud",
744 "``float64`` array of shape ``(num_points, 3, 3)``, "
745 "use ``numpy.asarray()`` to access data: Points "
748 "estimate_point_covariances",
750 "Static function to compute the covariance matrix for "
752 "point in the given point cloud, doesn't change the input",
757 std::shared_ptr<const ccGenericPointCloud>
759 return std::shared_ptr<ccPointCloud>(
762 "'GenericCloud' is a very simple and light interface from "
764 "meant to give access to points coordinates of any "
766 "condition it implements the GenericCloud interface of "
768 "See cloudViewer documentation for more information about "
770 "As the GenericCloud interface is very simple, only points "
772 "Note : throws an 'int' exception in case of error(see "
774 "-param cloud a GenericCloud structure"
775 "-param source_cloud cloud from which main parameters will "
776 "be imported(optional)",
777 "cloud"_a,
"source_cloud"_a =
nullptr)
781 const std::vector<size_t>& indices) {
782 return std::shared_ptr<ccPointCloud>(
785 "Function to select points from input ccPointCloud into "
786 "output ccPointCloud."
787 "Points with indices in param indices are selected",
788 "source_cloud"_a,
"indices"_a)
790 "create_from_depth_image",
792 R
"(Factory function to create a pointcloud from a depth image and a
793 camera. Given depth value d at (u, v) image coordinate, the corresponding 3d
795 - z = d / depth_scale
796 - x = (u - cx) * z / fx
797 - y = (v - cy) * z / fy
799 "depth"_a,
"intrinsic"_a,
800 "extrinsic"_a = Eigen::Matrix4d::Identity(),
801 "depth_scale"_a = 1000.0,
"depth_trunc"_a = 1000.0,
802 "stride"_a = 1,
"project_valid_depth_only"_a =
true)
803 .def_static(
"create_from_rgbd_image",
805 "Factory function to create a pointcloud from an RGB-D "
806 "image and a camera. Given depth value d at (u, "
807 "v) image coordinate, the corresponding 3d point is: "
808 R
"(- z = d / depth_scale
809 - x = (u - cx) * z / fx
810 - y = (v - cy) * z / fy)",
811 "image"_a,
"intrinsic"_a,
812 "extrinsic"_a = Eigen::Matrix4d::Identity(),
813 "project_valid_depth_only"_a =
true);
835 m,
"ccPointCloud",
"estimate_point_covariances",
836 {{
"input",
"The input point cloud."},
838 "The KDTree search parameters for neighborhood search."}});
840 m,
"ccPointCloud",
"estimate_covariances",
842 "The KDTree search parameters for neighborhood search."}});
844 m,
"ccPointCloud",
"paint_uniform_color",
845 {{
"color",
"RGB color for the PointCloud."}});
847 m,
"ccPointCloud",
"select_by_index",
848 {{
"indices",
"Indices of points to be selected."},
850 "Set to ``True`` to invert the selection of indices."}});
852 m,
"ccPointCloud",
"voxel_down_sample",
853 {{
"voxel_size",
"Voxel size to downsample into."},
854 {
"invert",
"set to ``True`` to invert the selection of indices"}});
856 m,
"ccPointCloud",
"voxel_down_sample_and_trace",
857 {{
"voxel_size",
"Voxel size to downsample into."},
858 {
"min_bound",
"Minimum coordinate of voxel boundaries"},
859 {
"max_bound",
"Maximum coordinate of voxel boundaries"}});
861 m,
"ccPointCloud",
"uniform_down_sample",
863 "Sample rate, the selected point indices are [0, k, 2k, ...]"}});
865 m,
"ccPointCloud",
"random_down_sample",
867 "Sampling ratio, the ratio of number of selected points to total "
868 "number of points[0-1]"}});
870 m,
"ccPointCloud",
"crop",
871 {{
"bounding_box",
"ccBBox to crop points"}});
873 m,
"ccPointCloud",
"remove_non_finite_points",
874 {{
"remove_nan",
"Remove NaN values from the PointCloud"},
876 "Remove infinite values from the PointCloud"}});
878 m,
"ccPointCloud",
"remove_radius_outlier",
879 {{
"nb_points",
"Number of points within the radius."},
880 {
"radius",
"Radius of the sphere."}});
882 m,
"ccPointCloud",
"remove_statistical_outlier",
883 {{
"nb_neighbors",
"Number of neighbors around the target point."},
884 {
"std_ratio",
"Standard deviation ratio."}});
886 m,
"ccPointCloud",
"estimate_normals",
888 "The KDTree search parameters for neighborhood search."},
889 {
"fast_normal_computation",
890 "If true, the normal estiamtion uses a non-iterative method to "
891 "extract the eigenvector from the covariance matrix. This is "
892 "faster, but is not as numerical stable."}});
894 m,
"ccPointCloud",
"orient_normals_to_align_with_direction",
895 {{
"orientation_reference",
896 "Normals are oriented with respect to orientation_reference."}});
898 m,
"ccPointCloud",
"orient_normals_towards_camera_location",
900 "Normals are oriented with towards the camera_location."}});
902 m,
"ccPointCloud",
"orient_normals_consistent_tangent_plane",
904 "Number of k nearest neighbors used in constructing the "
905 "Riemannian graph used to propogate normal orientation."}});
907 "compute_point_cloud_distance",
908 {{
"target",
"The target point cloud."}});
910 "compute_mahalanobis_distance");
912 "compute_nearest_neighbor_distance");
915 {{
"input",
"The input point cloud."}});
917 m,
"ccPointCloud",
"hidden_point_removal",
918 {{
"input",
"The input point cloud."},
920 "All points not visible from that location will be removed"},
921 {
"radius",
"The radius of the sperical projection"}});
923 m,
"ccPointCloud",
"cluster_dbscan",
925 "Density parameter that is used to find neighboring points."},
926 {
"min_points",
"Minimum number of points to form a cluster."},
928 "If true the progress is visualized in the console."}});
930 m,
"ccPointCloud",
"segment_plane",
931 {{
"distance_threshold",
932 "Max distance a point can be from the plane model, and still be "
933 "considered an inlier."},
935 "Number of initial points to be considered inliers in each "
937 {
"num_iterations",
"Number of iterations."}});
939 m,
"ccPointCloud",
"create_from_depth_image",
941 "The input depth image can be either a float image, or a "
943 {
"intrinsic",
"Intrinsic parameters of the camera."},
944 {
"extrnsic",
"Extrinsic parameters of the camera."},
945 {
"depth_scale",
"The depth is scaled by 1 / depth_scale."},
946 {
"depth_trunc",
"Truncated at depth_trunc distance."},
948 "Sampling factor to support coarse point cloud extraction."}});
950 m,
"ccPointCloud",
"create_from_rgbd_image",
951 {{
"image",
"The input image."},
952 {
"intrinsic",
"Intrinsic parameters of the camera."},
953 {
"extrnsic",
"Extrinsic parameters of the camera."}});
972 "set_current_input_sf_index");
974 "get_current_input_sf_index");
976 "set_current_output_sf_index");
978 "get_current_output_sf_index");
988 "set_current_displayed_sf");
990 "get_current_displayed_sf");
998 "compute_gravity_center");
1001 "compute_closest_points");
1004 "interpolate_colors_from");
1007 "convert_rgb_to_grey_scale");
1014 "convert_current_sf_to_colors");
1016 "set_color_with_current_sf");
1020 "convert_normal_to_dipdir_sfs");
1024 "enhance_rgb_with_intensity_sf");
static Vector3Tpl fromArray(const int a[3])
Constructor from an int array.
A 3D cloud interface with associated features (color, normals, octree, etc.)
Hierarchical CLOUDVIEWER Object.
A 3D cloud and its associated features (color, normals, scalar fields, etc.)
std::tuple< std::shared_ptr< ccPointCloud >, Eigen::MatrixXi, std::vector< std::vector< int > > > VoxelDownSampleAndTrace(double voxel_size, const Eigen::Vector3d &min_bound, const Eigen::Vector3d &max_bound, bool approximate_class=false) const
Function to downsample using geometry.ccPointCloud.VoxelDownSample.
std::shared_ptr< ccPointCloud > Crop(const ccBBox &bbox) const
Function to crop ccPointCloud into output ccPointCloud.
void setCurrentDisplayedScalarField(int index)
Sets the currently displayed scalar field.
static std::shared_ptr< ccPointCloud > CreateFromRGBDImage(const cloudViewer::geometry::RGBDImage &image, const cloudViewer::camera::PinholeCameraIntrinsic &intrinsic, const Eigen::Matrix4d &extrinsic=Eigen::Matrix4d::Identity(), bool project_valid_depth_only=true)
Factory function to create a pointcloud from an RGB-D image and a camera model.
void setEigenColor(size_t index, const Eigen::Vector3d &color)
bool sfColorScaleShown() const
Returns whether color scale should be displayed or not.
bool setRGBColorByBanding(unsigned char dim, double freq)
Assigns color to points by 'banding'.
bool hasSensor() const
Returns whether the mesh as an associated sensor or not.
ccPointCloud & NormalizeNormals()
Normalize point normals to length 1.`.
std::tuple< std::shared_ptr< ccMesh >, std::vector< size_t > > HiddenPointRemoval(const Eigen::Vector3d &camera_location, const double radius) const
This is an implementation of the Hidden Point Removal operator described in Katz et....
bool convertNormalToRGB()
Converts normals to RGB colors.
std::vector< Eigen::Vector3d > getEigenColors() const
bool EstimateNormals(const cloudViewer::geometry::KDTreeSearchParam &search_param=cloudViewer::geometry::KDTreeSearchParamKNN(), bool fast_normal_computation=true)
Function to compute the normals of a point cloud.
void unallocateColors()
Erases the cloud colors.
static std::shared_ptr< ccPointCloud > CreateFromDepthImage(const cloudViewer::geometry::Image &depth, const cloudViewer::camera::PinholeCameraIntrinsic &intrinsic, const Eigen::Matrix4d &extrinsic=Eigen::Matrix4d::Identity(), double depth_scale=1000.0, double depth_trunc=1000.0, int stride=1, bool project_valid_depth_only=true)
Factory function to create a pointcloud from a depth image and a camera model.
void deleteAllScalarFields() override
Deletes all scalar fields associated to this cloud.
void setEigenNormal(size_t index, const Eigen::Vector3d &normal)
void addEigenNorms(const std::vector< Eigen::Vector3d > &normals)
bool HasCovariances() const
Returns 'true' if the point cloud contains per-point covariance matrix.
bool OrientNormalsTowardsCameraLocation(const Eigen::Vector3d &camera_location=Eigen::Vector3d::Zero())
Function to orient the normals of a point cloud.
std::vector< double > ComputeNearestNeighborDistance() const
std::tuple< Eigen::Vector4d, std::vector< size_t > > SegmentPlane(const double distance_threshold=0.01, const int ransac_n=3, const int num_iterations=100) const
Segment ccPointCloud plane using the RANSAC algorithm.
Eigen::Vector3d getEigenNormal(size_t index) const
std::vector< double > ComputeMahalanobisDistance() const
Function to compute the Mahalanobis distance for points in an input point cloud.
bool convertRGBToGreyScale()
Converts RGB to grey scale colors.
double ComputeResolution() const
std::shared_ptr< ccPointCloud > FarthestPointDownSample(const size_t num_samples, const size_t start_index=0) const
Function to downsample input pointcloud into output pointcloud with a set of points has farthest dist...
int addScalarField(const char *uniqueName) override
Creates a new scalar field and registers it.
bool interpolateColorsFrom(ccGenericPointCloud *cloud, cloudViewer::GenericProgressCallback *progressCb=nullptr, unsigned char octreeLevel=0)
Interpolate colors from another cloud (nearest neighbor only)
bool enhanceRGBWithIntensitySF(int sfIdx, bool useCustomIntensityRange=false, double minI=0.0, double maxI=1.0)
virtual bool IsEmpty() const override
bool resizeTheRGBTable(bool fillWithWhite=false)
Resizes the RGB colors array.
void normalsHaveChanged()
Notify a modification of normals display parameters or contents.
void showSFColorsScale(bool state)
Sets whether color scale should be displayed or not.
void unalloactePoints()
Erases the cloud points.
void addGreyColor(ColorCompType g)
Pushes a grey color on stack (shortcut)
void OrientNormalsConsistentTangentPlane(size_t k)
Function to consistently orient estimated normals based on consistent tangent planes as described in ...
void invalidateBoundingBox() override
Invalidates bounding box.
bool reserve(unsigned numberOfPoints) override
Reserves memory for all the active features.
std::tuple< std::shared_ptr< ccPointCloud >, std::vector< size_t > > RemoveStatisticalOutliers(size_t nb_neighbors, double std_ratio) const
Function to remove points that are further away from their nb_neighbor neighbors in average.
bool OrientNormalsToAlignWithDirection(const Eigen::Vector3d &orientation_reference=Eigen::Vector3d(0.0, 0.0, 1.0))
Function to orient the normals of a point cloud.
bool exportCoordToSF(bool exportDims[3])
Exports the specified coordinate dimension(s) to scalar field(s)
std::vector< int > ClusterDBSCAN(double eps, size_t min_points, bool print_progress=false) const
Cluster ccPointCloud using the DBSCAN algorithm Ester et al., "A Density-Based Algorithm for Discover...
void pointsHaveChanged()
Notify a modification of points display parameters or contents.
ccPointCloud & RemoveNonFinitePoints(bool remove_nan=true, bool remove_infinite=true)
Remove all points fromt he point cloud that have a nan entry, or infinite entries.
bool colorize(float r, float g, float b)
Multiplies all color components of all points by coefficients.
std::shared_ptr< ccPointCloud > RandomDownSample(double sampling_ratio) const
Function to downsample input pointcloud into output pointcloud randomly.
void hidePointsByScalarValue(ScalarType minVal, ScalarType maxVal)
Hides points whose scalar values falls into an interval.
bool reserveTheNormsTable()
Reserves memory to store the compressed normals.
bool convertNormalToDipDirSFs(ccScalarField *dipSF, ccScalarField *dipDirSF)
Converts normals to two scalar fields: 'dip' and 'dip direction'.
bool reserveTheRGBTable()
Reserves memory to store the RGB colors.
int getCurrentDisplayedScalarFieldIndex() const
Returns the currently displayed scalar field index (or -1 if none)
std::tuple< std::shared_ptr< ccPointCloud >, std::vector< size_t > > RemoveRadiusOutliers(size_t nb_points, double search_radius) const
Function to remove points that have less than nb_points in a sphere of a given radius.
ccPointCloud * cloneThis(ccPointCloud *destCloud=nullptr, bool ignoreChildren=false)
Clones this entity.
void unallocateNorms()
Erases the cloud normals.
static std::vector< Eigen::Matrix3d > EstimatePerPointCovariances(const ccPointCloud &input, const cloudViewer::geometry::KDTreeSearchParam &search_param=cloudViewer::geometry::KDTreeSearchParamKNN())
Static function to compute the covariance matrix for each point of a point cloud. Doesn't change the ...
static ccPointCloud * From(const cloudViewer::GenericIndexedCloud *cloud, const ccGenericPointCloud *sourceCloud=nullptr)
Creates a new point cloud object from a GenericIndexedCloud.
bool resize(unsigned numberOfPoints) override
Resizes all the active features arrays.
void deleteScalarField(int index) override
Deletes a specific scalar field.
cloudViewer::ReferenceCloud * crop2D(const ccPolyline *poly, unsigned char orthoDim, bool inside=true)
Crops the cloud inside (or outside) a 2D polyline.
ccScalarField * getCurrentDisplayedScalarField() const
Returns the currently displayed scalar (or 0 if none)
std::shared_ptr< ccPointCloud > VoxelDownSample(double voxel_size)
Function to downsample input ccPointCloud into output ccPointCloud with a voxel.
std::vector< Eigen::Matrix3d > covariances_
Covariance Matrix for each point.
Eigen::Vector3d getEigenColor(size_t index) const
QSharedPointer< cloudViewer::ReferenceCloud > computeCPSet(ccGenericPointCloud &otherCloud, cloudViewer::GenericProgressCallback *progressCb=nullptr, unsigned char octreeLevel=0)
Computes the closest point of this cloud relatively to another cloud.
void addEigenColors(const std::vector< Eigen::Vector3d > &colors)
void shrinkToFit()
Removes unused capacity.
std::vector< double > ComputePointCloudDistance(const ccPointCloud &target)
Function to compute the point to point distances between point clouds.
ccPointCloud * filterPointsByScalarValue(ScalarType minVal, ScalarType maxVal, bool outside=false)
Filters out points whose scalar values falls into an interval.
bool convertCurrentScalarFieldToColors(bool mixWithExistingColor=false)
CCVector3 computeGravityCenter()
Returns the cloud gravity center.
void EstimateCovariances(const cloudViewer::geometry::KDTreeSearchParam &search_param=cloudViewer::geometry::KDTreeSearchParamKNN())
Function to compute the covariance matrix for each point of a point cloud.
ccPointCloud * partialClone(const cloudViewer::ReferenceCloud *selection, int *warnings=nullptr, bool withChildEntities=true) const
Creates a new point cloud object from a ReferenceCloud (selection)
ccPointCloud & PaintUniformColor(const Eigen::Vector3d &color)
Assigns each vertex in the ccMesh the same color.
std::tuple< std::shared_ptr< ccMesh >, std::vector< size_t > > ComputeConvexHull() const
Function that computes the convex hull of the point cloud using qhull.
bool reserveThePointsTable(unsigned _numberOfPoints)
Reserves memory to store the points coordinates.
bool setRGBColorWithCurrentScalarField(bool mixWithExistingColor=false)
Sets RGB colors with current scalar field (values & parameters)
const ccPointCloud & append(ccPointCloud *cloud, unsigned pointCountBefore, bool ignoreChildren=false)
Appends a cloud to this one.
std::shared_ptr< ccPointCloud > SelectByIndex(const std::vector< size_t > &indices, bool invert=false) const
Function to select points from input ccPointCloud into output ccPointCloud.
std::vector< Eigen::Vector3d > getEigenNormals() const
std::shared_ptr< ccPointCloud > UniformDownSample(size_t every_k_points) const
Function to downsample input ccPointCloud into output ccPointCloud uniformly.
void invertNormals()
Inverts normals (if any)
virtual bool IsEmpty() const override
A scalar field associated to display-related parameters.
A generic 3D point cloud with index-based point access.
ScalarField * getCurrentOutScalarField() const
Returns the scalar field currently associated to the cloud output.
int getScalarFieldIndexByName(const char *name) const
Returns the index of a scalar field represented by its name.
void reset()
Clears the cloud database.
int getCurrentInScalarFieldIndex()
Returns current INPUT scalar field index (or -1 if none)
void setCurrentOutScalarField(int index)
Sets the OUTPUT scalar field.
ScalarField * getScalarField(int index) const
Returns a pointer to a specific scalar field.
unsigned getNumberOfScalarFields() const
Returns the number of associated (and active) scalar fields.
void setCurrentScalarField(int index)
Sets both the INPUT & OUTPUT scalar field.
int getCurrentOutScalarFieldIndex()
Returns current OUTPUT scalar field index (or -1 if none)
unsigned size() const override
bool renameScalarField(int index, const char *newName)
Renames a specific scalar field.
const char * getScalarFieldName(int index) const
Returns the name of a specific scalar field.
void setEigenPoint(size_t index, const Eigen::Vector3d &point)
std::vector< Eigen::Vector3d > getEigenPoints() const
void setCurrentInScalarField(int index)
Sets the INPUT scalar field.
unsigned capacity() const
Returns cloud capacity (i.e. reserved size)
Eigen::Vector3d getEigenPoint(size_t index) const
void addPoints(const std::vector< CCVector3 > &points)
ScalarField * getCurrentInScalarField() const
Returns the scalar field currently associated to the cloud input.
A very simple point cloud (no point duplication)
unsigned size() const override
Returns the number of points.
KDTree search parameters for pure KNN search.
void ClassMethodDocInject(py::module &pybind_module, const std::string &class_name, const std::string &function_name, const std::unordered_map< std::string, std::string > &map_parameter_body_docs)
void pybind_pointcloud(py::module &m)
void pybind_pointcloud_methods(py::module &m)
Generic file read and write utility for python interface.
std::string to_string(const T &n)