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
OpenPoseCommand Class Reference

The OpenPoseCommand class is a class that implements a command to start and run OpenPose. More...

#include <SystemCommand.hpp>

Inheritance diagram for OpenPoseCommand:
SystemCommand

Public Member Functions

void executeCommand (int *argc, char ***argv)
 This method is responsible for executing commands on the system based on the filled command string. If the string is empty, then no command is executed. More...
 

Protected Member Functions

void setCommand (int *argc, char ***argv) override
 Set the string command to an OpenPose properly formatted command. More...
 
void setCommand (std::string command)
 Set the string command with a particularly given string passed as a parameter. More...
 
std::string getCommand (void)
 Get the string command. More...
 

Private Attributes

std::string command
 The final command given to the system by the program. More...
 

Detailed Description

The OpenPoseCommand class is a class that implements a command to start and run OpenPose.

Definition at line 88 of file SystemCommand.hpp.

Member Function Documentation

◆ executeCommand()

void SystemCommand::executeCommand ( int *  argc,
char ***  argv 
)
inherited

This method is responsible for executing commands on the system based on the filled command string. If the string is empty, then no command is executed.

Parameters
argcpointer to argc from the main function or based on what the program reads from the configuration file.
argvpointer to argv from the main function or based on what the program reads from the configuration file.

Definition at line 23 of file SystemCommand.cpp.

23 {
24 setCommand(argc, argv);
25 if (getCommand().size() > 0 && getCommand() != "OP") std::system(getCommand().c_str());
26}
std::string getCommand(void)
Get the string command.
virtual void setCommand(int *argc, char ***argv)=0
Set the string command. The method is inherited from the subclasses and overridden in order to expres...

References SystemCommand::getCommand(), and SystemCommand::setCommand().

Referenced by FacadeSingleton::cleanBuildFolder(), and FacadeSingleton::getVideoBodyKeyPoints().

◆ getCommand()

std::string SystemCommand::getCommand ( void  )
protectedinherited

Get the string command.

Returns
std::string

Definition at line 19 of file SystemCommand.cpp.

19 {
20 return this->command;
21}
std::string command
The final command given to the system by the program.

References SystemCommand::command.

Referenced by SystemCommand::executeCommand().

◆ setCommand() [1/2]

void OpenPoseCommand::setCommand ( int *  argc,
char ***  argv 
)
overrideprotectedvirtual

Set the string command to an OpenPose properly formatted command.

Parameters
argcpointer to argc from the main function.
argvpointer to argv from the main function.

Implements SystemCommand.

Definition at line 130 of file OpenPoseCommand.cpp.

130 {
131 UsageManager * usageManagerInstance = UsageManager::getInstance();
132 if (usageManagerInstance == nullptr) CV_Error(USAGE_MANAGER_NULLPTR_ERROR, USAGE_MANAGER_NULLPTR_SCOPE);
133 char *** localArgv = usageManagerInstance->get_argv();
134 std::stringstream openPoseTerminalCommand;
135 const char * openPoseFolder = (* localArgv)[openPoseFolderOffset];
136 const char * openPoseExecuteCommand = (* localArgv)[openPoseExecuteCommandOffset];
137 const char * imagesFolder = (* localArgv)[imagesFolderOffset];
138 const char * outputFolder = (* localArgv)[outputFolderOffset];
139
140 openPoseTerminalCommand << "cd " << openPoseFolder << " && " << openPoseExecuteCommand
141 << " --net_resolution -1x128 --num_gpu 1 --num_gpu_start 2 --display 0 --render_pose 0 --image_dir "
142 << imagesFolder << "rgb/" << " --write_json " << outputFolder << "op/"
143 << " --logging_level 255 > /dev/null";
144 SystemCommand::setCommand(std::string(openPoseTerminalCommand.str()));
145}
UsageManager class is a utility class that helps with configuration parameters.
char *** get_argv(void)
Get the argv's pointer.
static UsageManager * getInstance(void)
Get the unique class instance. This methods should be called in the following scenario: when we just ...
static const short int openPoseFolderOffset
Definition: constants.hpp:62
static const short int imagesFolderOffset
Definition: constants.hpp:64
static const short int openPoseExecuteCommandOffset
Definition: constants.hpp:63
static const short int USAGE_MANAGER_NULLPTR_ERROR
Definition: constants.hpp:35
static const short int outputFolderOffset
Definition: constants.hpp:65
static const char * USAGE_MANAGER_NULLPTR_SCOPE
Definition: constants.hpp:36

References UsageManager::get_argv(), UsageManager::getInstance(), imagesFolderOffset, openPoseExecuteCommandOffset, openPoseFolderOffset, outputFolderOffset, SystemCommand::setCommand(), USAGE_MANAGER_NULLPTR_ERROR, and USAGE_MANAGER_NULLPTR_SCOPE.

◆ setCommand() [2/2]

void SystemCommand::setCommand ( std::string  command)
protectedinherited

Set the string command with a particularly given string passed as a parameter.

Parameters
command

Definition at line 15 of file SystemCommand.cpp.

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

References SystemCommand::command.

Member Data Documentation

◆ command

std::string SystemCommand::command
privateinherited

The final command given to the system by the program.

Definition at line 33 of file SystemCommand.hpp.

Referenced by SystemCommand::getCommand(), and SystemCommand::setCommand().


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