CVB++ 15.0
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 template <>
36 inline HandleGuard<PointCloud>::HandleGuard(void *handle) noexcept
37 : HandleGuard<PointCloud>(handle, [](void *handle) { CVB_CALL_CAPI(ReleaseObject(handle)); })
38 {
39 }
40
47 class PointCloud
48 {
49 private:
50 template <class Point>
51 static PointCloudFlags PointTypeToFlags()
52 {
53 if (std::is_same<Point, Cvb::Point3D<float>>::value)
55 else if (std::is_same<Point, Cvb::Point3D<double>>::value)
57 else if (std::is_same<Point, Cvb::Point3DC<float>>::value)
59 else if (std::is_same<Point, Cvb::Point3DC<double>>::value)
61 else if (std::is_same<Point, Cvb::Point3DH<float>>::value)
63 else if (std::is_same<Point, Cvb::Point3DH<double>>::value)
65 else
66 throw std::invalid_argument("Point must be one of the Cvb::Point3D types.");
67 }
68
69 protected:
70 struct PrivateTag
71 {
72 };
73
74 public:
75 using GuardType = HandleGuard<PointCloud>;
76
78
85 static PointCloudPtr FromHandle(HandleGuard<PointCloud> &&guard);
86
87 template <class T>
88 static std::shared_ptr<T> FromHandle(HandleGuard<PointCloud> &&guard)
89 {
90 // required for generic object creation
91 return T::FromHandle(std::move(guard));
92 }
93
95
100 template <class T>
102
104
120 static PointCloudPtr FromMemory(void *buffer, size_t size, PointCloudFlags flags, Cvb::PointCloudFileFormat format);
121
123
139 template <class Point>
140 static PointCloudPtr FromMemory(void *buffer, size_t size, Cvb::PointCloudFileFormat format)
141 {
142 auto flags = PointTypeToFlags<Point>();
143 return FromMemory(buffer, size, flags, format);
144 }
145
147
152 {
153 CExports::CVC3DPointCloudLayout layout = CExports::CVC3DPCL_Invalid;
154 Internal::DoResCall([&]() { return CVB_CALL_CAPI(CVC3DPointCloudAnalyzeLayout(Handle(), layout)); });
155 return static_cast<PointCloudLayout>(layout);
156 }
157
159
163 class DataType DataType() const
164 {
165 CExports::cvbdatatype_t dt = 0;
166 Internal::DoResCall([&]() { return CVB_CALL_CAPI(CVC3DPointCloudGetDatatype(Handle(), dt)); });
167 return Cvb::DataType::FromNativeDescriptor(static_cast<int>(dt));
168 }
169
171
176 {
177 CExports::cvbint64_t numPoints = 0;
178 Internal::DoResCall([&]() { return CVB_CALL_CAPI(CVC3DPointCloudGetNumPoints(Handle(), numPoints)); });
179 return static_cast<std::size_t>(numPoints);
180 }
181
183
188 {
189 ComponentsPointers3D components;
190 auto error = TryPointComponents(components);
191 if (error)
193 return components;
194 }
195
197
202 template <class T>
204 {
205 return PointsTyped(points);
206 }
207
209
214 template <class T>
216 {
217 return PointsHTyped(pointsH);
218 }
219
221
226 {
227 Cuboid boundingBox;
228 Internal::DoResCall([&]() {
229 return CVB_CALL_CAPI(
230 CVC3DPointCloudCalculateBoundingBox(Handle(), *reinterpret_cast<CExports::CVC3DCuboid *>(&boundingBox)));
231 });
232 return boundingBox;
233 }
234
236
241 {
242 Point3D<double> center;
243 Internal::DoResCall([&]() {
244 return CVB_CALL_CAPI(
245 CVC3DPointCloudCalculateCenterOfGravity(Handle(), *reinterpret_cast<CExports::CVC3DPointD *>(&center)));
246 });
247 return center;
248 }
249
251
256 {
257 Matrix3D matrix;
258 Internal::DoResCall([&]() {
259 return CVB_CALL_CAPI(
260 CVC3DPointCloudCalculateCovarianceMatrix(Handle(), *reinterpret_cast<CExports::CVC3DMatrix *>(&matrix)));
261 });
262 return matrix;
263 }
264
266
272 {
274 }
275
277
283 Plane3D FitPlane(const Cuboid &aoi) const
284 {
285 CExports::CVC3DPlane plane = {0};
286 CExports::cvbres_t res = CVB_CALL_CAPI(CVC3DPointCloudCalculatePlaneFromCuboid(
287 Handle(), *reinterpret_cast<const CExports::CVC3DCuboid *>(&aoi), plane));
288 if (res < 0)
289 std::rethrow_exception(CvbException::FromCvbResult(res, "failed to calculate plane from cuboid."));
290 return Plane3D(plane.Normal.X, plane.Normal.Y, plane.Normal.Z, plane.DistanceToOrigin);
291 }
292
294
301 template <class T>
302 std::shared_ptr<T> Crop(const Cuboid &clipBox) const
303 {
304 return Internal::DoResCallShareOut<T>([&](void *&handle) {
305 return CVB_CALL_CAPI(
306 CVC3DCreateCroppedPointCloud(Handle(), *reinterpret_cast<const CExports::CVC3DCuboid *>(&clipBox), handle));
307 });
308 }
309
313
334 template <class T>
335 std::shared_ptr<T> FrustumCrop(const Cuboid &clipBox, Angle theta, Angle phi) const
336 {
337 return Internal::DoResCallShareOut<T>([&](void *&handle) {
338 return CVB_CALL_CAPI(CVC3DCreateFrustumCroppedPointCloud(
339 Handle(), *reinterpret_cast<const CExports::CVC3DCuboid *>(&clipBox), theta.Deg(), phi.Deg(), handle));
340 });
341 }
342
345
376 template <class T>
377 std::shared_ptr<T> PlaneCrop(const Plane3D &plane, const ValueRange<double> &range, CropRange cropRange) const
378 {
379 return Internal::DoResCallShareOut<T>([&](void *&handle) {
380 return CVB_CALL_CAPI(
381 CVC3DCreatePlaneCroppedPointCloud(Handle(), *reinterpret_cast<const CExports::CVC3DPlane *>(&plane),
382 *reinterpret_cast<const CExports::CVC3DRange *>(&range),
383 static_cast<CExports::CVC3DCropRange>(cropRange), handle));
384 });
385 }
386
389
421 template <class T>
422 std::shared_ptr<T> PlaneCrop(const Plane3D &plane, double threshold,
423 CropDirection cropBelowAbove = CropDirection::Below) const
424 {
425 // get correct plane
426 auto planeUsed = plane;
427 if (std::fabs(plane.Normal().Z())
428 < 1e-7) // if plane is parallel to z axis above/below is not define -> no cropping is done
430 else if (plane.Normal().Z() < 0) // make sure, that z shows up to get right definition of above and below.
431 {
432 planeUsed.SetNormal(Point3D<double>(-plane.Normal().X(), -plane.Normal().Y(), -plane.Normal().Z()));
433 planeUsed.SetDistanceToOrigin(-plane.DistanceToOrigin());
434 }
435
436 // get correct range
438 if (cropBelowAbove == CropDirection::Above)
440
441 return PlaneCrop<T>(planeUsed, range, CropRange::CropWithinRange);
442 }
443
446
453 {
454 return Internal::DoResCallShareOut<PointCloud>([&](void *&handle) {
455 return CVB_CALL_CAPI(CVC3DCreateDownsampledPointCloud(Handle(),
456 static_cast<CExports::CVC3DDownsampleMode>(mode),
457 static_cast<CExports::cvbint64_t>(value), handle));
458 });
459 }
460
462
470 {
471 return Internal::DoResCallShareOut<PointCloud>(
472 [&](void *&handle) { return CVB_CALL_CAPI(CVC3DCreateDuplicatePointCloud(Handle(), handle)); });
473 }
474
476
480 void Save(const String &fileName) const
481 {
482 Save(fileName, static_cast<PointCloudFlags>(0));
483 }
484
485 void Save(const String &fileName, PointCloudFlags flags) const
486 {
487 Internal::DoResCall([&]() {
488 return CVB_CALL_CAPI(CVC3DWriteFileTyped(Handle(), static_cast<CExports::cvbval_t>(flags), fileName.c_str()));
489 });
490 }
491
494
500 {
501 return Internal::DoResCallShareOut<PointCloud>([&](void *&handle) {
502 return CVB_CALL_CAPI(CVC3DCreateConvertedPointCloud(Handle(), static_cast<CExports::cvbval_t>(flags), handle));
503 });
504 }
505
507
513 {
514 return Internal::DoResCallShareOut<PointCloud>([&](void *&handle) {
515 return CVB_CALL_CAPI(
516 CVC3DCreateScaledPointCloud(Handle(), *reinterpret_cast<CExports::CVC3DFactors *>(&factors), handle));
517 });
518 }
519
521
526 PointCloudPtr Transform(const AffineMatrix3D &transformation) const
527 {
528 return Internal::DoResCallShareOut<PointCloud>([&](void *&handle) {
529 return CVB_CALL_CAPI(CVC3DCreateTransformedPointCloud(
530 Handle(), *reinterpret_cast<const CExports::CVC3DTransformation *>(&transformation), handle));
531 });
532 }
533
535
540 PointCloudPtr Transform(const Matrix3DH &transformation) const
541 {
542 return Internal::DoResCallShareOut<PointCloud>([&](void *&handle) {
543 return CVB_CALL_CAPI(CVC3DCreateTransformedPointCloudH(
544 Handle(), *reinterpret_cast<const CExports::CVC3DMatrixH *>(&transformation), handle));
545 });
546 }
547
550
557 void Transform(const AffineMatrix3D &affineTransformation, PointCloud &pointCloud)
558 {
559 Internal::DoResCall([&]() {
560 return CVB_CALL_CAPI(CVC3DTransformPointCloud(
561 Handle(), *reinterpret_cast<const CExports::CVC3DTransformation *>(&affineTransformation),
562 pointCloud.Handle()));
563 });
564 }
565
568
573 void Transform(const Cvb::Matrix3DH &transformation, PointCloud &pointCloud)
574 {
575 Internal::DoResCall([&]() {
576 return CVB_CALL_CAPI(CVC3DTransformPointCloudH(
577 Handle(), *reinterpret_cast<const CExports::CVC3DMatrixH *>(&transformation), pointCloud.Handle()));
578 });
579 }
580
582
592 double background) const
593 {
594 return Internal::DoResCallObjectOut<Image>([&](void *&handle) {
595 return CVB_CALL_CAPI(CVC3DCreateRangeMapFromPointCloud(
596 Handle(), *reinterpret_cast<CExports::CVC3DRange *>(&xRange),
597 *reinterpret_cast<CExports::CVC3DRange *>(&yRange), static_cast<CExports::cvbdim_t>(size.Width()),
598 static_cast<CExports::cvbdim_t>(size.Height()), background, handle));
599 });
600 }
601
603
607 int PlaneCount() const noexcept
608 {
609 CExports::cvbdim_t numPlanes = 0;
610 CVB_CALL_CAPI(CVCPlaneEnumGetCount(Handle(), numPlanes));
611 return static_cast<int>(numPlanes);
612 }
613
615
620 {
622 std::generate_n(std::back_inserter(planes), PlaneCount(), [this, i = 0]() mutable { return Plane(i++); });
623 return planes;
624 }
625
627
634 PlanePtr Plane(int index) const
635 {
636 if (index < 0 || index >= PlaneCount())
637 throw std::length_error("index out of range");
638
639 CExports::CVPLANE handle = nullptr;
640 CVB_CALL_CAPI_CHECKED(CVCPlaneEnumGetAt(Handle(), static_cast<CExports::cvbdim_t>(index), handle));
641 auto plane = Plane::FromHandle(HandleGuard<class Plane>(handle));
642
643 auto iter = planes_.find(plane->Handle());
644 if (iter != planes_.end())
645 {
646 if (auto _plane = iter->second.lock())
647 return _plane;
648 }
649
650 planes_[plane->Handle()] = plane;
651 return plane;
652 }
653
655
671 {
672 std::size_t bufSize{};
673 CExports::cvbres_t res =
674 CVB_CALL_CAPI(CVC3DPointCloudToMemorySize(Handle(), static_cast<CExports::cvbval_t>(flags),
675 static_cast<CExports::CVC3DPointCloudFileFormat>(format), bufSize));
676 if (res < 0)
677 std::rethrow_exception(CvbException::FromCvbResult(res, "failed to get memory size."));
678
679 return bufSize;
680 }
681
683
698 template <class Point>
700 {
701 auto flags = PointTypeToFlags<Point>();
702 return MemorySize(flags, format);
703 }
704
706
729 void ToMemory(PointCloudFlags flags, Cvb::PointCloudFileFormat format, size_t size, void *buffer) const
730 {
731 auto res = CVB_CALL_CAPI(CVC3DPointCloudToMemory(Handle(), static_cast<CExports::cvbval_t>(flags),
732 static_cast<CExports::CVC3DPointCloudFileFormat>(format), buffer,
733 size));
734 if (res < 0)
735 std::rethrow_exception(CvbException::FromCvbResult(res, "failed to save point cloud to memory."));
736 }
737
739
762 template <class Point>
763 void ToMemory(Cvb::PointCloudFileFormat format, size_t size, std::uint8_t *buffer) const
764 {
765 auto flags = PointTypeToFlags<Point>();
766 ToMemory(flags, format, size, buffer);
767 }
768
773 void *Handle() const noexcept
774 {
775 return handle_.Handle();
776 }
777
778 PointCloud(const PointCloud &other) noexcept = delete;
779 PointCloud &operator=(const PointCloud &other) noexcept = delete;
780 PointCloud(PointCloud &&other) noexcept = delete;
781 PointCloud &operator=(PointCloud &&other) noexcept = delete;
782
783 virtual ~PointCloud() = default;
784
785 protected:
786 explicit PointCloud(HandleGuard<PointCloud> &&guard) noexcept
787 : handle_(std::move(guard))
788 {
789 }
790
791 static bool IsDense(void *handle)
792 {
793 CExports::cvbdim_t width = 0;
794 CExports::cvbdim_t height = 0;
795 auto res = CVB_CALL_CAPI(CVC3DPointCloudGetLatticeSize(handle, width, height));
797 return false;
798 else if (res < 0)
799 Utilities::SystemInfo::ThrowLastError(res);
800
801 return true;
802 }
803
804 std::exception_ptr TryPointComponents(ComponentsPointers3D &components) const noexcept
805 {
806 auto res = CVB_CALL_CAPI(CVC3DPointCloudGetPointComponentsPointers(
807 Handle(), reinterpret_cast<void *&>(components.xBasePtr_), components.xInc_,
808 reinterpret_cast<void *&>(components.yBasePtr_), components.yInc_,
809 reinterpret_cast<void *&>(components.zBasePtr_), components.zInc_,
810 reinterpret_cast<void *&>(components.wBasePtr_), components.wInc_, components.numPoints_));
811 if (!CExports::CheckErrorCode(res))
813
814 CExports::cvbdatatype_t dataType = 0;
815 CVB_CALL_CAPI(CVC3DPointCloudGetPointsConfidencePointer(
816 Handle(), reinterpret_cast<void *&>(components.confidenceBasePtr_), components.confidenceInc_, dataType));
817 return {};
818 }
819
820 template <class T>
821 std::exception_ptr TryPointComponents(ComponentsPointers3D &components) const noexcept
822 {
823 auto error = TryPointComponents(components);
824 if (error)
825 return error;
826
828 return std::make_exception_ptr(std::runtime_error("data type does not match for components pointers"));
829
830#ifdef _MSC_VER
831# pragma warning(push, 1)
832# pragma warning(disable : 4127) // conditional expression is constant
833#endif
834
835 if (std::is_same<T, Point3DH<typename T::ValueType>>::value && !components.BasePtrW())
836 return std::make_exception_ptr(std::runtime_error("point cloud has no W components use Point3D"));
837
838 if (std::is_same<T, Point3D<typename T::ValueType>>::value && components.BasePtrW())
839 return std::make_exception_ptr(std::runtime_error("point cloud has W components use Point3DH"));
840
841#ifdef _MSC_VER
842# pragma warning(pop)
843#endif
844
845 return {};
846 }
847
848 private:
849 std::size_t PointsTyped(Cvb::Point3D<double> *&points) const
850 {
851 return Internal::DoResCallValueOut<std::size_t>([&](std::size_t &value) {
852 return CVB_CALL_CAPI(
853 CVC3DPointCloudGetPointDsPointer(Handle(), reinterpret_cast<CExports::CVC3DPointD *&>(points), value));
854 });
855 }
856
857 std::size_t PointsTyped(Point3D<float> *&points) const
858 {
859 return Internal::DoResCallValueOut<std::size_t>([&](std::size_t &value) {
860 return CVB_CALL_CAPI(
861 CVC3DPointCloudGetPointFsPointer(Handle(), reinterpret_cast<CExports::CVC3DPointF *&>(points), value));
862 });
863 }
864
865 std::size_t PointsHTyped(Cvb::Point3DH<double> *&pointsH)
866 {
867 return Internal::DoResCallValueOut<std::size_t>([&](std::size_t &value) {
868 return CVB_CALL_CAPI(
869 CVC3DPointCloudGetPointHDsPointer(Handle(), reinterpret_cast<CExports::CVC3DPointHD *&>(pointsH), value));
870 });
871 }
872
873 std::size_t PointsHTyped(Cvb::Point3DH<float> *&pointsH)
874 {
875 return Internal::DoResCallValueOut<std::size_t>([&](std::size_t &value) {
876 return CVB_CALL_CAPI(
877 CVC3DPointCloudGetPointHFsPointer(Handle(), reinterpret_cast<CExports::CVC3DPointHF *&>(pointsH), value));
878 });
879 }
880
881 mutable std::unordered_map<void *, std::weak_ptr<class Plane>> planes_;
882
883 HandleGuard<PointCloud> handle_;
884 };
885
886 CVB_END_INLINE_NS
887} // 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:173
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:48
PlanePtr Plane(int index) const
Index based plane access.
Definition decl_point_cloud.hpp:634
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:283
void Transform(const AffineMatrix3D &affineTransformation, PointCloud &pointCloud)
Transforms all points in this point cloud by the given AffineTransformation and stores them in the gi...
Definition decl_point_cloud.hpp:557
std::size_t Points(Point3D< T > *&points) const
Gets the 3D points from the given point cloud.
Definition decl_point_cloud.hpp:203
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:187
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:377
static PointCloudPtr FromMemory(void *buffer, size_t size, Cvb::PointCloudFileFormat format)
Creates a point cloud reading memory from buffer.
Definition decl_point_cloud.hpp:140
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:499
PointCloudPtr Duplicate() const
Creates a new point cloud which is a copy this point cloud.
Definition decl_point_cloud.hpp:469
PointCloudPtr Transform(const AffineMatrix3D &transformation) const
Creates a new point cloud with all points being transformed by the given transformation.
Definition decl_point_cloud.hpp:526
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:302
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:335
int PlaneCount() const noexcept
Gets the number of planes enumerated by this object.
Definition decl_point_cloud.hpp:607
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:763
Matrix3D CalculateCovarianceMatrix() const
Calculates the covariance matrix of the point cloud.
Definition decl_point_cloud.hpp:255
class DataType DataType() const
Gets the DataType of the x,y,z(,w) components of the given PointCloud.
Definition decl_point_cloud.hpp:163
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:452
std::size_t NumPoints() const
Gets the number of x,y,z(,w) points in the given point cloud.
Definition decl_point_cloud.hpp:175
Plane3D FitPlane() const
Fits a plane in the points of the point cloud without cropping it.
Definition decl_point_cloud.hpp:271
size_t MemorySize(PointCloudFlags flags, Cvb::PointCloudFileFormat format) const
Determines the amount of memory needed for ToMemory.
Definition decl_point_cloud.hpp:670
void Transform(const Cvb::Matrix3DH &transformation, PointCloud &pointCloud)
Transforms all points in this point cloud by the given transformation and stores them in the given po...
Definition decl_point_cloud.hpp:573
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:729
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:422
void Save(const String &fileName) const
Saves the given point cloud to the file with the given FileName.
Definition decl_point_cloud.hpp:480
Cuboid CalculateBoundingBox() const
Calculates the minimum and maximum extent of the point cloud.
Definition decl_point_cloud.hpp:225
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:591
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:619
PointCloudLayout Layout() const
Get the layout of the available buffers/planes of the given point cloud.
Definition decl_point_cloud.hpp:151
std::size_t PointsH(Point3DH< T > *&pointsH) const
Tries to get the 3D points from the given point cloud.
Definition decl_point_cloud.hpp:215
size_t MemorySize(Cvb::PointCloudFileFormat format) const
Determines the amount of memory needed for ToMemory.
Definition decl_point_cloud.hpp:699
Point3D< double > CalculateCenterOfGravity() const
Calculates the center of gravity of the point cloud.
Definition decl_point_cloud.hpp:240
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:773
PointCloudPtr Transform(const Matrix3DH &transformation) const
Creates a new point cloud with all points being transformed by the given transformation.
Definition decl_point_cloud.hpp:540
PointCloudPtr Scale(Factors3D factors) const
Creates a new point cloud with all points being scaled by the given factors.
Definition decl_point_cloud.hpp:512
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
Container for range definitions.
Definition value_range.hpp:17
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 c_bayer_to_rgb.h:17
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
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
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