AI Watch A1
Multi-person 3D skeleton detection using Intel RealSense and OpenPose with Kafka support.
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
RealSenseManager Class Referenceabstract

RealSenseManager class is a class that abstracts the behavior of an Intel RealSense Camera, in order to capture frames, apply post-processing, and so on. More...

#include <RealSenseManager.hpp>

Inheritance diagram for RealSenseManager:
RealSenseD435Manager

Public Member Functions

 RealSenseManager (void)
 Construct a new RealSenseManager object. More...
 
virtual ~RealSenseManager ()=default
 Destroy the RealSenseManager object. More...
 
unsigned int getFrameID (void)
 Get the current frame ID value. More...
 
struct rs2_intrinsics & get_color_intrin (void)
 Get the color intrinsics object. More...
 
virtual void startEnvironment (rs2::pipeline &pipelineStream, struct rs2_intrinsics &color_intrin, float *scale, unsigned short int resX, unsigned short int resY, bool firstBoot)=0
 This method is useful to invoke at the boot of the program where we want to initialize the different mangers, start the camera and set up the related environment. This method can be overridden and specified according to camera model. More...
 
virtual void getVideoFramesRS (unsigned int user_nFrame, rs2::pipeline &pipelineStream, rs2::depth_frame &depthFrame, rs2::frame &colorFrame, rs2::frame &colorizedDepthFrame, const unsigned short int framesToSkip)=0
 Get user_nFrame video frames from the pipeline by applying a specific scaling factor. This method can be overridden and specified according to camera model. More...
 

Protected Member Functions

void setFrameID (unsigned int frameID)
 Set the Frame ID value. More...
 
void set_align (rs2::align align)
 Set the align object. More...
 
void set_depth_intrin (struct rs2_intrinsics depth_intrin)
 Set the depth intrinsics object. More...
 
void set_color_intrin (struct rs2_intrinsics &color_intrin)
 Set the color intrinsics object. More...
 
void set_depth_to_color (struct rs2_extrinsics depth_to_color)
 Set the depth extrinsics object. More...
 
void set_color_to_depth (struct rs2_extrinsics color_to_depth)
 Set the color extrinsics object. More...
 
rs2::align get_align (void)
 Get the align object. More...
 
struct rs2_intrinsics get_depth_intrin (void)
 Get the depth intrinsics object. More...
 
struct rs2_extrinsics get_depth_to_color (void)
 Get the depth extrinsics object. More...
 
struct rs2_extrinsics get_color_to_depth (void)
 Get the color extrinsics object. More...
 

Private Attributes

unsigned int frameID
 Current frame counter. More...
 
rs2::align align
 Auxiliary processing block that performs image alignment using depth data and camera calibration. More...
 
struct rs2_intrinsics depth_intrin
 Reference to depth stream intrinsics. More...
 
struct rs2_intrinsics color_intrin
 Reference to color stream intrinsics. More...
 
struct rs2_extrinsics depth_to_color
 Reference to depth stream extrinsics. More...
 
struct rs2_extrinsics color_to_depth
 Reference to color stream extrinsics. More...
 

Detailed Description

RealSenseManager class is a class that abstracts the behavior of an Intel RealSense Camera, in order to capture frames, apply post-processing, and so on.

Definition at line 25 of file RealSenseManager.hpp.

Constructor & Destructor Documentation

◆ RealSenseManager()

RealSenseManager::RealSenseManager ( void  )

Construct a new RealSenseManager object.

Definition at line 57 of file RealSenseManager.cpp.

57 : align(RS2_STREAM_COLOR) {
58 setFrameID(0);
59}
void setFrameID(unsigned int frameID)
Set the Frame ID value.
rs2::align align
Auxiliary processing block that performs image alignment using depth data and camera calibration.

References setFrameID().

◆ ~RealSenseManager()

virtual RealSenseManager::~RealSenseManager ( )
virtualdefault

Destroy the RealSenseManager object.

Member Function Documentation

◆ get_align()

rs2::align RealSenseManager::get_align ( void  )
protected

Get the align object.

Returns
rs2::align
See also
http://docs.ros.org/en/kinetic/api/librealsense2/html/classrs2_1_1align.html

Definition at line 39 of file RealSenseManager.cpp.

39 {
40 return this->align;
41}

References align.

Referenced by RealSenseD435Manager::getVideoFramesRS().

◆ get_color_intrin()

struct rs2_intrinsics & RealSenseManager::get_color_intrin ( void  )

Get the color intrinsics object.

Returns
struct rs2_intrinsics &

