CVB++ 15.1
Loading...
Searching...
No Matches
decl_point_cloud.hpp
1#pragma once
2
3#include <unordered_map>
4#include <limits>
5
6#include "../_cexports/c_core_3d.h"
7
8#include "decl_composite.hpp"
9
10#include "../affine_matrix_3d.hpp"
11#include "../cuboid.hpp"
12#include "../data_type.hpp"
13#include "../exception.hpp"
14#include "../global.hpp"
15#include "../image.hpp"
16#include "../matrix_3d.hpp"
17#include "../matrix_3d_h.hpp"
18#include "../point_3d.hpp"
19#include "../point_3d_h.hpp"
20#include "../size_2d.hpp"
21#include "../plane.hpp"
22#include "../utilities/system_info.hpp"
23#include "../components_pointers_3d.hpp"
24
25#include "../plane_3d.hpp"
26
27#include "../calibrator_3d.hpp"
28#include "../core_3d.hpp"
29
30namespace Cvb
31{
32
33 CVB_BEGIN_INLINE_NS
34
35 namespace detail
36 {
37 // Backport std::is_invocable_r for C++14
38 template <typename R, typename F, typename... Args>
39 struct is_invocable_r
40 : std::is_constructible<std::function<R(Args...)>,
41 std::reference_wrapper<typename std::remove_reference<F>::type>>
42 {
43 };
44 } // namespace detail
45
46 template <>
47 inline HandleGuard<PointCloud>::HandleGuard(void *handle) noexcept
48 : HandleGuard<PointCloud>(handle, [](void *handle) { CVB_CALL_CAPI(ReleaseObject(handle)); })
49 {
50 }
51
72 class PointCloud
73 {
74 private:
75 template <class Point>
76 static PointCloudFlags PointTypeToFlags()
77 {
78 if (std::is_same<Point, Cvb::Point3D<float>>::value)
80 else if (std::is_same<Point, Cvb::Point3D<double>>::value)
82 else if (std::is_same<Point, Cvb::Point3DC<float>>::value)
84 else if (std::is_same<Point, Cvb::Point3DC<double>>::value)
86 else if (std::is_same<Point, Cvb::Point3DH<float>>::value)
88 else if (std::is_same<Point, Cvb::Point3DH<double>>::value)
90 else
91 throw std::invalid_argument("Point must be one of the Cvb::Point3D types.");
92 }
93
94 protected:
95 struct PrivateTag
96 {
97 };
98
99 public:
100 using GuardType = HandleGuard<PointCloud>;
101
103
110 static PointCloudPtr FromHandle(HandleGuard<PointCloud> &&guard);
111
112 template <class T>
113 static std::shared_ptr<T> FromHandle(HandleGuard<PointCloud> &&guard)
114 {
115 // required for generic object creation
116 return T::FromHandle(std::move(guard));
117 }
118
120
125 template <class T>
127
129
145 static PointCloudPtr FromMemory(void *buffer, size_t size, PointCloudFlags flags, Cvb::PointCloudFileFormat format);
146
148
164 template <class Point>
165 static PointCloudPtr FromMemory(void *buffer, size_t size, Cvb::PointCloudFileFormat format)
166 {
167 auto flags = PointTypeToFlags<Point>();
168 return FromMemory(buffer, size, flags, format);
169 }
170
172
177 {
178 CExports::CVC3DPointCloudLayout layout = CExports::CVC3DPCL_Invalid;
179 Internal::DoResCall([&]() { return CVB_CALL_CAPI(CVC3DPointCloudAnalyzeLayout(Handle(), layout)); });
180 return static_cast<PointCloudLayout>(layout);
181 }
182
184
188 class DataType DataType() const
189 {
190 CExports::cvbdatatype_t dt = 0;
191 Internal::DoResCall([&]() { return CVB_CALL_CAPI(CVC3DPointCloudGetDatatype(Handle(), dt)); });
192 return Cvb::DataType::FromNativeDescriptor(static_cast<int>(dt));
193 }
194
196
201 {
202 CExports::cvbint64_t numPoints = 0;
203 Internal::DoResCall([&]() { return CVB_CALL_CAPI(CVC3DPointCloudGetNumPoints(Handle(), numPoints)); });
204 return static_cast<std::size_t>(numPoints);
205 }
206
208
213 {
214 ComponentsPointers3D components;
215 auto error = TryPointComponents(components);
216 if (error)
218 return components;
219 }
220
222
227 template <class T>
229 {
230 return PointsTyped(points);
231 }
232
234
239 template <class T>
241 {
242 return PointsHTyped(pointsH);
243 }
244
246
253 Cuboid CalculateBoundingBox(bool onlyConfidentPoints = true) const
254 {
255 if (onlyConfidentPoints)
256 {
257 for (const auto p : Planes())
258 {
259 if (p->Role() == PlaneRole::PixConfidence)
260 return CalculateBoundingBox([](double confidence) {
261 return std::fabs(confidence - 1.0) <= std::numeric_limits<double>::epsilon();
262 });
263 }
264 }
265
266 Cuboid boundingBox;
267 Internal::DoResCall([&]() {
268 return CVB_CALL_CAPI(
269 CVC3DPointCloudCalculateBoundingBox(Handle(), *reinterpret_cast<CExports::CVC3DCuboid *>(&boundingBox)));
270 });
271 return boundingBox;
272 }
273
276
288 template <typename FN,
289 typename std::enable_if_t<detail::is_invocable_r<bool, FN, double, double, double>::value> * = nullptr>
290 Cuboid CalculateBoundingBox(const FN &xyzPredicate) const
291 {
293 thread_local FNType *fn = nullptr;
294 auto predicate = [](double x, double y, double z) -> bool { return (*fn)(x, y, z); };
295
296 fn = &xyzPredicate;
297
298 Cuboid boundingBox;
299 Internal::DoResCall([&]() {
300 return CVB_CALL_CAPI(CVC3DPointCloudCalculateBoundingBoxFiltered(
301 Handle(), predicate, *reinterpret_cast<CExports::CVC3DCuboid *>(&boundingBox)));
302 });
303
304 return boundingBox;
305 }
306
309
321 template <typename FN, typename std::enable_if_t<detail::is_invocable_r<bool, FN, double>::value> * = nullptr>
322 Cuboid CalculateBoundingBox(const FN &confidencePredicate) const
323 {
325 thread_local FNType *fn = nullptr;
326 auto predicate = [](double c) -> bool { return (*fn)(c); };
327
328 fn = &confidencePredicate;
329
330 Cuboid boundingBox;
331 Internal::DoResCall([&]() {
332 return CVB_CALL_CAPI(CVC3DPointCloudCalculateBoundingBoxFilteredConfidence(
333 Handle(), predicate, *reinterpret_cast<CExports::CVC3DCuboid *>(&boundingBox)));
334 });
335
336 return boundingBox;
337 }
338
340
345 {
346 Point3D<double> center;
347 Internal::DoResCall([&]() {
348 return CVB_CALL_CAPI(
349 CVC3DPointCloudCalculateCenterOfGravity(Handle(), *reinterpret_cast<CExports::CVC3DPointD *>(&center)));
350 });
351 return center;
352 }
353
355
360 {
361 Matrix3D matrix;
362 Internal::DoResCall([&]() {
363 return CVB_CALL_CAPI(
364 CVC3DPointCloudCalculateCovarianceMatrix(Handle(), *reinterpret_cast<CExports::CVC3DMatrix *>(&matrix)));
365 });
366 return matrix;
367 }
368
370
376 {
378 }
379
381
387 Plane3D FitPlane(const Cuboid &aoi) const
388 {
389 CExports::CVC3DPlane plane = {0};
390 CExports::cvbres_t res = CVB_CALL_CAPI(CVC3DPointCloudCalculatePlaneFromCuboid(
391 Handle(), *reinterpret_cast<const CExports::CVC3DCuboid *>(&aoi), plane));
392 if (res < 0)
393 std::rethrow_exception(CvbException::FromCvbResult(res, "failed to calculate plane from cuboid."));
394 return Plane3D(plane.Normal.X, plane.Normal.Y, plane.Normal.Z, plane.DistanceToOrigin);
395 }
396
398
405 template <class T>
406 std::shared_ptr<T> Crop(const Cuboid &clipBox) const
407 {
408 return Internal::DoResCallShareOut<T>([&](void *&handle) {
409 return CVB_CALL_CAPI(
410 CVC3DCreateCroppedPointCloud(Handle(), *reinterpret_cast<const CExports::CVC3DCuboid *>(&clipBox), handle));
411 });
412 }
413
417
438 template <class T>
439 std::shared_ptr<T> FrustumCrop(const Cuboid &clipBox, Angle theta, Angle phi) const
440 {
441 return Internal::DoResCallShareOut<T>([&](void *&handle) {
442 return CVB_CALL_CAPI(CVC3DCreateFrustumCroppedPointCloud(
443 Handle(), *reinterpret_cast<const CExports::CVC3DCuboid *>(&clipBox), theta.Deg(), phi.Deg(), handle));
444 });
445 }
446
449
480 template <class T>
481 std::shared_ptr<T> PlaneCrop(const Plane3D &plane, const ValueRange<double> &range, CropRange cropRange) const
482 {
483 return Internal::DoResCallShareOut<T>([&](void *&handle) {
484 return CVB_CALL_CAPI(
485 CVC3DCreatePlaneCroppedPointCloud(Handle(), *reinterpret_cast<const CExports::CVC3DPlane *>(&plane),
486 *reinterpret_cast<const CExports::CVC3DRange *>(&range),
487 static_cast<CExports::CVC3DCropRange>(cropRange), handle));
488 });
489 }
490
493
525 template <class T>
526 std::shared_ptr<T> PlaneCrop(const Plane3D &plane, double threshold,
527 CropDirection cropBelowAbove = CropDirection::Below) const
528 {
529 // get correct plane
530 auto planeUsed = plane;
531 if (std::fabs(plane.Normal().Z())
532 < 1e-7) // if plane is parallel to z axis above/below is not define -> no cropping is done
534 else if (plane.Normal().Z() < 0) // make sure, that z shows up to get right definition of above and below.
535 {
536 planeUsed.SetNormal(Point3D<double>(-plane.Normal().X(), -plane.Normal().Y(), -plane.Normal().Z()));
537 planeUsed.SetDistanceToOrigin(-plane.DistanceToOrigin());
538 }
539
540 // get correct range
542 if (cropBelowAbove == CropDirection::Above)
544
545 return PlaneCrop<T>(planeUsed, range, CropRange::CropWithinRange);
546 }
547
550
557 {
558 return Internal::DoResCallShareOut<PointCloud>([&](void *&handle) {
559 return CVB_CALL_CAPI(CVC3DCreateDownsampledPointCloud(Handle(),
560 static_cast<CExports::CVC3DDownsampleMode>(mode),
561 static_cast<CExports::cvbint64_t>(value), handle));
562 });
563 }
564
566
574 {
575 return Internal::DoResCallShareOut<PointCloud>(
576 [&](void *&handle) { return CVB_CALL_CAPI(CVC3DCreateDuplicatePointCloud(Handle(), handle)); });
577 }
578
580
584 void Save(const String &fileName) const
585 {
586 Save(fileName, static_cast<PointCloudFlags>(0));
587 }
588
589 void Save(const String &fileName, PointCloudFlags flags) const
590 {
591 Internal::DoResCall([&]() {
592 return CVB_CALL_CAPI(CVC3DWriteFileTyped(Handle(), static_cast<CExports::cvbval_t>(flags), fileName.c_str()));
593 });
594 }
595
598
604 {
605 return Internal::DoResCallShareOut<PointCloud>([&](void *&handle) {
606 return CVB_CALL_CAPI(CVC3DCreateConvertedPointCloud(Handle(), static_cast<CExports::cvbval_t>(flags), handle));
607 });
608 }
609
611
617 {
618 return Internal::DoResCallShareOut<PointCloud>([&](void *&handle) {
619 return CVB_CALL_CAPI(
620 CVC3DCreateScaledPointCloud(Handle(), *reinterpret_cast<CExports::CVC3DFactors *>(&factors), handle));
621 });
622 }
623
625
632 SparsePointCloudPtr Transform(const AffineMatrix3D &transformation) const;
633
635
642 SparsePointCloudPtr Transform(const Matrix3DH &transformation) const;
643
646
651 void Transform(const AffineMatrix3D &affineTransformation, SparsePointCloud &pointCloud);
652
655
660 void Transform(const Cvb::Matrix3DH &transformation, SparsePointCloud &pointCloud);
661
663
673 double background) const
674 {
675 return Internal::DoResCallObjectOut<Image>([&](void *&handle) {
676 return CVB_CALL_CAPI(CVC3DCreateRangeMapFromPointCloud(
677 Handle(), *reinterpret_cast<CExports::CVC3DRange *>(&xRange),
678 *reinterpret_cast<CExports::CVC3DRange *>(&yRange), static_cast<CExports::cvbdim_t>(size.Width()),
679 static_cast<CExports::cvbdim_t>(size.Height()), background, handle));
680 });
681 }
682
684
688 int PlaneCount() const noexcept
689 {
690 CExports::cvbdim_t numPlanes = 0;
691 CVB_CALL_CAPI(CVCPlaneEnumGetCount(Handle(), numPlanes));
692 return static_cast<int>(numPlanes);
693 }
694
696
701 {
703 std::generate_n(std::back_inserter(planes), PlaneCount(), [this, i = 0]() mutable { return Plane(i++); });
704 return planes;
705 }
706
708
715 PlanePtr Plane(int index) const
716 {
717 if (index < 0 || index >= PlaneCount())
718 throw std::length_error("index out of range");
719
720 CExports::CVPLANE handle = nullptr;
721 CVB_CALL_CAPI_CHECKED(CVCPlaneEnumGetAt(Handle(), static_cast<CExports::cvbdim_t>(index), handle));
722 auto plane = Plane::FromHandle(HandleGuard<class Plane>(handle));
723
724 auto iter = planes_.find(plane->Handle());
725 if (iter != planes_.end())
726 {
727 if (auto _plane = iter->second.lock())
728 return _plane;
729 }
730
731 planes_[plane->Handle()] = plane;
732 return plane;
733 }
734
736
752 {
753 std::size_t bufSize{};
754 CExports::cvbres_t res =
755 CVB_CALL_CAPI(CVC3DPointCloudToMemorySize(Handle(), static_cast<CExports::cvbval_t>(flags),
756 static_cast<CExports::CVC3DPointCloudFileFormat>(format), bufSize));
757 if (res < 0)
758 std::rethrow_exception(CvbException::FromCvbResult(res, "failed to get memory size."));
759
760 return bufSize;
761 }
762
764
779 template <class Point>
781 {
782 auto flags = PointTypeToFlags<Point>();
783 return MemorySize(flags, format);
784 }
785
787
810 void ToMemory(PointCloudFlags flags, Cvb::PointCloudFileFormat format, size_t size, void *buffer) const
811 {
812 auto res = CVB_CALL_CAPI(CVC3DPointCloudToMemory(Handle(), static_cast<CExports::cvbval_t>(flags),
813 static_cast<CExports::CVC3DPointCloudFileFormat>(format), buffer,
814 size));
815 if (res < 0)
816 std::rethrow_exception(CvbException::FromCvbResult(res, "failed to save point cloud to memory."));
817 }
818
820
843 template <class Point>
844 void ToMemory(Cvb::PointCloudFileFormat format, size_t size, std::uint8_t *buffer) const
845 {
846 auto flags = PointTypeToFlags<Point>();
847 ToMemory(flags, format, size, buffer);
848 }
849
854 void *Handle() const noexcept
855 {
856 return handle_.Handle();
857 }
858
859 PointCloud(const PointCloud &other) noexcept = delete;
860 PointCloud &operator=(const PointCloud &other) noexcept = delete;
861 PointCloud(PointCloud &&other) noexcept = delete;
862 PointCloud &operator=(PointCloud &&other) noexcept = delete;
863
864 virtual ~PointCloud() = default;
865
866 protected:
867 explicit PointCloud(HandleGuard<PointCloud> &&guard) noexcept
868 : handle_(std::move(guard))
869 {
870 }
871
872 static bool IsDense(void *handle)
873 {
874 CExports::cvbdim_t width = 0;
875 CExports::cvbdim_t height = 0;
876 auto res = CVB_CALL_CAPI(CVC3DPointCloudGetLatticeSize(handle, width, height));
878 return false;
879 else if (res < 0)
880 Utilities::SystemInfo::ThrowLastError(res);
881
882 return true;
883 }
884
885 std::exception_ptr TryPointComponents(ComponentsPointers3D &components) const noexcept
886 {
887 auto res = CVB_CALL_CAPI(CVC3DPointCloudGetPointComponentsPointers(
888 Handle(), reinterpret_cast<void *&>(components.xBasePtr_), components.xInc_,
889 reinterpret_cast<void *&>(components.yBasePtr_), components.yInc_,
890 reinterpret_cast<void *&>(components.zBasePtr_), components.zInc_,
891 reinterpret_cast<void *&>(components.wBasePtr_), components.wInc_, components.numPoints_));
892 if (!CExports::CheckErrorCode(res))
894
895 CExports::cvbdatatype_t dataType = 0;
896 CVB_CALL_CAPI(CVC3DPointCloudGetPointsConfidencePointer(
897 Handle(), reinterpret_cast<void *&>(components.confidenceBasePtr_), components.confidenceInc_, dataType));
898 return {};
899 }
900
901 template <class T>
902 std::exception_ptr TryPointComponents(ComponentsPointers3D &components) const noexcept
903 {
904 auto error = TryPointComponents(components);
905 if (error)
906 return error;
907
909 return std::make_exception_ptr(std::runtime_error("data type does not match for components pointers"));
910
911#ifdef _MSC_VER
912# pragma warning(push, 1)
913# pragma warning(disable : 4127) // conditional expression is constant
914#endif
915
916 if (std::is_same<T, Point3DH<typename T::ValueType>>::value && !components.BasePtrW())
917 return std::make_exception_ptr(std::runtime_error("point cloud has no W components use Point3D"));
918
919 if (std::is_same<T, Point3D<typename T::ValueType>>::value && components.BasePtrW())
920 return std::make_exception_ptr(std::runtime_error("point cloud has W components use Point3DH"));
921
922#ifdef _MSC_VER
923# pragma warning(pop)
924#endif
925
926 return {};
927 }
928
929 private:
930 std::size_t PointsTyped(Cvb::Point3D<double> *&points) const
931 {
932 return Internal::DoResCallValueOut<std::size_t>([&](std::size_t &value) {
933 return CVB_CALL_CAPI(
934 CVC3DPointCloudGetPointDsPointer(Handle(), reinterpret_cast<CExports::CVC3DPointD *&>(points), value));
935 });
936 }
937
938 std::size_t PointsTyped(Point3D<float> *&points) const
939 {
940 return Internal::DoResCallValueOut<std::size_t>([&](std::size_t &value) {
941 return CVB_CALL_CAPI(
942 CVC3DPointCloudGetPointFsPointer(Handle(), reinterpret_cast<CExports::CVC3DPointF *&>(points), value));
943 });
944 }
945
946 std::size_t PointsHTyped(Cvb::Point3DH<double> *&pointsH)
947 {
948 return Internal::DoResCallValueOut<std::size_t>([&](std::size_t &value) {
949 return CVB_CALL_CAPI(
950 CVC3DPointCloudGetPointHDsPointer(Handle(), reinterpret_cast<CExports::CVC3DPointHD *&>(pointsH), value));
951 });
952 }
953
954 std::size_t PointsHTyped(Cvb::Point3DH<float> *&pointsH)
955 {
956 return Internal::DoResCallValueOut<std::size_t>([&](std::size_t &value) {
957 return CVB_CALL_CAPI(
958 CVC3DPointCloudGetPointHFsPointer(Handle(), reinterpret_cast<CExports::CVC3DPointHF *&>(pointsH), value));
959 });
960 }
961
962 mutable std::unordered_map<void *, std::weak_ptr<class Plane>> planes_;
963
964 HandleGuard<PointCloud> handle_;
965 };
966
967 CVB_END_INLINE_NS
968} // namespace Cvb
T back_inserter(T... args)
Affine transformation for 3D containing a transformation matrix and a translation vector.
Definition affine_matrix_3d.hpp:140
Object for convenient and type - safe handling of angles.
Definition angle.hpp:16
double Deg() const noexcept
Get the value in degrees.
Definition angle.hpp:89
Point components of the point cloud.
Definition components_pointers_3d.hpp:18
3D rectangle in the X, Y and Z domain.
Definition cuboid.hpp:19
static DataType FromNativeType() noexcept
Construct a data type descriptor from one of the native data type value equivalents.
Definition data_type.hpp:205
static DataType FromNativeDescriptor(int dataTypeDescriptor) noexcept
Construct a data type descriptor from one of the native library's descriptor values.
Definition data_type.hpp:31
Double precision row-major 4x4 matrix.
Definition matrix_3d_h.hpp:44
Double precision 3x3 matrix class.
Definition matrix_3d.hpp:54
A plane in 3D space in Hessian normal form.
Definition plane_3d.hpp:19
double DistanceToOrigin() const noexcept
Gets the distance to the origin in point units.
Definition plane_3d.hpp:78
Point3D< double > Normal() const noexcept
Gets the normal vector of the plane.
Definition plane_3d.hpp:58
static PlanePtr FromHandle(HandleGuard< Plane > &&guard)
Creates a plane from a classic API handle.
Definition decl_plane.hpp:76
void * Handle() const noexcept override
Classic API image handle.
Definition decl_plane.hpp:98
Multi-purpose 3D vector class with confidence.
Definition point_3d_c.hpp:23
Multi-purpose 3D vector class (homogeneous).
Definition point_3d_h.hpp:22
Multi-purpose 3D vector class.
Definition point_3d.hpp:22
T X() const noexcept
Get the x component of the point.
Definition point_3d.hpp:74
T Y() const noexcept
Get the y component of the point.
Definition point_3d.hpp:94
T Z() const noexcept
Get the z component of the point.
Definition point_3d.hpp:114
A point cloud object.
Definition decl_point_cloud.hpp:73
PlanePtr Plane(int index) const
Index based plane access.
Definition decl_point_cloud.hpp:715
Plane3D FitPlane(const Cuboid &aoi) const
Fits a plane in the points of the point cloud for a specified area of interest.
Definition decl_point_cloud.hpp:387
std::size_t Points(Point3D< T > *&points) const
Gets the 3D points from the given point cloud.
Definition decl_point_cloud.hpp:228
static PointCloudPtr FromHandle(HandleGuard< PointCloud > &&guard)
Creates a point cloud from a classic API handle.
Definition detail_point_cloud.hpp:15
ComponentsPointers3D PointComponents() const
Tries to get the point components from the given point cloud.
Definition decl_point_cloud.hpp:212
std::shared_ptr< T > PlaneCrop(const Plane3D &plane, const ValueRange< double > &range, CropRange cropRange) const
Creates a new point cloud where points within or outside a range parallel to given plane are cropped.
Definition decl_point_cloud.hpp:481
static PointCloudPtr FromMemory(void *buffer, size_t size, Cvb::PointCloudFileFormat format)
Creates a point cloud reading memory from buffer.
Definition decl_point_cloud.hpp:165
PointCloudPtr Convert(PointCloudFlags flags) const
Creates a new point cloud, which is a copy from this point cloud, but with possibly different data ty...
Definition decl_point_cloud.hpp:603
PointCloudPtr Duplicate() const
Creates a new point cloud which is a copy this point cloud.
Definition decl_point_cloud.hpp:573
Cuboid CalculateBoundingBox(const FN &xyzPredicate) const
Calculates the minimum and maximum extent of the point cloud, using a predicate that filters points b...
Definition decl_point_cloud.hpp:290
std::shared_ptr< T > Crop(const Cuboid &clipBox) const
Creates a new point cloud which only consists of the points inside the clip box.
Definition decl_point_cloud.hpp:406
std::shared_ptr< T > FrustumCrop(const Cuboid &clipBox, Angle theta, Angle phi) const
Creates a new point cloud which only consists of the points inside the clipBox, where the orientation...
Definition decl_point_cloud.hpp:439
int PlaneCount() const noexcept
Gets the number of planes enumerated by this object.
Definition decl_point_cloud.hpp:688
void ToMemory(Cvb::PointCloudFileFormat format, size_t size, std::uint8_t *buffer) const
Saves the point cloud to the memory in the given format.
Definition decl_point_cloud.hpp:844
SparsePointCloudPtr Transform(const AffineMatrix3D &transformation) const
Creates a new point cloud with all points being transformed by the given transformation.
Definition detail_point_cloud.hpp:43
Matrix3D CalculateCovarianceMatrix() const
Calculates the covariance matrix of the point cloud.
Definition decl_point_cloud.hpp:359
Cuboid CalculateBoundingBox(bool onlyConfidentPoints=true) const
Calculates the minimum and maximum extent of the point cloud.
Definition decl_point_cloud.hpp:253
class DataType DataType() const
Gets the DataType of the x,y,z(,w) components of the given PointCloud.
Definition decl_point_cloud.hpp:188
PointCloudPtr Downsample(DownSampleMode mode, int value) const
Creates a new point cloud which has several points being removed dependent on the down sample mode an...
Definition decl_point_cloud.hpp:556
std::size_t NumPoints() const
Gets the number of x,y,z(,w) points in the given point cloud.
Definition decl_point_cloud.hpp:200
Plane3D FitPlane() const
Fits a plane in the points of the point cloud without cropping it.
Definition decl_point_cloud.hpp:375
size_t MemorySize(PointCloudFlags flags, Cvb::PointCloudFileFormat format) const
Determines the amount of memory needed for ToMemory.
Definition decl_point_cloud.hpp:751
void ToMemory(PointCloudFlags flags, Cvb::PointCloudFileFormat format, size_t size, void *buffer) const
Saves the point cloud to the memory in the given format.
Definition decl_point_cloud.hpp:810
std::shared_ptr< T > PlaneCrop(const Plane3D &plane, double threshold, CropDirection cropBelowAbove=CropDirection::Below) const
Creates a new point cloud which only consists of the points below or above given plane.
Definition decl_point_cloud.hpp:526
void Save(const String &fileName) const
Saves the given point cloud to the file with the given FileName.
Definition decl_point_cloud.hpp:584
std::unique_ptr< Cvb::Image > RangeMap(ValueRange< double > xRange, ValueRange< double > yRange, Size2D< int > size, double background) const
Creates a new range map image via linear projection in negative z-direction.
Definition decl_point_cloud.hpp:672
static std::shared_ptr< T > FromComposite(CompositePtr object)
Creates a point cloud from a composite.
Definition detail_point_cloud.hpp:27
std::vector< PlanePtr > Planes() const
Gets all available planes enumerated by this object.
Definition decl_point_cloud.hpp:700
PointCloudLayout Layout() const
Get the layout of the available buffers/planes of the given point cloud.
Definition decl_point_cloud.hpp:176
std::size_t PointsH(Point3DH< T > *&pointsH) const
Tries to get the 3D points from the given point cloud.
Definition decl_point_cloud.hpp:240
size_t MemorySize(Cvb::PointCloudFileFormat format) const
Determines the amount of memory needed for ToMemory.
Definition decl_point_cloud.hpp:780
Cuboid CalculateBoundingBox(const FN &confidencePredicate) const
Calculates the minimum and maximum extent of the point cloud, using a predicate that filters points b...
Definition decl_point_cloud.hpp:322
Point3D< double > CalculateCenterOfGravity() const
Calculates the center of gravity of the point cloud.
Definition decl_point_cloud.hpp:344
static PointCloudPtr FromMemory(void *buffer, size_t size, PointCloudFlags flags, Cvb::PointCloudFileFormat format)
Creates a point cloud reading memory from buffer.
Definition detail_point_cloud.hpp:34
void * Handle() const noexcept
Returns C-API style handle to Node Object.
Definition decl_point_cloud.hpp:854
PointCloudPtr Scale(Factors3D factors) const
Creates a new point cloud with all points being scaled by the given factors.
Definition decl_point_cloud.hpp:616
Stores a pair of numbers that represents the width and the height of a subject, typically a rectangle...
Definition size_2d.hpp:20
T Height() const noexcept
Gets the vertical component of the size.
Definition size_2d.hpp:77
T Width() const noexcept
Gets the horizontal component of the size.
Definition size_2d.hpp:57
An unorganized sparse Cartesian 3D point cloud object.
Definition decl_sparse_point_cloud.hpp:34
Container for range definitions.
Definition value_range.hpp:17
T epsilon(T... args)
T fabs(T... args)
T generate_n(T... args)
cvbbool_t ReleaseObject(OBJ &Object)
T lowest(T... args)
T max(T... args)
T move(T... args)
const int CVB_INVALIDDIMENSION
Invalid number of dimensions.
Definition exception.hpp:73
std::exception_ptr GetLastError() noexcept
Returns a pointer that points at the exception.
Definition system_info.hpp:181
Root namespace for the Image Manager interface.
Definition version.hpp:11
PointCloudFileFormat
Supported point cloud point formats.
Definition core_3d.hpp:141
PointCloudFlags
Flags for creating point clouds.
Definition core_3d.hpp:90
@ Float
Definition core_3d.hpp:94
@ XYZW
Definition core_3d.hpp:109
@ XYZConfidence
Definition core_3d.hpp:114
@ Double
Definition core_3d.hpp:99
@ XYZ
Definition core_3d.hpp:104
std::string String
String for wide characters or unicode characters.
Definition string.hpp:49
std::shared_ptr< PointCloud > PointCloudPtr
Convenience shared pointer for PointCloud.
Definition core_3d.hpp:40
CropRange
Indicates cropping range.
Definition core_3d.hpp:288
@ CropWithinRange
Crops points within given range.
Definition core_3d.hpp:291
PointCloudLayout
Supported point cloud point layouts.
Definition core_3d.hpp:195
std::shared_ptr< SparsePointCloud > SparsePointCloudPtr
Convenience shared pointer for SparsePointCloud.
Definition core_3d.hpp:48
CropDirection
Indicates cropping direction.
Definition core_3d.hpp:301
@ Above
Crop above given plane.
Definition core_3d.hpp:309
@ Below
Crop below given plane.
Definition core_3d.hpp:305
DownSampleMode
Specifies how to remove points from a point cloud.
Definition core_3d.hpp:234
@ PixConfidence
Confidence(probability density / percentage) or consistency(Boolean) value.
Definition global.hpp:442
std::shared_ptr< Composite > CompositePtr
Convenience shared pointer for Composite.
Definition global.hpp:102
std::shared_ptr< Plane > PlanePtr
Convenience shared pointer for Plane.
Definition global.hpp:78
T dynamic_pointer_cast(T... args)
T rethrow_exception(T... args)
Factor components to be applied in the 3D domain.
Definition core_3d.hpp:16