OpenPose
1.7.0
The first real-time multi-person system to jointly detect human body, hand, facial, and foot keypoints
|
#include <wrapper.hpp>
Public Member Functions | |
WrapperT (const ThreadManagerMode threadManagerMode=ThreadManagerMode::Synchronous) | |
virtual | ~WrapperT () |
void | disableMultiThreading () |
void | setWorker (const WorkerType workerType, const TWorker &worker, const bool workerOnNewThread=true) |
void | configure (const WrapperStructPose &wrapperStructPose) |
void | configure (const WrapperStructFace &wrapperStructFace) |
void | configure (const WrapperStructHand &wrapperStructHand) |
void | configure (const WrapperStructExtra &wrapperStructExtra) |
void | configure (const WrapperStructInput &wrapperStructInput) |
void | configure (const WrapperStructOutput &wrapperStructOutput) |
void | configure (const WrapperStructGui &wrapperStructGui) |
void | exec () |
void | start () |
void | stop () |
bool | isRunning () const |
void | setDefaultMaxSizeQueues (const long long defaultMaxSizeQueues=-1) |
bool | tryEmplace (TDatumsSP &tDatums) |
bool | waitAndEmplace (TDatumsSP &tDatums) |
bool | waitAndEmplace (Matrix &matrix) |
bool | tryPush (const TDatumsSP &tDatums) |
bool | waitAndPush (const TDatumsSP &tDatums) |
bool | waitAndPush (const Matrix &matrix) |
bool | tryPop (TDatumsSP &tDatums) |
bool | waitAndPop (TDatumsSP &tDatums) |
bool | emplaceAndPop (TDatumsSP &tDatums) |
TDatumsSP | emplaceAndPop (const Matrix &matrix) |
WrapperT: OpenPose all-in-one wrapper template class. Simplified into Wrapper for WrapperT<std::vector<Datum>> WrapperT 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:
Definition at line 36 of file wrapper.hpp.
|
explicit |
Constructor.
threadManagerMode | Thread synchronization mode. If set to ThreadManagerMode::Synchronous, everything will run inside the WrapperT. If ThreadManagerMode::Synchronous(In/Out), then input (frames producer) and/or output (GUI, writing results, etc.) will be controlled outside the WrapperT class by the user. See ThreadManagerMode for a detailed explanation of when to use each one. |
Definition at line 261 of file wrapper.hpp.
|
virtual |
Destructor. It automatically frees resources.
Definition at line 269 of file wrapper.hpp.
void op::WrapperT< TDatum, TDatums, TDatumsSP, TWorker >::configure | ( | const WrapperStructExtra & | wrapperStructExtra | ) |
Analogous to configure() but applied to the extra options (WrapperStructExtra)
Definition at line 359 of file wrapper.hpp.
void op::WrapperT< TDatum, TDatums, TDatumsSP, TWorker >::configure | ( | const WrapperStructFace & | wrapperStructFace | ) |
Analogous to configure(WrapperStructPose) but applied to face (WrapperStructFace)
Definition at line 333 of file wrapper.hpp.
void op::WrapperT< TDatum, TDatums, TDatumsSP, TWorker >::configure | ( | const WrapperStructGui & | wrapperStructGui | ) |
Analogous to configure() but applied to the GUI (WrapperStructGui)
Definition at line 398 of file wrapper.hpp.
void op::WrapperT< TDatum, TDatums, TDatumsSP, TWorker >::configure | ( | const WrapperStructHand & | wrapperStructHand | ) |
Analogous to configure() but applied to hand (WrapperStructHand)
Definition at line 346 of file wrapper.hpp.
void op::WrapperT< TDatum, TDatums, TDatumsSP, TWorker >::configure | ( | const WrapperStructInput & | wrapperStructInput | ) |
Analogous to configure() but applied to the input (WrapperStructInput)
Definition at line 372 of file wrapper.hpp.
void op::WrapperT< TDatum, TDatums, TDatumsSP, TWorker >::configure | ( | const WrapperStructOutput & | wrapperStructOutput | ) |
Analogous to configure() but applied to the output (WrapperStructOutput)
Definition at line 385 of file wrapper.hpp.
void op::WrapperT< TDatum, TDatums, TDatumsSP, TWorker >::configure | ( | const WrapperStructPose & | wrapperStructPose | ) |
It configures the pose parameters. Do not call for default values.
Definition at line 320 of file wrapper.hpp.
void op::WrapperT< TDatum, TDatums, TDatumsSP, TWorker >::disableMultiThreading |
Disable multi-threading. Useful for debugging and logging, all the Workers will run in the same thread. Note that workerOnNewThread (argument for setWorker function) will not make any effect.
Definition at line 287 of file wrapper.hpp.
TDatumsSP op::WrapperT< TDatum, TDatums, TDatumsSP, TWorker >::emplaceAndPop | ( | const Matrix & | matrix | ) |
Similar to emplaceAndPop(TDatumsSP& tDatums), but it takes a Matrix as input.
matrix | Matrix with the image to be processed. |
Definition at line 690 of file wrapper.hpp.
bool op::WrapperT< TDatum, TDatums, TDatumsSP, TWorker >::emplaceAndPop | ( | TDatumsSP & | tDatums | ) |
Runs both waitAndEmplace and waitAndPop.
tDatums | TDatumsSP element where the retrieved element will be placed. |
Definition at line 673 of file wrapper.hpp.
void op::WrapperT< TDatum, TDatums, TDatumsSP, TWorker >::exec |
bool op::WrapperT< TDatum, TDatums, TDatumsSP, TWorker >::isRunning |
void op::WrapperT< TDatum, TDatums, TDatumsSP, TWorker >::setDefaultMaxSizeQueues | ( | const long long | defaultMaxSizeQueues = -1 | ) |
It sets the maximum number of elements in the queue. For maximum speed, set to a very large number, but the trade-off would be:
defaultMaxSizeQueues | long long element with the maximum number of elements on the queue. |
Definition at line 474 of file wrapper.hpp.
void op::WrapperT< TDatum, TDatums, TDatumsSP, TWorker >::setWorker | ( | const WorkerType | workerType, |
const TWorker & | worker, | ||
const bool | workerOnNewThread = true |
||
) |
Add an user-defined extra Worker for a desired task (input, output, ...).
workerType | WorkerType to configure (e.g., Input, PreProcessing, PostProcessing, Output). |
worker | TWorker to be added. |
workerOnNewThread | Whether to add this TWorker on a new thread (if it is computationally demanding) or simply reuse existing threads (for light functions). Set to true if the performance time is unknown. |
Definition at line 300 of file wrapper.hpp.
void op::WrapperT< TDatum, TDatums, TDatumsSP, TWorker >::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.
Definition at line 429 of file wrapper.hpp.
void op::WrapperT< TDatum, TDatums, TDatumsSP, TWorker >::stop |
Function to stop multi-threading. It can be called internally or externally.
Definition at line 447 of file wrapper.hpp.
bool op::WrapperT< TDatum, TDatums, TDatumsSP, TWorker >::tryEmplace | ( | TDatumsSP & | tDatums | ) |
Emplace (move) an element on the first (input) queue. Only valid if ThreadManagerMode::Asynchronous or ThreadManagerMode::AsynchronousIn. If the input queue is full or the WrapperT was stopped, it will return false and not emplace it.
tDatums | TDatumsSP element to be emplaced. |
Definition at line 487 of file wrapper.hpp.
bool op::WrapperT< TDatum, TDatums, TDatumsSP, TWorker >::tryPop | ( | TDatumsSP & | tDatums | ) |
Pop (retrieve) an element from the last (output) queue. Only valid if ThreadManagerMode::Asynchronous or ThreadManagerMode::AsynchronousOut. If the output queue is empty or the WrapperT was stopped, it will return false and not retrieve it.
tDatums | TDatumsSP element where the retrieved element will be placed. |
Definition at line 639 of file wrapper.hpp.
bool op::WrapperT< TDatum, TDatums, TDatumsSP, TWorker >::tryPush | ( | const TDatumsSP & | tDatums | ) |
Push (copy) an element on the first (input) queue. Same as tryEmplace, but it copies the data instead of moving it.
tDatums | TDatumsSP element to be pushed. |
Definition at line 583 of file wrapper.hpp.
bool op::WrapperT< TDatum, TDatums, TDatumsSP, TWorker >::waitAndEmplace | ( | Matrix & | matrix | ) |
Similar to waitAndEmplace(const TDatumsSP& tDatums), but it takes a Matrix as input.
matrix | Matrix with the image to be processed. |
Definition at line 561 of file wrapper.hpp.
bool op::WrapperT< TDatum, TDatums, TDatumsSP, TWorker >::waitAndEmplace | ( | TDatumsSP & | 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 WrapperT class is stopped before adding the element, it will return false and not emplace it.
tDatums | TDatumsSP element to be emplaced. |
Definition at line 523 of file wrapper.hpp.
bool op::WrapperT< TDatum, TDatums, TDatumsSP, TWorker >::waitAndPop | ( | TDatumsSP & | 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 WrapperT class is stopped before popping the element, it will return false and not retrieve it.
tDatums | TDatumsSP element where the retrieved element will be placed. |
Definition at line 656 of file wrapper.hpp.
bool op::WrapperT< TDatum, TDatums, TDatumsSP, TWorker >::waitAndPush | ( | const Matrix & | matrix | ) |
Similar to waitAndPush(const TDatumsSP& tDatums), but it takes a Matrix as input.
matrix | Matrix with the image to be processed. |
Definition at line 617 of file wrapper.hpp.
bool op::WrapperT< TDatum, TDatums, TDatumsSP, TWorker >::waitAndPush | ( | const TDatumsSP & | tDatums | ) |
Push (copy) an element on the first (input) queue. Same as waitAndEmplace, but it copies the data instead of moving it.
tDatums | TDatumsSP element to be pushed. |
Definition at line 600 of file wrapper.hpp.