본문 바로가기

심화/포인트 클라우드 기반

PCL RGB

1. RGBA

1.1 Packing

int rgb = ((int)r) << 16 | ((int)g) << 8 | ((int)b);

R(8bit) | G(8bit) | B(8bit)

 

1.2 Unpacking

int rgb = ...;
std::uint8_t r = (rgb >> 16) & 0x0000ff;
std::uint8_t g = (rgb >> 8)  & 0x0000ff;
std::uint8_t b = (rgb)     & 0x0000ff;

 

5가지 입력

pcl::RGB 구조
pcl::PointXYZRGB 구조
pcl::PointXYZRGBA 구조
pcl::PointXYZRGBL 구조

더보기

(1) 인자를 안 받는 경우(RGBL의 경우는 라벨만 입력을 받는 경우)

constexpr pcl::RGB::RGB( )	
constexpr pcl::PointXYZRGBA::PointXYZRGBA(	)	
constexpr pcl::PointXYZRGBL::PointXYZRGBL(std::uint32_t	_label = 0)

(2) 포인트 한 점을 입력으로 받는 경우

constexpr pcl::RGB::RGB(const _RGB &p)	
constexpr pcl::PointXYZRGBA::PointXYZRGBA(const _PointXYZRGBA &p)
constexpr pcl::PointXYZRGBL::PointXYZRGBL(const _PointXYZRGBL &p)

(3) RGB 값을 입력으로 받는 경우

constexpr pcl::RGB::RGB(
	std::uint8_t _r,
	std::uint8_t _g,
	std::uint8_t _b,
	std::uint8_t _a = 255
)
constexpr pcl::PointXYZRGBA::PointXYZRGBA(
	std::uint8_t 	_r,
	std::uint8_t 	_g,
	std::uint8_t 	_b,
	std::uint8_t 	_a 
)	
constexpr pcl::PointXYZRGBL::PointXYZRGBL(
	std::uint8_t 	_r,
	std::uint8_t 	_g,
	std::uint8_t 	_b 
)

(4) X, Y, Z 값을 입력으로 받는 경우

constexpr pcl::PointXYZRGBA::PointXYZRGBA(
	float 	_x,
	float 	_y,
	float 	_z 
)	

constexpr pcl::PointXYZRGBL::PointXYZRGBL(
	float 	_x,
	float 	_y,
	float 	_z 
)

(5) RGB, XYZ 모두 입력으로 받는 경우

constexpr pcl::PointXYZRGBA::PointXYZRGBA(
	float 	_x,
	float 	_y,
	float 	_z,
	std::uint8_t 	_r,
	std::uint8_t 	_g,
	std::uint8_t 	_b,
	std::uint8_t 	_a 
)


constexpr pcl::PointXYZRGBL::PointXYZRGBL(
	float 	_x,
	float 	_y,
	float 	_z,
	std::uint8_t 	_r,
	std::uint8_t 	_g,
	std::uint8_t 	_b,
	std::uint32_t 	_label = 0,
	std::uint8_t 	_a = 255 
)

 Operator

std::ostream& operator<<(
	std::ostream &os,
	const RGB &p 
)

std::ostream& operator<<(
	std::ostream &os,
	const PointXYZRGBA &p 
)

std::ostream& operator<<(
	std::ostream &os,
	const PointXYZRGBL &p 
)

 

 

그외 포인트 타입은 아래에 정리되어 있다

- https://pointclouds.org/documentation/point__types_8hpp_source.html

 

Point Cloud Library (PCL): pcl/impl/point_types.hpp Source File

constexpr PointSurfel(float _x, float _y, float _z, float _nx, float _ny, float _nz, std::uint8_t _r, std::uint8_t _g, std::uint8_t _b, std::uint8_t _a, float _radius, float _confidence, float _curvature) A point structure representing a Shape Context. A p

pointclouds.org

※ RGB 값을 포함하는 포인트 타입만 해도 5가지 이다

 // Define all point types that include RGB data
 #define PCL_RGB_POINT_TYPES     \
   (pcl::PointXYZRGBA)           \
   (pcl::PointXYZRGB)            \
   (pcl::PointXYZRGBL)           \
   (pcl::PointXYZRGBNormal)      \
   (pcl::PointSurfel)            \

 

 

출처)

https://pointclouds.org/documentation/structpcl_1_1_r_g_b.html

- https://pointclouds.org/documentation/structpcl_1_1_point_x_y_z_r_g_b_a.html

- https://pointclouds.org/documentation/structpcl_1_1_point_x_y_z_r_g_b_l.html

반응형