Definition at line 65 of file RealSenseManager.cpp.

65 {
66 return this->color_intrin;
67}
struct rs2_intrinsics color_intrin
Reference to color stream intrinsics.

References color_intrin.

Referenced by Skeleton::deprojectSkeletonPoints3D().

◆ get_color_to_depth()

struct rs2_extrinsics RealSenseManager::get_color_to_depth ( void  )
protected

Get the color extrinsics object.

Returns
struct rs2_extrinsics

Definition at line 51 of file RealSenseManager.cpp.

51 {
52 return this->color_to_depth;
53}
struct rs2_extrinsics color_to_depth
Reference to color stream extrinsics.

◆ get_depth_intrin()

struct rs2_intrinsics RealSenseManager::get_depth_intrin ( void  )
protected

Get the depth intrinsics object.

Returns
struct rs2_intrinsics

Definition at line 43 of file RealSenseManager.cpp.

43 {
44 return this->depth_intrin;
45}
struct rs2_intrinsics depth_intrin
Reference to depth stream intrinsics.

◆ get_depth_to_color()

struct rs2_extrinsics RealSenseManager::get_depth_to_color ( void  )
protected

Get the depth extrinsics object.

Returns
struct rs2_extrinsics

Definition at line 47 of file RealSenseManager.cpp.

47 {
48 return this->depth_to_color;
49}
struct rs2_extrinsics depth_to_color
Reference to depth stream extrinsics.

◆ getFrameID()

unsigned int RealSenseManager::getFrameID ( void  )

Get the current frame ID value.

Returns
unsigned int

Definition at line 61 of file RealSenseManager.cpp.

61 {
62 return this->frameID;
63}
unsigned int frameID
Current frame counter.

References frameID.

Referenced by OpenCV_Manager::getVideoFramesCV(), RealSenseD435Manager::getVideoFramesRS(), FacadeSingleton::sendData(), and OpenCV_Manager::showSkeletonsCV().

◆ getVideoFramesRS()

virtual void RealSenseManager::getVideoFramesRS ( unsigned int  user_nFrame,
rs2::pipeline &  pipelineStream,
rs2::depth_frame &  depthFrame,
rs2::frame &  colorFrame,
rs2::frame &  colorizedDepthFrame,
const unsigned short int  framesToSkip 
)
pure virtual

Get user_nFrame video frames from the pipeline by applying a specific scaling factor. This method can be overridden and specified according to camera model.

Parameters
user_nFrameframe's number to capture according to user choice.
pipelineStreamThe pipeline simplifies the user interaction with the device and computer vision processing modules. The class abstracts the camera configuration and streaming, and the vision modules triggering and threading. It lets the application focus on the computer vision output of the modules, or the device output data. The pipeline can manage computer vision modules, which are implemented as a processing block. The pipeline is the consumer of the processing block interface, while the application consumes the computer vision interface.
depthFrameReference to depth frame object that will be captured.
colorFrameReference to color frame object that will be captured.
colorizedDepthFrameReference to colorized depth frame object that will be captured.
framesToSkipFrames' number to skip in order to ignore a certain amount of frames and extend the recording interval. A '0' value means 'capture each frame'.
See also
https://dev.intelrealsense.com/docs/docs-get-started
getVideoFramesCV(unsigned int user_nFrame, rs2::pipeline & pipelineStream, float scale)
getVideoFrames (unsigned int user_nFrame, rs2::pipeline & pipelineStream, float scale)

Implemented in RealSenseD435Manager.

Referenced by OpenCV_Manager::getVideoFramesCV().

◆ set_align()

void RealSenseManager::set_align ( rs2::align  align)
protected

Set the align object.

See also
http://docs.ros.org/en/kinetic/api/librealsense2/html/classrs2_1_1align.html
Parameters
alignAuxiliary processing block that performs image alignment using depth data and camera calibration.

Definition at line 19 of file RealSenseManager.cpp.

19 {
20 this->align = align;
21}

References align.

Referenced by RealSenseD435Manager::startEnvironment().

◆ set_color_intrin()

void RealSenseManager::set_color_intrin ( struct rs2_intrinsics &  color_intrin)
protected

Set the color intrinsics object.

Parameters
color_intrinReference to color stream intrinsics.

Definition at line 27 of file RealSenseManager.cpp.

27 {
29}

References color_intrin.

Referenced by RealSenseD435Manager::startEnvironment().

◆ set_color_to_depth()

void RealSenseManager::set_color_to_depth ( struct rs2_extrinsics  color_to_depth)
protected

