0.4.3
PointCloud.h
浏览该文件的文档.
1//
2// Created by ALSON08 on 2023/10/9.
3//
4
5#ifndef ALSON_CLASSIC_BASE_ENTITY_POINT_CLOUD_H
6#define ALSON_CLASSIC_BASE_ENTITY_POINT_CLOUD_H
7
8
9// std
10#include <cstdint>
11#include <string>
12#include <exception>
13#include <memory>
14
15// alson
17
18
19namespace ALSON {
20
21
31enum class PointType : int {
32 UNKNOWN = 0,
33 ALSON_POINT_XYZ = 1,
38};
39
40
50enum class PclPointType : int {
51 PCL_POINT_XYZ = 101,
52 PCL_POINT_XYZI = 102,
53 PCL_POINT_XYZRGB = 103,
56};
57
58
74public:
87
105 PointCloud(int w, int h, PointType t);
106
129 PointCloud(int w, int h, PointType t, uint8_t* d);
131
134 PointCloud(PointCloud&& a) noexcept;
136
137public:
151 int size() const { return width * height; }
152
189 template<typename T>
190 T* ptr();
191
207 template<typename T>
208 const T* ptr() const;
209
229 template<typename T>
230 T& at(int i, int j = 0);
231
251 template<typename T>
252 const T& at(int i, int j = 0) const;
253
273 static PointCloud create(int width, int height, PointType pointType);
274
297 static PointCloud create(int width, int height, PointType pointType, uint8_t* data);
298
335 static PointCloud createFromPcl(int width, int height, PointType pointType, void* pclData);
336
351
383 void cloneToPcl(void* pclData, PclPointType pclPointType) const;
384
419 static PointCloud load(const std::string& filename, PointType pointType = PointType::ALSON_POINT_XYZ);
420
451 void save(const std::string& filename) const;
452
504 int getXPos() const;
505
522 int getYPos() const;
523
540 int getZPos() const;
541
558 int getIPos() const;
559
576 int getRPos() const;
577
594 int getGPos() const;
595
612 int getBPos() const;
613
630 int getNXPos() const;
631
648 int getNYPos() const;
649
666 int getNZPos() const;
667
684 static int getElementSize(PointType type);
685
686private:
687 void fromPclPointXYZ(void* pclData) const;
688 void fromPclPointXYZI(void* pclData) const;
689 void fromPclPointXYZRGB(void* pclData) const;
690 void fromPclPointXYZINormal(void* pclData) const;
691 void fromPclPointXYZRGBNormal(void* pclData) const;
692
693 void toPclPointXYZ(void* pclData) const;
694 void toPclPointXYZI(void* pclData) const;
695 void toPclPointXYZRGB(void* pclData) const;
696 void toPclPointXYZINormal(void* pclData) const;
697 void toPclPointXYZRGBNormal(void* pclData) const;
698
699public:
711 int width;
763 uint8_t* data;
764
765private:
766 std::allocator<uint8_t> m_allocator;
767 int* m_refCount;
768}; // class PointCloud
769
770
771template<typename T>
772inline T* PointCloud::ptr() {
773 return (T*) data;
774}
775
776template<typename T>
777inline const T* PointCloud::ptr() const {
778 return (T*) data;
779}
780
781template<typename T>
782inline T& PointCloud::at(int i, int j) {
783 auto* p = (T*) data + i + j * width;
784 return *p;
785}
786
787template<typename T>
788inline const T& PointCloud::at(int i, int j) const {
789 const auto* p = (T*) data + i * width + j;
790 return *p;
791}
792
793
794} // namespace ALSON
795
796
797#endif // !ALSON_CLASSIC_BASE_ENTITY_POINT_CLOUD_H
int getIPos() const
PointCloud(int w, int h, PointType t, uint8_t *d)
int getXPos() const
int getGPos() const
T & at(int i, int j=0)
static PointCloud create(int width, int height, PointType pointType, uint8_t *data)
static PointCloud create(int width, int height, PointType pointType)
void save(const std::string &filename) const
PointCloud & operator=(const PointCloud &a)
static int getElementSize(PointType type)
int getZPos() const
int getNYPos() const
static PointCloud load(const std::string &filename, PointType pointType=PointType::ALSON_POINT_XYZ)
PointCloud(int w, int h, PointType t)
PointCloud & operator=(PointCloud &&a) noexcept
int getRPos() const
static PointCloud createFromPcl(int width, int height, PointType pointType, void *pclData)
int getNXPos() const
PointCloud(const PointCloud &a)
PointCloud(PointCloud &&a) noexcept
void cloneToPcl(void *pclData, PclPointType pclPointType) const
int getYPos() const
int getNZPos() const
int getBPos() const
PointCloud clone() const
#define ALSON_API
@ ALSON_POINT_XYZRGB_NORMAL
x、y、z、r、g、b、normal
@ ALSON_POINT_XYZ
x、y、z
@ ALSON_POINT_XYZI_NORMAL
x、y、z、index、normal
@ ALSON_POINT_XYZRGB
x、y、z、r、g、b
@ ALSON_POINT_XYZI
x、y、z、index
@ PCL_POINT_XYZRGB_NORMAL
x、y、z、r、g、b、normal
@ PCL_POINT_XYZI
x、y、z、index
@ PCL_POINT_XYZI_NORMAL
x、y、z、index、normal
@ PCL_POINT_XYZ
x、y、z
@ PCL_POINT_XYZRGB
x、y、z、r、g、b
My Custom Doxygen Footer
Data Processing Programmer's Guide 0.4.3
Copyright © 2014-2024 Henan Alson Intelligent Technology Co, Ltd 河南埃尔森智能科技有限公司 版权所有 豫ICP备15002212号