|
| Wrapper (const ThreadManagerMode threadManagerMode=ThreadManagerMode::Synchronous) |
|
| ~Wrapper () |
|
void | disableMultiThreading () |
|
void | setWorkerInput (const TWorker &worker, const bool workerOnNewThread=true) |
|
void | setWorkerPostProcessing (const TWorker &worker, const bool workerOnNewThread=true) |
|
void | setWorkerOutput (const TWorker &worker, const bool workerOnNewThread=true) |
|
void | configure (const WrapperStructPose &wrapperStructPose, const WrapperStructInput &wrapperStructInput, const WrapperStructOutput &wrapperStructOutput=WrapperStructOutput{}) |
|
void | configure (const WrapperStructPose &wrapperStructPose, const WrapperStructHand &wrapperStructHand, const WrapperStructInput &wrapperStructInput, const WrapperStructOutput &wrapperStructOutput=WrapperStructOutput{}) |
|
void | configure (const WrapperStructPose &wrapperStructPose, const WrapperStructFace &wrapperStructFace, const WrapperStructInput &wrapperStructInput, const WrapperStructOutput &wrapperStructOutput=WrapperStructOutput{}) |
|
void | configure (const WrapperStructPose &wrapperStructPose=WrapperStructPose{}, const WrapperStructFace &wrapperStructFace=WrapperStructFace{}, const WrapperStructHand &wrapperStructHand=WrapperStructHand{}, const WrapperStructInput &wrapperStructInput=WrapperStructInput{}, const WrapperStructOutput &wrapperStructOutput=WrapperStructOutput{}) |
|
void | exec () |
|
void | start () |
|
void | stop () |
|
bool | isRunning () const |
|
bool | tryEmplace (std::shared_ptr< TDatums > &tDatums) |
|
bool | waitAndEmplace (std::shared_ptr< TDatums > &tDatums) |
|
bool | tryPush (const std::shared_ptr< TDatums > &tDatums) |
|
bool | waitAndPush (const std::shared_ptr< TDatums > &tDatums) |
|
bool | tryPop (std::shared_ptr< TDatums > &tDatums) |
|
bool | waitAndPop (std::shared_ptr< TDatums > &tDatums) |
|
template<typename TDatums, typename TWorker = std::shared_ptr<Worker<std::shared_ptr<TDatums>>>, typename TQueue = Queue<std::shared_ptr<TDatums>>>
class op::Wrapper< TDatums, TWorker, TQueue >
Wrapper: OpenPose all-in-one wrapper template class. Wrapper allows the user to set up the input (video, webcam, custom input, etc.), pose, face and/or hands estimation and rendering, and output (integrated small GUI, custom output, etc.).
This function can be used in 2 ways:
- Synchronous mode: call the full constructor with your desired input and output workers.
- Asynchronous mode: call the empty constructor Wrapper() + use the emplace and pop functions to push the original frames and retrieve the processed ones.
- Mix of them:
- Synchronous input + asynchronous output: call the constructor Wrapper(ThreadManagerMode::Synchronous, workersInput, {}, true)
- Asynchronous input + synchronous output: call the constructor Wrapper(ThreadManagerMode::Synchronous, nullptr, workersOutput, irrelevantBoolean, true)
template<typename TDatums , typename TWorker , typename TQueue >
void op::Wrapper< TDatums, TWorker, TQueue >::disableMultiThreading |
( |
| ) |
|
Disable multi-threading. Useful for debugging and logging, all the Workers will run in the same thread. Note that workerOnNewThread (argument for setWorkerInput, setWorkerPostProcessing and setWorkerOutput) will not make any effect.
template<typename TDatums , typename TWorker , typename TQueue >
void op::Wrapper< TDatums, TWorker, TQueue >::start |
( |
| ) |
|
Function to start multi-threading. Similar to exec(), but start() does not block the thread that calls the function. It just opens new threads, so it lets the user perform other tasks meanwhile on the calling thread. VERY IMPORTANT NOTE: if the GUI is selected and OpenCV is compiled with Qt support, this option will not work. Qt needs the main thread to plot visual results, so the final GUI (which uses OpenCV) would return an exception similar to: QMetaMethod::invoke: Unable to invoke methods with return values in queued connections
. Use exec() in that case.
template<typename TDatums , typename TWorker , typename TQueue >
bool op::Wrapper< TDatums, TWorker, TQueue >::waitAndEmplace |
( |
std::shared_ptr< TDatums > & |
tDatums | ) |
|
Emplace (move) an element on the first (input) queue. Similar to tryEmplace. However, if the input queue is full, it will wait until it can emplace it. If the Wrapper class is stopped before adding the element, it will return false and not emplace it.
- Parameters
-
tDatums | std::shared_ptr<TDatums> element to be emplaced. |
- Returns
- Boolean specifying whether the tDatums could be emplaced.
template<typename TDatums , typename TWorker , typename TQueue >
bool op::Wrapper< TDatums, TWorker, TQueue >::waitAndPop |
( |
std::shared_ptr< TDatums > & |
tDatums | ) |
|
Pop (retrieve) an element from the last (output) queue. Similar to tryPop. However, if the output queue is empty, it will wait until it can pop an element. If the Wrapper class is stopped before popping the element, it will return false and not retrieve it.
- Parameters
-
tDatums | std::shared_ptr<TDatums> element where the retrieved element will be placed. |
- Returns
- Boolean specifying whether the tDatums could be retrieved.