Set the color extrinsics object.

Parameters
color_to_depthReference to color stream extrinsics.

Definition at line 35 of file RealSenseManager.cpp.

35 {
37}

References color_to_depth.

Referenced by RealSenseD435Manager::startEnvironment().

◆ set_depth_intrin()

void RealSenseManager::set_depth_intrin ( struct rs2_intrinsics  depth_intrin)
protected

Set the depth intrinsics object.

Parameters
depth_intrinReference to depth stream intrinsics.

Definition at line 23 of file RealSenseManager.cpp.

23 {
25}

References depth_intrin.

Referenced by RealSenseD435Manager::startEnvironment().

◆ set_depth_to_color()

void RealSenseManager::set_depth_to_color ( struct rs2_extrinsics  depth_to_color)
protected

Set the depth extrinsics object.

Parameters
depth_to_colorReference to depth stream extrinsics.

Definition at line 31 of file RealSenseManager.cpp.

31 {
33}

References depth_to_color.

Referenced by RealSenseD435Manager::startEnvironment().

◆ setFrameID()

void RealSenseManager::setFrameID ( unsigned int  frameID)
protected

Set the Frame ID value.

Parameters
frameIDCurrent frame counter.

Definition at line 15 of file RealSenseManager.cpp.

15 {
16 this->frameID = frameID;
17}

References frameID.

Referenced by RealSenseD435Manager::getVideoFramesRS(), and RealSenseManager().

◆ startEnvironment()

virtual void RealSenseManager::startEnvironment ( rs2::pipeline &  pipelineStream,
struct rs2_intrinsics &  color_intrin,
float *  scale,
unsigned short int  resX,
unsigned short int  resY,
bool  firstBoot 
)
pure virtual

This method is useful to invoke at the boot of the program where we want to initialize the different mangers, start the camera and set up the related environment. This method can be overridden and specified according to camera model.

Parameters
pipelineStreamThe pipeline simplifies the user interaction with the device and computer vision processing modules. The class abstracts the camera configuration and streaming, and the vision modules triggering and threading. It lets the application focus on the computer vision output of the modules, or the device output data. The pipeline can manage computer vision modules, which are implemented as a processing block. The pipeline is the consumer of the processing block interface, while the application consumes the computer vision interface.
color_intrinReference to color video stream intrinsics.
scalePointer to scaling factor.
resXx resoultion <->.
resYy resolution.
firstBoottrue if the method is called for the first time (in this case a kind of camera calibration is done), false otherwise.
See also
https://dev.intelrealsense.com/docs/docs-get-started
startEnvironment(rs2::pipeline & pipelineStream, struct rs2_intrinsics & color_intrin, float * scale, unsigned short int resX, unsigned short int resY, const char * destinationKafkaTopic)

Implemented in RealSenseD435Manager.

Referenced by FacadeSingleton::startEnvironment().

Member Data Documentation

◆ align

rs2::align RealSenseManager::align
private

Auxiliary processing block that performs image alignment using depth data and camera calibration.

See also
http://docs.ros.org/en/kinetic/api/librealsense2/html/classrs2_1_1align.html

Definition at line 35 of file RealSenseManager.hpp.

Referenced by get_align(), and set_align().

◆ color_intrin

struct rs2_intrinsics RealSenseManager::color_intrin
private

◆ color_to_depth

struct rs2_extrinsics RealSenseManager::color_to_depth
private

Reference to color stream extrinsics.

See also
https://dev.intelrealsense.com/docs/projection-in-intel-realsense-sdk-20

Definition at line 55 of file RealSenseManager.hpp.

Referenced by set_color_to_depth().

◆ depth_intrin

struct rs2_intrinsics RealSenseManager::depth_intrin
private

Reference to depth stream intrinsics.

See also
https://dev.intelrealsense.com/docs/projection-in-intel-realsense-sdk-20

Definition at line 40 of file RealSenseManager.hpp.

Referenced by set_depth_intrin().

◆ depth_to_color

struct rs2_extrinsics RealSenseManager::depth_to_color
private

Reference to depth stream extrinsics.

See also
https://dev.intelrealsense.com/docs/projection-in-intel-realsense-sdk-20

Definition at line 50 of file RealSenseManager.hpp.

Referenced by set_depth_to_color().

◆ frameID

unsigned int RealSenseManager::frameID
private

Current frame counter.

Definition at line 30 of file RealSenseManager.hpp.

Referenced by getFrameID(), and setFrameID().


The documentation for this class was generated from the following files: