AI Watch A1
Multi-person 3D skeleton detection using Intel RealSense and OpenPose with Kafka support.
FacadeSingleton.hpp
Go to the documentation of this file.
1//
2// FacadeSingleton.hpp
3// AI Watch A1
4//
5// Created by Denny Caruso on 20/07/22.
6//
7
8// License: Apache 2.0. See LICENSE file in root directory.
9// Copyright(c) 2022. All Rights Reserved.
10
11#ifndef FacadeSingleton_hpp
12#define FacadeSingleton_hpp
13
14#include "../Command/SystemCommand.hpp"
15#include "../Managers/RealSenseManagers/RealSenseManager.hpp"
16#include "../Managers/OutputManagers/OutputManager.hpp"
17#include "../Managers/OpenCV_Manager.hpp"
18#include "../Managers/UsageManager.hpp"
19#include "../Managers/CoordinateManagers/CoordinateMappingManager.hpp"
20#include "../Managers/ImageManager.hpp"
21#include "../Managers/KafkaManager.hpp"
22#include <fstream>
23
24
25
27class OutputManager;
28class OpenCV_Manager;
29class UsageManager;
31class ImageManager;
32class KafkaManager;
33
34
35
45private:
53 static std::mutex singletonMutex;
54
55
56
104
105
106
113 FacadeSingleton (const int expected_argc = 0, const char * expectedUsageMessage = nullptr);
117 ~FacadeSingleton(void);
118protected:
161public:
172 void operator= (const FacadeSingleton &) = delete;
173
174
175
184 static FacadeSingleton * getInstance (const int expected_argc, const char * expectedUsageMessage);
190 static FacadeSingleton * getInstance (void);
191
192
193
237
238
239
258 void startEnvironment (rs2::pipeline & pipelineStream, struct rs2_intrinsics & color_intrin, float * scale,
259 unsigned short int resX, unsigned short int resY, const char * destinationKafkaTopic, Room room);
274 void getVideoFrames (unsigned int user_nFrame, rs2::pipeline & pipelineStream, float scale, const unsigned short int framesToSkip);
281 void getVideoBodyKeyPoints (int * argc, char *** argv);
289 void showSkeletons (unsigned int user_nFrame, const float skeletonThreshold);
296 void sendData (unsigned int user_nFrame);
301 void cleanBuildFolder (void);
302};
303
304#endif /* FacadeSingleton_hpp */
The CoordinateMappingManager class is a class that is responsible for converting coordinates values f...
FacadeSingleton class is used as a single access point to a simplified interface.
RealSenseManager * cameraManager
A pointer to RealSenseManager object. A RealSenseManager object is responsible for handling the camer...
CoordinateMappingManager * getCoordinateMappingManager(void)
Get the CoordinateMappingManager pointer.
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 setOutputManager(OutputManager *outputManager)
Set the OutputManager pointer.
void setUsageManager(UsageManager *usageManager)
Set the UsageManager pointer.
CoordinateMappingManager * coordinateMappingManager
A pointer to CoordinateMappingManager object. A CoordinateMappingManager object is responsible for tr...
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 setImageManager(ImageManager *imageManager)
Set the ImageManager pointer.
OpenCV_Manager * getOpenCV_Manager(void)
Get the OpenCV_Manager pointer.
ImageManager * getImageManager(void)
Get the ImageManager pointer.
FacadeSingleton(FacadeSingleton &other)=delete
Disabling the possibility to clone the Singleton object. Singletons should not be cloneable.
KafkaManager * kafkaManager
A pointer to KafkaManager object. A KafkaManager object is responsible for sending previously produce...
ImageManager * imageManager
A pointer to CoordinateMappingManager object. A CoordinateMappingManager object is responsible for br...
static std::mutex singletonMutex
Mutex for thread-safe access.
void setCoordinateMappingManager(CoordinateMappingManager *coordinateMappingManager)
Set the CoordinateMappingManager pointer.
OutputManager * outputManager
A pointer to OutputManager object. An OutputManager object is responsible for handling the final outp...
void setOpenCV_Manager(OpenCV_Manager *openCV_Manager)
Set the OpenCV_Manager pointer.
void setKafkaManager(KafkaManager *kafkaManager)
Set the KafkaManager pointer.
UsageManager * usageManager
A pointer to UsageManager object. An UsageManager object is responsible for checking if the parameter...
void getVideoBodyKeyPoints(int *argc, char ***argv)
Start and execute OpenPose submodule.
static FacadeSingleton * sharedInstance
The field for storing the singleton instance.
~FacadeSingleton(void)
Destroy the Facade Singleton object.
OpenCV_Manager * openCV_Manager
A pointer to OpenCV_Manager object. An OpenCV_Manager object is responsible for converting camera fra...
OutputManager * getOutputManager(void)
Get the OutputManager pointer.
void setCameraManager(RealSenseManager *cameraManager)
Set the RealSenseManager pointer.
UsageManager * getUsageManager(void)
Get the UsageManager pointer.
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.
RealSenseManager * getCameraManager(void)
Get the RealSenseManager pointer.
void cleanBuildFolder(void)
This method cleans the build folder, in order to prepare the environment for the next loop iteration....
FacadeSingleton(const int expected_argc=0, const char *expectedUsageMessage=nullptr)
Construct a new Facade Singleton object.
void sendData(unsigned int user_nFrame)
Send saved results by getVideoBodyKeyPoints(...) via Kafka using the KafkaManager.
void operator=(const FacadeSingleton &)=delete
Disabling the possibility to assign a Singleton object. Singletons should not be assignable.
static FacadeSingleton * getInstance(void)
Get the unique class instance. This methods should be called in the following scenario: when we just ...
KafkaManager * getKafkaManager(void)
Get the KafkaManager pointer.
ImageManager class is a general-purpose class useful for operations on images such as loading,...
Kafka class is a class that is responsible to send all generated output data, via Apache Kafka techno...
OpenCV_Manager class is used for general-purpose tasks on the captured frames.
OutputManager class is a class that abstracts final output-producing operations. An output format inh...
RealSenseManager class is a class that abstracts the behavior of an Intel RealSense Camera,...
Room class represents the Room abstraction. A Room object has different specifications,...
Definition: Room.hpp:64
UsageManager class is a utility class that helps with configuration parameters.
const char * expectedUsageMessage
Definition: main.cpp:214
const int expected_argc
Definition: main.cpp:213