AI Watch A1
Multi-person 3D skeleton detection using Intel RealSense and OpenPose with Kafka support.
Functions | Variables
main.cpp File Reference
#include "FacadeSingleton.hpp"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 Main. More...
 

Variables

const int expected_argc = 5
 
const char * expectedUsageMessage
 

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Main.

The main function contains a sample code to launch the program.

Parameters
argcMain argument count
argvMain argument values
Returns
int The return value for main indicates how the program exited. Normal exit is represented by a 0 return value from main. Abnormal exit is signaled by a non-zero return, but there is no standard for how non-zero codes are interpreted.

Definition at line 229 of file main.cpp.

229 {
230 rs2::pipeline pipelineStream;
231 // Scaling factor for distance frame and topic name for kafka connection.
232 float scale;
233 const char * destinationKafkaTopic = "topic1";
234 // Optimal resolution for D435: 848x480.
235 unsigned int user_nFrame = 50, resX = 848, resY = 480;
236 const unsigned short int framesToSkip = 5;
237 const float skeletonThreshold = 0.05;
238 struct rs2_intrinsics color_intrin;
239 Room room = CVPR_Lab();
240
241 // Declaring a pointer to a FacadeSingleton object (it will be helpful to easily interact with all submodules) and starting D435 camera.
243 myUtility->startEnvironment(pipelineStream, color_intrin, & scale, resX, resY, destinationKafkaTopic, room);
244
245 /*
246 An infinite loop that captures the frames seen from the camera, gives them to OpenPose, gets the output, and builds skeletons.
247 After that, we create a properly formatted output JSON file and send it via Kafka for further elaboration.
248 */
249 while (true) {
250 myUtility->getVideoFrames(user_nFrame, pipelineStream, scale, framesToSkip);
251 myUtility->getVideoBodyKeyPoints(& argc, & argv);
252 myUtility->showSkeletons(user_nFrame, skeletonThreshold);
253 myUtility->sendData(user_nFrame);
254 myUtility->cleanBuildFolder();
255 }
256 return EXIT_SUCCESS;
257}
CVPR Lab class represents the CVPR Lab abstraction. The CVPR Lab is a Room with default values....
Definition: CVPR_Lab.hpp:23
FacadeSingleton class is used as a single access point to a simplified interface.
void showSkeletons(unsigned int user_nFrame, const float skeletonThreshold)
Retrieve OpenPose's output, convert it to RealSense coordinate's space, show results and save them.
void startEnvironment(rs2::pipeline &pipelineStream, struct rs2_intrinsics &color_intrin, float *scale, unsigned short int resX, unsigned short int resY, const char *destinationKafkaTopic, Room room)
This method is useful to invoke at the boot of the program where we want to initialize the different ...
void getVideoBodyKeyPoints(int *argc, char ***argv)
Start and execute OpenPose submodule.
void getVideoFrames(unsigned int user_nFrame, rs2::pipeline &pipelineStream, float scale, const unsigned short int framesToSkip)
Get user_nFrame video frames from the pipeline by applying a specific scaling factor.
void cleanBuildFolder(void)
This method cleans the build folder, in order to prepare the environment for the next loop iteration....
void sendData(unsigned int user_nFrame)
Send saved results by getVideoBodyKeyPoints(...) via Kafka using the KafkaManager.
static FacadeSingleton * getInstance(void)
Get the unique class instance. This methods should be called in the following scenario: when we just ...
Room class represents the Room abstraction. A Room object has different specifications,...
Definition: Room.hpp:64
const char * expectedUsageMessage
Definition: main.cpp:214
const int expected_argc
Definition: main.cpp:213

References FacadeSingleton::cleanBuildFolder(), expected_argc, expectedUsageMessage, FacadeSingleton::getInstance(), FacadeSingleton::getVideoBodyKeyPoints(), FacadeSingleton::getVideoFrames(), FacadeSingleton::sendData(), FacadeSingleton::showSkeletons(), and FacadeSingleton::startEnvironment().

Variable Documentation

◆ expected_argc

const int expected_argc = 5

Definition at line 213 of file main.cpp.

Referenced by FacadeSingleton::FacadeSingleton(), FacadeSingleton::getInstance(), and main().

◆ expectedUsageMessage

const char* expectedUsageMessage
Initial value:
= "Usage: sudo ./AI_Watch_A1.bin <path/openpose folder/> <./path/openpose.bin> "
"<path/images folder/> <path/JSON output folder/>"

Definition at line 214 of file main.cpp.

Referenced by FacadeSingleton::FacadeSingleton(), FacadeSingleton::getInstance(), and main().