提交 25a05f5e 编写于 作者: G gineshidalgo99

Wrapper into WrapperT with Wrapper class

上级 fd566ce9
......@@ -101,9 +101,9 @@ Otherwise, check [doc/installation.md](doc/installation.md) for instructions on
## Quick Start
Most users do not need the [OpenPose C++ API](#openpose-c-api), but they can simply use the basic [Demo](#demo) and/or [OpenPose Wrapper](#openpose-wrapper).
Most users do not need the OpenPose C++/Python API, but can simply use the OpenPose Demo:
- **Demo**: To easily process images/video/webcam and display/save the results. See [doc/demo_overview.md](doc/demo_overview.md). E.g. run OpenPose in a video with:
- **OpenPose Demo**: To easily process images/video/webcam and display/save the results. See [doc/demo_overview.md](doc/demo_overview.md). E.g. run OpenPose in a video with:
```
# Ubuntu
./build/examples/openpose/openpose.bin --video examples/media/video.avi
......@@ -123,8 +123,6 @@ bin\OpenPoseDemo.exe --video examples\media\video.avi
- **Face** keypoint detection **without body** keypoint detection: If you want to speed it up (but also reduce amount of detected faces), check the OpenCV-face-detector approach in [doc/standalone_face_or_hand_keypoint_detector.md](doc/standalone_face_or_hand_keypoint_detector.md).
- **Use your own face/hand detector**: You can use the hand and/or face keypoint detectors with your own face or hand detectors, rather than using the body detector. E.g. useful for camera views at which the hands are visible but not the body (OpenPose detector would fail). See [doc/standalone_face_or_hand_keypoint_detector.md](doc/standalone_face_or_hand_keypoint_detector.md).
- **Library dependencies**: OpenPose uses default Caffe and OpenCV, as well as any Caffe dependency. The demos additionally use GFlags. It could easily be ported to other deep learning frameworks (Tensorflow, Torch, ...). Feel free to make a pull request if you implement any of those!
## Output
......
......@@ -4,7 +4,7 @@ OpenPose - Installation
## Contents
1. [Windows Portable Demo](#windows-portable-demo)
2. [Operating Systems](#operating-systems)
3. [Requirements](#requirements)
3. [Requirements and Dependencies](#requirements-and-dependencies)
4. [Clone OpenPose](#clone-openpose)
5. [Update OpenPose](#update-openpose)
6. [Installation](#installation)
......@@ -45,19 +45,23 @@ This installation section is only intended if you plan to modify the OpenPose co
## Requirements
Requirements for the default configuration (you might need more resources with a greater `--net_resolution` and/or `scale_number` or less resources by reducing the net resolution and/or using the MPI and MPI_4 models):
## Requirements and Dependencies
- **Requirements** for the default configuration (you might need more resources with a greater `--net_resolution` and/or `scale_number` or less resources by reducing the net resolution and/or using the MPI and MPI_4 models):
- Nvidia GPU version:
- NVIDIA graphics card with at least 1.6 GB available (the `nvidia-smi` command checks the available GPU memory in Ubuntu).
- At least 2.5 GB of free RAM memory for BODY_25 model or 2 GB for COCO model (assuming cuDNN installed).
- Highly recommended: cuDNN.
- AMD GPU version:
- Vega series graphics card
- At least 2 GB of free RAM memory.
- CPU version:
- Around 8GB of free RAM memory.
- Highly recommended: a CPU with at least 8 cores.
- **Dependencies**:
- OpenCV (all 2.X and 3.X versions are compatible).
- Caffe and all its dependencies. Interesting in porting OpenPose to other DL frameworks (Tensorflow, Caffe2, Pytorch, ...)?. Email us (gines@cmu.edu) if you are interesting in joining the OpenPose team to do so or feel free to make a pull request if you implement any of those!
- The demo and tutorials additionally use GFlags.
- Nvidia GPU version:
- NVIDIA graphics card with at least 1.6 GB available (the `nvidia-smi` command checks the available GPU memory in Ubuntu).
- At least 2.5 GB of free RAM memory for BODY_25 model or 2 GB for COCO model (assuming cuDNN installed).
- Highly recommended: cuDNN.
- AMD GPU version:
- Vega series graphics card
- At least 2 GB of free RAM memory.
- CPU version:
- Around 8GB of free RAM memory.
- Highly recommended: a CPU with at least 8 cores.
......@@ -348,7 +352,7 @@ After installation, check the [doc/modules/3d_reconstruction_module.md](./module
#### Calibration Module
The calibration module is included by default, but you must also enable `WITH_EIGEN` if you intend to use the extrinsic camera parameter estimation tool. You can set that flag to 2 different values: `APT_GET` or `BUILD`, check [Requirements](#requirements) for more information.
The calibration module is included by default, but you must also enable `WITH_EIGEN` if you intend to use the extrinsic camera parameter estimation tool. You can set that flag to 2 different values: `APT_GET` or `BUILD`, check [Requirements and Dependencies](#requirements-and-dependencies) for more information.
After installation, check the [doc/modules/calibration_module.md](./modules/calibration_module.md) instructions.
......
......@@ -3,13 +3,15 @@ OpenPose - Installation on Nvidia Jetson TX2
Note that OpenPose for Nvidia Jetson TX2 was developed and it is maintained by the community. The OpenPose authors will not be able to provide official support for it.
## Contents
1. [Requirements](#requirements)
1. [Requirements and Dependencies](#requirements-and-dependencies)
2. [Installation](#installation)
3. [Usage](#usage)
## Requirements
## Requirements and Dependencies
Jetson TX2 just flashed with [JetPack 3.1](https://developer.nvidia.com/embedded/jetpack)
Notes:
......@@ -18,6 +20,13 @@ Notes:
- If you are installing from a virtual machine host, installation may need to be done in two steps, please refer to [this solution](https://devtalk.nvidia.com/default/topic/1002081/jetson-tx2/jetpack-3-0-install-with-a-vm/).
- Be sure to complete both OS flashing and CUDA / cuDNN installation parts before installation.
**Dependencies**:
- OpenCV (all 2.X and 3.X versions are compatible).
- Caffe and all its dependencies.
- The demo and tutorials additionally use GFlags.
## Installation
Use the following script for installation of both caffe and OpenPose:
......
......@@ -5,12 +5,12 @@ OpenPose Library - Steps to Add a New Module
In order to add a new module, these are the recommended steps in order to develop it:
1. Create a folder with its name in the `experimental/` module, e.g. `experimental/hair/`.
2. Implement all the functionality in one `Worker` (i.e. inherit from `Worker` and implement all the functionality on that class).
2. Implement all the functionality in one `Worker`. I.e., inherit from `Worker` and implement all the functionality on that class (copy the examples from any Worker subclass).
1. The first letter of the class name should be `W` (e.g. `WHairExtractor`).
2. To initially simplify development:
1. Initialize the Worker class with the specific std::shared_ptr<std::vector<op::Datum>> instead of directly using a template class (following the `examples/tutorial_api_cpp` synchronous examples).
2. Use the whole op::Datum as unique argument of your auxiliary functions.
3. Use the OpenPose Wrapper in ThreadManagerMode::SingleThread mode (e.g. it allows you to directly use cv::imshow).
1. Optionally (higher debug info), you might initially create the Worker as a non-templated class, assuming it uses std::shared_ptr<std::vector<op::Datum>> instead of directly using a template class (following the `examples/tutorial_api_cpp` synchronous examples). While developing, templates provide more confusing debugging info. Turn the class into a template after being initially developed.
2. Optionally (for development speed), use op::Datum as unique argument of your auxiliary functions within that worker.
3. Use the OpenPose Wrapper class in ThreadManagerMode::SingleThread mode (e.g., it allows you to directly use cv::imshow).
4. If you are using your own custom Caffe -> initially change the Caffe for your version. It should directly work.
3. Copy the design from `pose/WPoseExtractor`.
3. To test it:
......@@ -23,10 +23,10 @@ In order to add a new module, these are the recommended steps in order to develo
## Release Steps
In order to release the new module:
After the code is running and ready to be merged, in order to officially release the new module:
1. Move the functionality of each `Worker` class to the non-template class (e.g. `WHairExtractor` to `HairExtractor`). `WHairExtractor` will simply wrap `HairExtractor`. This will reduce compiling time for the user. See examples from other modules.
2. If you are using a custom Caffe version, move the custom code into the OpenPose library and change back Caffe to the default (most updated) version.
3. Move the module from `experimental/hair/` to `hair/`.
4. Remove `experimental` namespaces (from `Wrapper` and `hair`) and turn Workers into template classes.
5. Add a demo in `examples/openpose/` and tutorial examples in `examples/tutorial_`.
4. Remove `experimental` namespaces (e.g., from `Wrapper` and `Hair`) and turn Workers into template classes.
5. Integrate the new flags to the OpenPose Demo in `examples/openpose/` and optionally add some tutorial examples in `examples/tutorial_api_cpp`.
......@@ -265,7 +265,7 @@ OpenPose Library - Release Notes
2. Greedy body part connector implemented in CUDA: +~30% speed up in Nvidia (CUDA) version with default flags and +~10% in maximum accuracy configuration. In addition, it provides a small 0.5% boost in accuracy (default flags).
3. OpenPose can be built as Unity plugin: Added flag `BUILD_UNITY_SUPPORT` and special Unity code.
4. If camera is unplugged, OpenPose GUI and command line will display a warning and try to reconnect it.
5. Wrapper classes simplified and renamed.
5. Wrapper classes simplified and renamed. Wrapper renamed as WrapperT, and created Wrapper as the non-templated class equivalent.
6. API and examples improved:
1. New header file `flags.hpp` that includes all OpenPose flags, removing the need to copy them repeatedly on each OpenPose example file.
2. `tutorial_wrapper` renamed as `tutorial_api_cpp` as well as new examples were added.
......
......@@ -74,7 +74,7 @@ int openPoseDemo()
// OpenPose wrapper
op::log("Configuring OpenPose wrapper...", op::Priority::Low, __LINE__, __FUNCTION__, __FILE__);
op::Wrapper<std::vector<op::Datum>> opWrapper;
op::Wrapper opWrapper;
// Pose configuration (use WrapperStructPose{} for default and recommended configuration)
const op::WrapperStructPose wrapperStructPose{
!FLAGS_body_disable, netInputSize, outputSize, keypointScale, FLAGS_num_gpu, FLAGS_num_gpu_start,
......
......@@ -78,7 +78,7 @@ int openPoseTutorialWrapper4()
// OpenPose wrapper
op::log("Configuring OpenPose wrapper...", op::Priority::Low, __LINE__, __FUNCTION__, __FILE__);
op::Wrapper<std::vector<op::UserDatum>> opWrapper;
op::WrapperT<std::vector<op::UserDatum>> opWrapper;
// Pose configuration (use WrapperStructPose{} for default and recommended configuration)
const op::WrapperStructPose wrapperStructPose{
!FLAGS_body_disable, netInputSize, outputSize, keypointScale, FLAGS_num_gpu, FLAGS_num_gpu_start,
......
// ------------------------- OpenPose API Tutorial - Example 1 - Body from image -------------------------
// ----------------------------- OpenPose C++ API Tutorial - Example 1 - Body from image -----------------------------
// It reads an image, process it, and displays it with the pose keypoints.
// Command-line user intraface
......@@ -69,7 +69,7 @@ int bodyFromImage()
// Configuring OpenPose
op::log("Configuring OpenPose...", op::Priority::High);
op::Wrapper<std::vector<op::Datum>> opWrapper{op::ThreadManagerMode::Asynchronous};
op::Wrapper opWrapper{op::ThreadManagerMode::Asynchronous};
// Set to single-thread (for sequential processing and/or debugging and/or reducing latency)
if (FLAGS_disable_multi_thread)
opWrapper.disableMultiThreading();
......
// ------------------------- OpenPose API Tutorial - Example 2 - Whole body from image -------------------------
// -------------------------- OpenPose C++ API Tutorial - Example 2 - Whole body from image --------------------------
// It reads an image, process it, and displays it with the pose, hand, and face keypoints.
// Command-line user intraface
......@@ -48,7 +48,7 @@ int wholeBodyFromImage()
// Configuring OpenPose
op::log("Configuring OpenPose...", op::Priority::High);
op::Wrapper<std::vector<op::Datum>> opWrapper{op::ThreadManagerMode::Asynchronous};
op::Wrapper opWrapper{op::ThreadManagerMode::Asynchronous};
// Add hand and face
opWrapper.configure(op::WrapperStructFace{true});
opWrapper.configure(op::WrapperStructHand{true});
......
// ------------------------- OpenPose API Tutorial - Example 3 - Body from image configurable -------------------------
// ----------------------- OpenPose C++ API Tutorial - Example 3 - Body from image configurable -----------------------
// It reads an image, process it, and displays it with the pose (and optionally hand and face) keypoints. In addition,
// it includes all the OpenPose configuration flags (enable/disable hand, face, output saving, etc.).
......@@ -84,7 +84,7 @@ int wholeBodyFromImage()
// Configuring OpenPose
op::log("Configuring OpenPose...", op::Priority::High);
op::Wrapper<std::vector<op::Datum>> opWrapper{op::ThreadManagerMode::Asynchronous};
op::Wrapper opWrapper{op::ThreadManagerMode::Asynchronous};
// Pose configuration (use WrapperStructPose{} for default and recommended configuration)
const op::WrapperStructPose wrapperStructPose{
!FLAGS_body_disable, netInputSize, outputSize, keypointScale, FLAGS_num_gpu, FLAGS_num_gpu_start,
......
// ------------------------- OpenPose Library Tutorial - Wrapper - Example 1 - Asynchronous -------------------------
// ------------------------- OpenPose C++ API Tutorial - Example 4 - Custom Input and Output -------------------------
// Asynchronous mode: ideal for fast prototyping when performance is not an issue. The user emplaces/pushes and pops frames from the OpenPose wrapper
// when he desires to.
......@@ -27,9 +27,9 @@
DEFINE_string(image_dir, "examples/media/",
"Process a directory of images. Read all standard formats (jpg, png, bmp, etc.).");
// If the user needs his own variables, he can inherit the op::Datum struct and add them
// UserDatum can be directly used by the OpenPose wrapper because it inherits from op::Datum, just define Wrapper<UserDatum> instead of
// Wrapper<op::Datum>
// If the user needs his own variables, he can inherit the op::Datum struct and add them in there.
// UserDatum can be directly used by the OpenPose wrapper because it inherits from op::Datum, just define
// WrapperT<std::vector<UserDatum>> instead of Wrapper (or equivalently WrapperT<std::vector<UserDatum>>)
struct UserDatum : public op::Datum
{
bool boolThatUserNeedsForSomeReason;
......@@ -176,7 +176,7 @@ public:
}
};
int openPoseTutorialWrapper3()
int example4()
{
try
{
......@@ -219,7 +219,7 @@ int openPoseTutorialWrapper3()
// Configure OpenPose
op::log("Configuring OpenPose wrapper...", op::Priority::Low, __LINE__, __FUNCTION__, __FILE__);
op::Wrapper<std::vector<UserDatum>> opWrapper{op::ThreadManagerMode::Asynchronous};
op::WrapperT<std::vector<UserDatum>> opWrapperT{op::ThreadManagerMode::Asynchronous};
// Pose configuration (use WrapperStructPose{} for default and recommended configuration)
const op::WrapperStructPose wrapperStructPose{
!FLAGS_body_disable, netInputSize, outputSize, keypointScale, FLAGS_num_gpu, FLAGS_num_gpu_start,
......@@ -250,14 +250,14 @@ int openPoseTutorialWrapper3()
FLAGS_camera_fps, FLAGS_write_heatmaps, FLAGS_write_heatmaps_format, FLAGS_write_video_adam,
FLAGS_write_bvh, FLAGS_udp_host, FLAGS_udp_port};
// Configure wrapper
opWrapper.configure(wrapperStructPose, wrapperStructFace, wrapperStructHand, wrapperStructExtra,
opWrapperT.configure(wrapperStructPose, wrapperStructFace, wrapperStructHand, wrapperStructExtra,
op::WrapperStructInput{}, wrapperStructOutput);
// Set to single-thread (for sequential processing and/or debugging and/or reducing latency)
if (FLAGS_disable_multi_thread)
opWrapper.disableMultiThreading();
opWrapperT.disableMultiThreading();
op::log("Starting thread(s)...", op::Priority::High);
opWrapper.start();
opWrapperT.start();
// User processing
UserInputClass userInputClass(FLAGS_image_dir);
......@@ -269,10 +269,10 @@ int openPoseTutorialWrapper3()
auto datumToProcess = userInputClass.createDatum();
if (datumToProcess != nullptr)
{
auto successfullyEmplaced = opWrapper.waitAndEmplace(datumToProcess);
auto successfullyEmplaced = opWrapperT.waitAndEmplace(datumToProcess);
// Pop frame
std::shared_ptr<std::vector<UserDatum>> datumProcessed;
if (successfullyEmplaced && opWrapper.waitAndPop(datumProcessed))
if (successfullyEmplaced && opWrapperT.waitAndPop(datumProcessed))
{
userWantsToExit = userOutputClass.display(datumProcessed);
userOutputClass.printKeypoints(datumProcessed);
......@@ -284,7 +284,7 @@ int openPoseTutorialWrapper3()
}
op::log("Stopping thread(s)", op::Priority::High);
opWrapper.stop();
opWrapperT.stop();
// Measuring total time
const auto now = std::chrono::high_resolution_clock::now();
......@@ -309,6 +309,6 @@ int main(int argc, char *argv[])
// Parsing command line flags
gflags::ParseCommandLineFlags(&argc, &argv, true);
// Running openPoseTutorialWrapper3
return openPoseTutorialWrapper3();
// Running example4
return example4();
}
// ------------------------- OpenPose Library Tutorial - Wrapper - Example 3 - Asynchronous Output -------------------------
// Asynchronous output mode: ideal for fast prototyping when performance is not an issue and user wants to use the output OpenPose format. The user
// simply gets the processed frames from the OpenPose wrapper when he desires to.
// ------------------------- OpenPose C++ API Tutorial - Example 5 - XXXXXXXXXXXXX -------------------------
// Asynchronous output mode: ideal for fast prototyping when performance is not an issue and user wants to use the
// output OpenPose format. The user simply gets the processed frames from the OpenPose wrapper when he desires to.
// This example shows the user how to use the OpenPose wrapper class:
// 1. Read folder of images / video / webcam
......@@ -21,9 +21,9 @@
// OpenPose dependencies
#include <openpose/headers.hpp>
// If the user needs his own variables, he can inherit the op::Datum struct and add them
// If the user needs his own variables, he can inherit the op::Datum struct and add them in there.
// UserDatum can be directly used by the OpenPose wrapper because it inherits from op::Datum, just define
// Wrapper<UserDatum> instead of Wrapper<op::Datum>
// WrapperT<std::vector<UserDatum>> instead of Wrapper (or equivalently WrapperT<std::vector<UserDatum>>)
struct UserDatum : public op::Datum
{
bool boolThatUserNeedsForSomeReason;
......@@ -160,7 +160,7 @@ int openPoseTutorialWrapper1()
// Configure OpenPose
op::log("Configuring OpenPose wrapper...", op::Priority::Low, __LINE__, __FUNCTION__, __FILE__);
op::Wrapper<std::vector<UserDatum>> opWrapper{op::ThreadManagerMode::AsynchronousOut};
op::WrapperT<std::vector<UserDatum>> opWrapperT{op::ThreadManagerMode::AsynchronousOut};
// Pose configuration (use WrapperStructPose{} for default and recommended configuration)
const op::WrapperStructPose wrapperStructPose{
!FLAGS_body_disable, netInputSize, outputSize, keypointScale, FLAGS_num_gpu, FLAGS_num_gpu_start,
......@@ -195,14 +195,14 @@ int openPoseTutorialWrapper1()
FLAGS_camera_fps, FLAGS_write_heatmaps, FLAGS_write_heatmaps_format, FLAGS_write_video_adam,
FLAGS_write_bvh, FLAGS_udp_host, FLAGS_udp_port};
// Configure wrapper
opWrapper.configure(wrapperStructPose, wrapperStructFace, wrapperStructHand, wrapperStructExtra,
opWrapperT.configure(wrapperStructPose, wrapperStructFace, wrapperStructHand, wrapperStructExtra,
wrapperStructInput, wrapperStructOutput);
// Set to single-thread (for sequential processing and/or debugging and/or reducing latency)
if (FLAGS_disable_multi_thread)
opWrapper.disableMultiThreading();
opWrapperT.disableMultiThreading();
op::log("Starting thread(s)...", op::Priority::High);
opWrapper.start();
opWrapperT.start();
// User processing
UserOutputClass userOutputClass;
......@@ -211,7 +211,7 @@ int openPoseTutorialWrapper1()
{
// Pop frame
std::shared_ptr<std::vector<UserDatum>> datumProcessed;
if (opWrapper.waitAndPop(datumProcessed))
if (opWrapperT.waitAndPop(datumProcessed))
{
userWantsToExit = userOutputClass.display(datumProcessed);;
userOutputClass.printKeypoints(datumProcessed);
......@@ -221,7 +221,7 @@ int openPoseTutorialWrapper1()
}
op::log("Stopping thread(s)", op::Priority::High);
opWrapper.stop();
opWrapperT.stop();
// Measuring total time
const auto now = std::chrono::high_resolution_clock::now();
......
// ------------------------- OpenPose Library Tutorial - Real Time Pose Estimation -------------------------
// ------------------------- OpenPose C++ API Tutorial - Example 6 - XXXXXXXXXXXXX -------------------------
// If the user wants to learn to use the OpenPose library, we highly recommend to start with the
// examples in `examples/tutorial_api_cpp/`.
// This example summarizes all the functionality of the OpenPose library:
......@@ -21,9 +21,9 @@
// OpenPose dependencies
#include <openpose/headers.hpp>
// If the user needs his own variables, he can inherit the op::Datum struct and add them
// If the user needs his own variables, he can inherit the op::Datum struct and add them in there.
// UserDatum can be directly used by the OpenPose wrapper because it inherits from op::Datum, just define
// Wrapper<UserDatum> instead of Wrapper<op::Datum>
// WrapperT<std::vector<UserDatum>> instead of Wrapper (or equivalently WrapperT<std::vector<UserDatum>>)
struct UserDatum : public op::Datum
{
bool boolThatUserNeedsForSomeReason;
......@@ -120,8 +120,7 @@ int openPoseDemo()
// OpenPose wrapper
op::log("Configuring OpenPose wrapper...", op::Priority::Low, __LINE__, __FUNCTION__, __FILE__);
// op::Wrapper<std::vector<op::Datum>> opWrapper;
op::Wrapper<std::vector<UserDatum>> opWrapper;
op::WrapperT<std::vector<UserDatum>> opWrapper;
// Initializing the user custom classes
// Processing
......
// ------------------------- OpenPose Library Tutorial - Real Time Pose Estimation -------------------------
// ------------------------- OpenPose C++ API Tutorial - Example 7 - XXXXXXXXXXXXX -------------------------
// If the user wants to learn to use the OpenPose library, we highly recommend to start with the
// examples in `examples/tutorial_api_cpp/`.
// This example summarizes all the functionality of the OpenPose library:
......@@ -27,9 +27,9 @@
DEFINE_string(image_dir, "examples/media/",
"Process a directory of images. Read all standard formats (jpg, png, bmp, etc.).");
// If the user needs his own variables, he can inherit the op::Datum struct and add them
// If the user needs his own variables, he can inherit the op::Datum struct and add them in there.
// UserDatum can be directly used by the OpenPose wrapper because it inherits from op::Datum, just define
// Wrapper<UserDatum> instead of Wrapper<op::Datum>
// WrapperT<std::vector<UserDatum>> instead of Wrapper (or equivalently WrapperT<std::vector<UserDatum>>)
struct UserDatum : public op::Datum
{
bool boolThatUserNeedsForSomeReason;
......@@ -162,15 +162,14 @@ int openPoseDemo()
// OpenPose wrapper
op::log("Configuring OpenPose wrapper...", op::Priority::Low, __LINE__, __FUNCTION__, __FILE__);
// op::Wrapper<std::vector<op::Datum>> opWrapper;
op::Wrapper<std::vector<UserDatum>> opWrapper;
op::WrapperT<std::vector<UserDatum>> opWrapperT;
// Initializing the user custom classes
// Frames producer (e.g. video, webcam, ...)
auto wUserInput = std::make_shared<WUserInput>(FLAGS_image_dir);
// Add custom processing
const auto workerInputOnNewThread = true;
opWrapper.setWorker(op::WorkerType::Input, wUserInput, workerInputOnNewThread);
opWrapperT.setWorker(op::WorkerType::Input, wUserInput, workerInputOnNewThread);
// Pose configuration (use WrapperStructPose{} for default and recommended configuration)
const op::WrapperStructPose wrapperStructPose{
......@@ -205,17 +204,17 @@ int openPoseDemo()
FLAGS_write_video_adam, FLAGS_write_bvh, FLAGS_udp_host, FLAGS_udp_port};
// Configure wrapper
opWrapper.configure(wrapperStructPose, wrapperStructFace, wrapperStructHand, wrapperStructExtra,
opWrapperT.configure(wrapperStructPose, wrapperStructFace, wrapperStructHand, wrapperStructExtra,
wrapperStructInput, wrapperStructOutput);
// Set to single-thread (for sequential processing and/or debugging and/or reducing latency)
if (FLAGS_disable_multi_thread)
opWrapper.disableMultiThreading();
opWrapperT.disableMultiThreading();
// Start processing
// Two different ways of running the program on multithread environment
op::log("Starting thread(s)...", op::Priority::High);
// Start, run & stop threads - it blocks this thread until all others have finished
opWrapper.exec();
opWrapperT.exec();
// // Option b) Keeping this thread free in case you want to do something else meanwhile, e.g. profiling the GPU
// memory
......@@ -223,20 +222,20 @@ int openPoseDemo()
// // 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`
// // Start threads
// opWrapper.start();
// opWrapperT.start();
// // Profile used GPU memory
// // 1: wait ~10sec so the memory has been totally loaded on GPU
// // 2: profile the GPU memory
// const auto sleepTimeMs = 10;
// for (auto i = 0 ; i < 10000/sleepTimeMs && opWrapper.isRunning() ; i++)
// for (auto i = 0 ; i < 10000/sleepTimeMs && opWrapperT.isRunning() ; i++)
// std::this_thread::sleep_for(std::chrono::milliseconds{sleepTimeMs});
// op::Profiler::profileGpuMemory(__LINE__, __FUNCTION__, __FILE__);
// // Keep program alive while running threads
// while (opWrapper.isRunning())
// while (opWrapperT.isRunning())
// std::this_thread::sleep_for(std::chrono::milliseconds{sleepTimeMs});
// // Stop and join threads
// op::log("Stopping thread(s)", op::Priority::High);
// opWrapper.stop();
// opWrapperT.stop();
// Measuring total time
const auto now = std::chrono::high_resolution_clock::now();
......
// ------------------------- OpenPose Library Tutorial - Real Time Pose Estimation -------------------------
// ------------------------- OpenPose C++ API Tutorial - Example 8 - XXXXXXXXXXXXX -------------------------
// If the user wants to learn to use the OpenPose library, we highly recommend to start with the
// examples in `examples/tutorial_api_cpp/`.
// This example summarizes all the functionality of the OpenPose library:
......@@ -21,9 +21,9 @@
// OpenPose dependencies
#include <openpose/headers.hpp>
// If the user needs his own variables, he can inherit the op::Datum struct and add them
// If the user needs his own variables, he can inherit the op::Datum struct and add them in there.
// UserDatum can be directly used by the OpenPose wrapper because it inherits from op::Datum, just define
// Wrapper<UserDatum> instead of Wrapper<op::Datum>
// WrapperT<std::vector<UserDatum>> instead of Wrapper (or equivalently WrapperT<std::vector<UserDatum>>)
struct UserDatum : public op::Datum
{
bool boolThatUserNeedsForSomeReason;
......@@ -167,15 +167,14 @@ int openPoseDemo()
// OpenPose wrapper
op::log("Configuring OpenPose wrapper...", op::Priority::Low, __LINE__, __FUNCTION__, __FILE__);
// op::Wrapper<std::vector<op::Datum>> opWrapper;
op::Wrapper<std::vector<UserDatum>> opWrapper;
op::WrapperT<std::vector<UserDatum>> opWrapperT;
// Initializing the user custom classes
// GUI (Display)
auto wUserOutput = std::make_shared<WUserOutput>();
// Add custom processing
const auto workerOutputOnNewThread = true;
opWrapper.setWorker(op::WorkerType::Output, wUserOutput, workerOutputOnNewThread);
opWrapperT.setWorker(op::WorkerType::Output, wUserOutput, workerOutputOnNewThread);
// Pose configuration (use WrapperStructPose{} for default and recommended configuration)
const op::WrapperStructPose wrapperStructPose{
......@@ -213,17 +212,17 @@ int openPoseDemo()
FLAGS_camera_fps, FLAGS_write_heatmaps, FLAGS_write_heatmaps_format, FLAGS_write_video_adam,
FLAGS_write_bvh, FLAGS_udp_host, FLAGS_udp_port};
// Configure wrapper
opWrapper.configure(wrapperStructPose, wrapperStructFace, wrapperStructHand, wrapperStructExtra,
opWrapperT.configure(wrapperStructPose, wrapperStructFace, wrapperStructHand, wrapperStructExtra,
wrapperStructInput, wrapperStructOutput);
// Set to single-thread (for sequential processing and/or debugging and/or reducing latency)
if (FLAGS_disable_multi_thread)
opWrapper.disableMultiThreading();
opWrapperT.disableMultiThreading();
// Start processing
// Two different ways of running the program on multithread environment
op::log("Starting thread(s)...", op::Priority::High);
// Start, run & stop threads - it blocks this thread until all others have finished
opWrapper.exec();
opWrapperT.exec();
// // Option b) Keeping this thread free in case you want to do something else meanwhile, e.g. profiling the GPU
// memory
......@@ -231,20 +230,20 @@ int openPoseDemo()
// // 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`
// // Start threads
// opWrapper.start();
// opWrapperT.start();
// // Profile used GPU memory
// // 1: wait ~10sec so the memory has been totally loaded on GPU
// // 2: profile the GPU memory
// const auto sleepTimeMs = 10;
// for (auto i = 0 ; i < 10000/sleepTimeMs && opWrapper.isRunning() ; i++)
// for (auto i = 0 ; i < 10000/sleepTimeMs && opWrapperT.isRunning() ; i++)
// std::this_thread::sleep_for(std::chrono::milliseconds{sleepTimeMs});
// op::Profiler::profileGpuMemory(__LINE__, __FUNCTION__, __FILE__);
// // Keep program alive while running threads
// while (opWrapper.isRunning())
// while (opWrapperT.isRunning())
// std::this_thread::sleep_for(std::chrono::milliseconds{sleepTimeMs});
// // Stop and join threads
// op::log("Stopping thread(s)", op::Priority::High);
// opWrapper.stop();
// opWrapperT.stop();
// Measuring total time
const auto now = std::chrono::high_resolution_clock::now();
......
// ------------------------- OpenPose Library Tutorial - Wrapper - Example 2 - Synchronous -------------------------
// ------------------------- OpenPose C++ API Tutorial - Example 9 - XXXXXXXXXXXXX -------------------------
// Synchronous mode: ideal for performance. The user can add his own frames producer / post-processor / consumer to the OpenPose wrapper or use the
// default ones.
......@@ -27,9 +27,9 @@
DEFINE_string(image_dir, "examples/media/",
"Process a directory of images. Read all standard formats (jpg, png, bmp, etc.).");
// If the user needs his own variables, he can inherit the op::Datum struct and add them
// If the user needs his own variables, he can inherit the op::Datum struct and add them in there.
// UserDatum can be directly used by the OpenPose wrapper because it inherits from op::Datum, just define
// Wrapper<UserDatum> instead of Wrapper<op::Datum>
// WrapperT<std::vector<UserDatum>> instead of Wrapper (or equivalently WrapperT<std::vector<UserDatum>>)
struct UserDatum : public op::Datum
{
bool boolThatUserNeedsForSomeReason;
......@@ -264,16 +264,16 @@ int openPoseTutorialWrapper2()
// GUI (Display)
auto wUserOutput = std::make_shared<WUserOutput>();
op::Wrapper<std::vector<UserDatum>> opWrapper;
op::WrapperT<std::vector<UserDatum>> opWrapperT;
// Add custom input
const auto workerInputOnNewThread = false;
opWrapper.setWorker(op::WorkerType::Input, wUserInput, workerInputOnNewThread);
opWrapperT.setWorker(op::WorkerType::Input, wUserInput, workerInputOnNewThread);
// Add custom processing
const auto workerProcessingOnNewThread = false;
opWrapper.setWorker(op::WorkerType::PostProcessing, wUserPostProcessing, workerProcessingOnNewThread);
opWrapperT.setWorker(op::WorkerType::PostProcessing, wUserPostProcessing, workerProcessingOnNewThread);
// Add custom output
const auto workerOutputOnNewThread = true;
opWrapper.setWorker(op::WorkerType::Output, wUserOutput, workerOutputOnNewThread);
opWrapperT.setWorker(op::WorkerType::Output, wUserOutput, workerOutputOnNewThread);
// Configure OpenPose
op::log("Configuring OpenPose wrapper...", op::Priority::Low, __LINE__, __FUNCTION__, __FILE__);
const op::WrapperStructPose wrapperStructPose{
......@@ -305,34 +305,34 @@ int openPoseTutorialWrapper2()
FLAGS_camera_fps, FLAGS_write_heatmaps, FLAGS_write_heatmaps_format, FLAGS_write_video_adam,
FLAGS_write_bvh, FLAGS_udp_host, FLAGS_udp_port};
// Configure wrapper
opWrapper.configure(wrapperStructPose, wrapperStructFace, wrapperStructHand, wrapperStructExtra,
opWrapperT.configure(wrapperStructPose, wrapperStructFace, wrapperStructHand, wrapperStructExtra,
op::WrapperStructInput{}, wrapperStructOutput);
// Set to single-thread (for sequential processing and/or debugging and/or reducing latency)
if (FLAGS_disable_multi_thread)
opWrapper.disableMultiThreading();
opWrapperT.disableMultiThreading();
op::log("Starting thread(s)...", op::Priority::High);
// Two different ways of running the program on multithread environment
// Start, run & stop threads - it blocks this thread until all others have finished
opWrapper.exec();
opWrapperT.exec();
// Option b) Keeping this thread free in case you want to do something else meanwhile, e.g. profiling the GPU memory
// // VERY IMPORTANT NOTE: if 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`
// // Start threads
// opWrapper.start();
// opWrapperT.start();
// // Profile used GPU memory
// // 1: wait ~10sec so the memory has been totally loaded on GPU
// // 2: profile the GPU memory
// std::this_thread::sleep_for(std::chrono::milliseconds{1000});
// op::log("Random task here...", op::Priority::High);
// // Keep program alive while running threads
// while (opWrapper.isRunning())
// while (opWrapperT.isRunning())
// std::this_thread::sleep_for(std::chrono::milliseconds{33});
// // Stop and join threads
// op::log("Stopping thread(s)", op::Priority::High);
// opWrapper.stop();
// opWrapperT.stop();
// Measuring total time
const auto now = std::chrono::high_resolution_clock::now();
......
......@@ -40,9 +40,9 @@ DEFINE_string(image_dir, "examples/media/", "Process a direc
DEFINE_bool(fullscreen, false, "Run in full-screen mode (press f during runtime to toggle).");
// If the user needs his own variables, he can inherit the op::Datum struct and add them
// If the user needs his own variables, he can inherit the op::Datum struct and add them in there.
// UserDatum can be directly used by the OpenPose wrapper because it inherits from op::Datum, just define
// Wrapper<UserDatum> instead of Wrapper<op::Datum>
// WrapperT<std::vector<UserDatum>> instead of Wrapper (or equivalently WrapperT<std::vector<UserDatum>>)
struct UserDatum : public op::Datum
{
bool boolThatUserNeedsForSomeReason;
......
......@@ -14,40 +14,40 @@
namespace op
{
/**
* 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
* 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:
* - 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
* - Asynchronous mode: call the empty constructor WrapperT() + 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,
* - Synchronous input + asynchronous output: call the constructor WrapperT(ThreadManagerMode::Synchronous,
* workersInput, {}, true)
* - Asynchronous input + synchronous output: call the constructor
* Wrapper(ThreadManagerMode::Synchronous, nullptr, workersOutput, irrelevantBoolean, true)
* WrapperT(ThreadManagerMode::Synchronous, nullptr, workersOutput, irrelevantBoolean, true)
*/
template<typename TDatums,
template<typename TDatums = std::vector<Datum>,
typename TDatumsSP = std::shared_ptr<TDatums>,
typename TWorker = std::shared_ptr<Worker<TDatumsSP>>>
class Wrapper
class WrapperT
{
public:
/**
* Constructor.
* @param threadManagerMode Thread syncronization mode. If set to ThreadManagerMode::Synchronous, everything
* will run inside the Wrapper. If ThreadManagerMode::Synchronous(In/Out), then input (frames producer) and/or
* output (GUI, writing results, etc.) will be controlled outside the Wrapper class by the user. See
* 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.
*/
explicit Wrapper(const ThreadManagerMode threadManagerMode = ThreadManagerMode::Synchronous);
explicit WrapperT(const ThreadManagerMode threadManagerMode = ThreadManagerMode::Synchronous);
/**
* Destructor.
* It automatically frees resources.
*/
~Wrapper();
~WrapperT();
/**
* Disable multi-threading.
......@@ -112,7 +112,7 @@ namespace op
/**
* Function to start multi-threading.
* Similar to start(), but exec() blocks the thread that calls the function (it saves 1 thread). Use exec()
* instead of start() if the calling thread will otherwise be waiting for the Wrapper to end.
* instead of start() if the calling thread will otherwise be waiting for the WrapperT to end.
*/
void exec();
......@@ -134,16 +134,16 @@ namespace op
void stop();
/**
* Whether the Wrapper is running.
* Whether the WrapperT is running.
* It will return true after exec() or start() and before stop(), and false otherwise.
* @return Boolean specifying whether the Wrapper is running.
* @return Boolean specifying whether the WrapperT is running.
*/
bool isRunning() const;
/**
* 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 Wrapper was stopped, it will return false and not emplace it.
* If the input queue is full or the WrapperT was stopped, it will return false and not emplace it.
* @param tDatums TDatumsSP element to be emplaced.
* @return Boolean specifying whether the tDatums could be emplaced.
*/
......@@ -153,7 +153,7 @@ namespace op
* 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.
* If the WrapperT class is stopped before adding the element, it will return false and not emplace it.
* @param tDatums TDatumsSP element to be emplaced.
* @return Boolean specifying whether the tDatums could be emplaced.
*/
......@@ -178,7 +178,7 @@ namespace op
/**
* 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 Wrapper was stopped, it will return false and not retrieve it.
* If the output queue is empty or the WrapperT was stopped, it will return false and not retrieve it.
* @param tDatums TDatumsSP element where the retrieved element will be placed.
* @return Boolean specifying whether the tDatums could be retrieved.
*/
......@@ -188,7 +188,7 @@ namespace op
* 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.
* If the WrapperT class is stopped before popping the element, it will return false and not retrieve it.
* @param tDatums TDatumsSP element where the retrieved element will be placed.
* @return Boolean specifying whether the tDatums could be retrieved.
*/
......@@ -219,8 +219,11 @@ namespace op
std::array<bool, int(WorkerType::Size)> mUserWsOnNewThread;
std::array<std::vector<TWorker>, int(WorkerType::Size)> mUserWs;
DELETE_COPY(Wrapper);
DELETE_COPY(WrapperT);
};
// Type
typedef WrapperT<DATUM_BASE_NO_PTR> Wrapper;
}
......@@ -232,7 +235,7 @@ namespace op
namespace op
{
template<typename TDatums, typename TDatumsSP, typename TWorker>
Wrapper<TDatums, TDatumsSP, TWorker>::Wrapper(const ThreadManagerMode threadManagerMode) :
WrapperT<TDatums, TDatumsSP, TWorker>::WrapperT(const ThreadManagerMode threadManagerMode) :
mThreadManagerMode{threadManagerMode},
mThreadManager{threadManagerMode},
mMultiThreadEnabled{true}
......@@ -240,7 +243,7 @@ namespace op
}
template<typename TDatums, typename TDatumsSP, typename TWorker>
Wrapper<TDatums, TDatumsSP, TWorker>::~Wrapper()
WrapperT<TDatums, TDatumsSP, TWorker>::~WrapperT()
{
try
{
......@@ -258,7 +261,7 @@ namespace op
}
template<typename TDatums, typename TDatumsSP, typename TWorker>
void Wrapper<TDatums, TDatumsSP, TWorker>::disableMultiThreading()
void WrapperT<TDatums, TDatumsSP, TWorker>::disableMultiThreading()
{
try
{
......@@ -271,7 +274,7 @@ namespace op
}
template<typename TDatums, typename TDatumsSP, typename TWorker>
void Wrapper<TDatums, TDatumsSP, TWorker>::setWorker(
void WrapperT<TDatums, TDatumsSP, TWorker>::setWorker(
const WorkerType workerType, const TWorker& worker, const bool workerOnNewThread)
{
try
......@@ -291,12 +294,12 @@ namespace op
}
template<typename TDatums, typename TDatumsSP, typename TWorker>
void Wrapper<TDatums, TDatumsSP, TWorker>::configure(const WrapperStructPose& wrapperStructPose,
const WrapperStructFace& wrapperStructFace,
const WrapperStructHand& wrapperStructHand,
const WrapperStructExtra& wrapperStructExtra,
const WrapperStructInput& wrapperStructInput,
const WrapperStructOutput& wrapperStructOutput)
void WrapperT<TDatums, TDatumsSP, TWorker>::configure(const WrapperStructPose& wrapperStructPose,
const WrapperStructFace& wrapperStructFace,
const WrapperStructHand& wrapperStructHand,
const WrapperStructExtra& wrapperStructExtra,
const WrapperStructInput& wrapperStructInput,
const WrapperStructOutput& wrapperStructOutput)
{
try
{
......@@ -314,7 +317,7 @@ namespace op
}
// template<typename TDatums, typename TDatumsSP, typename TWorker>
// void Wrapper<TDatums, TDatumsSP, TWorker>::configure(const WrapperStructPose& wrapperStructPose)
// void WrapperT<TDatums, TDatumsSP, TWorker>::configure(const WrapperStructPose& wrapperStructPose)
// {
// try
// {
......@@ -327,7 +330,7 @@ namespace op
// }
template<typename TDatums, typename TDatumsSP, typename TWorker>
void Wrapper<TDatums, TDatumsSP, TWorker>::configure(const WrapperStructFace& wrapperStructFace)
void WrapperT<TDatums, TDatumsSP, TWorker>::configure(const WrapperStructFace& wrapperStructFace)
{
try
{
......@@ -340,7 +343,7 @@ namespace op
}
template<typename TDatums, typename TDatumsSP, typename TWorker>
void Wrapper<TDatums, TDatumsSP, TWorker>::configure(const WrapperStructHand& wrapperStructHand)
void WrapperT<TDatums, TDatumsSP, TWorker>::configure(const WrapperStructHand& wrapperStructHand)
{
try
{
......@@ -353,7 +356,7 @@ namespace op
}
template<typename TDatums, typename TDatumsSP, typename TWorker>
void Wrapper<TDatums, TDatumsSP, TWorker>::configure(const WrapperStructExtra& wrapperStructExtra)
void WrapperT<TDatums, TDatumsSP, TWorker>::configure(const WrapperStructExtra& wrapperStructExtra)
{
try
{
......@@ -366,7 +369,7 @@ namespace op
}
template<typename TDatums, typename TDatumsSP, typename TWorker>
void Wrapper<TDatums, TDatumsSP, TWorker>::configure(const WrapperStructInput& wrapperStructInput)
void WrapperT<TDatums, TDatumsSP, TWorker>::configure(const WrapperStructInput& wrapperStructInput)
{
try
{
......@@ -379,7 +382,7 @@ namespace op
}
template<typename TDatums, typename TDatumsSP, typename TWorker>
void Wrapper<TDatums, TDatumsSP, TWorker>::configure(const WrapperStructOutput& wrapperStructOutput)
void WrapperT<TDatums, TDatumsSP, TWorker>::configure(const WrapperStructOutput& wrapperStructOutput)
{
try
{
......@@ -392,7 +395,7 @@ namespace op
}
template<typename TDatums, typename TDatumsSP, typename TWorker>
void Wrapper<TDatums, TDatumsSP, TWorker>::exec()
void WrapperT<TDatums, TDatumsSP, TWorker>::exec()
{
try
{
......@@ -410,7 +413,7 @@ namespace op
}
template<typename TDatums, typename TDatumsSP, typename TWorker>
void Wrapper<TDatums, TDatumsSP, TWorker>::start()
void WrapperT<TDatums, TDatumsSP, TWorker>::start()
{
try
{
......@@ -428,7 +431,7 @@ namespace op
}
template<typename TDatums, typename TDatumsSP, typename TWorker>
void Wrapper<TDatums, TDatumsSP, TWorker>::stop()
void WrapperT<TDatums, TDatumsSP, TWorker>::stop()
{
try
{
......@@ -441,7 +444,7 @@ namespace op
}
template<typename TDatums, typename TDatumsSP, typename TWorker>
bool Wrapper<TDatums, TDatumsSP, TWorker>::isRunning() const
bool WrapperT<TDatums, TDatumsSP, TWorker>::isRunning() const
{
try
{
......@@ -455,7 +458,7 @@ namespace op
}
template<typename TDatums, typename TDatumsSP, typename TWorker>
bool Wrapper<TDatums, TDatumsSP, TWorker>::tryEmplace(TDatumsSP& tDatums)
bool WrapperT<TDatums, TDatumsSP, TWorker>::tryEmplace(TDatumsSP& tDatums)
{
try
{
......@@ -472,7 +475,7 @@ namespace op
}
template<typename TDatums, typename TDatumsSP, typename TWorker>
bool Wrapper<TDatums, TDatumsSP, TWorker>::waitAndEmplace(TDatumsSP& tDatums)
bool WrapperT<TDatums, TDatumsSP, TWorker>::waitAndEmplace(TDatumsSP& tDatums)
{
try
{
......@@ -489,7 +492,7 @@ namespace op
}
template<typename TDatums, typename TDatumsSP, typename TWorker>
bool Wrapper<TDatums, TDatumsSP, TWorker>::tryPush(const TDatumsSP& tDatums)
bool WrapperT<TDatums, TDatumsSP, TWorker>::tryPush(const TDatumsSP& tDatums)
{
try
{
......@@ -506,7 +509,7 @@ namespace op
}
template<typename TDatums, typename TDatumsSP, typename TWorker>
bool Wrapper<TDatums, TDatumsSP, TWorker>::waitAndPush(const TDatumsSP& tDatums)
bool WrapperT<TDatums, TDatumsSP, TWorker>::waitAndPush(const TDatumsSP& tDatums)
{
try
{
......@@ -523,7 +526,7 @@ namespace op
}
template<typename TDatums, typename TDatumsSP, typename TWorker>
bool Wrapper<TDatums, TDatumsSP, TWorker>::tryPop(TDatumsSP& tDatums)
bool WrapperT<TDatums, TDatumsSP, TWorker>::tryPop(TDatumsSP& tDatums)
{
try
{
......@@ -540,7 +543,7 @@ namespace op
}
template<typename TDatums, typename TDatumsSP, typename TWorker>
bool Wrapper<TDatums, TDatumsSP, TWorker>::waitAndPop(TDatumsSP& tDatums)
bool WrapperT<TDatums, TDatumsSP, TWorker>::waitAndPop(TDatumsSP& tDatums)
{
try
{
......@@ -557,7 +560,7 @@ namespace op
}
template<typename TDatums, typename TDatumsSP, typename TWorker>
bool Wrapper<TDatums, TDatumsSP, TWorker>::emplaceAndPop(TDatumsSP& tDatums)
bool WrapperT<TDatums, TDatumsSP, TWorker>::emplaceAndPop(TDatumsSP& tDatums)
{
try
{
......@@ -574,7 +577,7 @@ namespace op
}
template<typename TDatums, typename TDatumsSP, typename TWorker>
TDatumsSP Wrapper<TDatums, TDatumsSP, TWorker>::emplaceAndPop(const cv::Mat& cvMat)
TDatumsSP WrapperT<TDatums, TDatumsSP, TWorker>::emplaceAndPop(const cv::Mat& cvMat)
{
try
{
......@@ -596,7 +599,7 @@ namespace op
}
}
extern template class Wrapper<DATUM_BASE_NO_PTR>;
extern template class WrapperT<DATUM_BASE_NO_PTR>;
}
#endif // OPENPOSE_WRAPPER_WRAPPER_HPP
......@@ -13,7 +13,7 @@
namespace op
{
/**
* It checks that no wrong/contradictory flags are enabled for Wrapper
* It checks that no wrong/contradictory flags are enabled for Wrapper(T)
* @param wrapperStructPose
* @param wrapperStructFace
* @param wrapperStructHand
......@@ -38,7 +38,7 @@ namespace op
* Thread ID increase (private internal function).
* If multi-threading mode, it increases the thread ID.
* If single-threading mode (for debugging), it does not modify it.
* Note that mThreadId must be re-initialized to 0 before starting a new Wrapper configuration.
* Note that mThreadId must be re-initialized to 0 before starting a new Wrapper(T) configuration.
* @param threadId unsigned long long element with the current thread id value. I will be edited to the next
* `desired thread id number.
*/
......
......@@ -8,7 +8,7 @@ namespace op
/**
* WrapperStructExtra: Pose estimation and rendering configuration struct.
* WrapperStructExtra allows the user to set up the pose estimation and rendering parameters that will be used for
* the OpenPose Wrapper class.
* the OpenPose WrapperT template and Wrapper class.
*/
struct OP_API WrapperStructExtra
{
......
......@@ -9,8 +9,8 @@ namespace op
{
/**
* WrapperStructFace: Face estimation and rendering configuration struct.
* WrapperStructFace allows the user to set up the face estimation and rendering parameters that will be used for the OpenPose Wrapper
* class.
* WrapperStructFace allows the user to set up the face estimation and rendering parameters that will be used for
* the OpenPose WrapperT template and Wrapper class.
*/
struct OP_API WrapperStructFace
{
......@@ -39,15 +39,17 @@ namespace op
float alphaKeypoint;
/**
* Rendering blending alpha value of the heat maps (face part, background or PAF) with respect to the background image.
* Rendering blending alpha value of the heat maps (face part, background or PAF) with respect to the
* background image.
* Value in the range [0, 1]. 0 will only render the background, 1 will only render the heat map.
*/
float alphaHeatMap;
/**
* Rendering threshold. Only estimated keypoints whose score confidences are higher than this value will be rendered. Generally, a
* high threshold (> 0.5) will only render very clear body parts; while small thresholds (~0.1) will also output guessed and occluded
* keypoints, but also more false positives (i.e. wrong detections).
* Rendering threshold. Only estimated keypoints whose score confidences are higher than this value will be
* rendered. Generally, a high threshold (> 0.5) will only render very clear body parts; while small thresholds
* (~0.1) will also output guessed and occluded keypoints, but also more false positives (i.e. wrong
* detections).
*/
float renderThreshold;
......
......@@ -9,8 +9,8 @@ namespace op
{
/**
* WrapperStructHand: Hand estimation and rendering configuration struct.
* WrapperStructHand allows the user to set up the hand estimation and rendering parameters that will be used for the OpenPose Wrapper
* class.
* WrapperStructHand allows the user to set up the hand estimation and rendering parameters that will be used for
* the OpenPose WrapperT template and Wrapper class.
*/
struct OP_API WrapperStructHand
{
......@@ -29,20 +29,22 @@ namespace op
/**
* Number of scales to process.
* The greater, the slower and more memory it will be needed, but it will potentially increase accuracy.
* This parameter is related with scaleRange, such as the final pose estimation will be an average of the predicted results for each scale.
* This parameter is related with scaleRange, such as the final pose estimation will be an average of the
* predicted results for each scale.
*/
int scalesNumber;
/**
* Total range between smallest and biggest scale. The scales will be centered in ratio 1. E.g. if scaleRange = 0.4 and
* scalesNumber = 2, then there will be 2 scales, 0.8 and 1.2.
* Total range between smallest and biggest scale. The scales will be centered in ratio 1. E.g. if
* scaleRange = 0.4 and scalesNumber = 2, then there will be 2 scales, 0.8 and 1.2.
*/
float scaleRange;
/**
* Whether to add tracking between frames. Adding hand tracking might improve hand keypoints detection for webcam (if the frame rate
* is high enough, i.e. >7 FPS per GPU) and video. This is not person ID tracking, it simply looks for hands in positions at which hands
* were located in previous frames, but it does not guarantee the same person id among frames.
* Whether to add tracking between frames. Adding hand tracking might improve hand keypoints detection for
* webcam (if the frame rate is high enough, i.e. >7 FPS per GPU) and video. This is not person ID tracking, it
* simply looks for hands in positions at which hands were located in previous frames, but it does not
* guarantee the same person id among frames.
*/
bool tracking;
......@@ -59,15 +61,17 @@ namespace op
float alphaKeypoint;
/**
* Rendering blending alpha value of the heat maps (hand part, background or PAF) with respect to the background image.
* Rendering blending alpha value of the heat maps (hand part, background or PAF) with respect to the
* background image.
* Value in the range [0, 1]. 0 will only render the background, 1 will only render the heat map.
*/
float alphaHeatMap;
/**
* Rendering threshold. Only estimated keypoints whose score confidences are higher than this value will be rendered. Generally, a
* high threshold (> 0.5) will only render very clear body parts; while small thresholds (~0.1) will also output guessed and occluded
* keypoints, but also more false positives (i.e. wrong detections).
* Rendering threshold. Only estimated keypoints whose score confidences are higher than this value will be
* rendered. Generally, a high threshold (> 0.5) will only render very clear body parts; while small thresholds
* (~0.1) will also output guessed and occluded keypoints, but also more false positives (i.e. wrong
* detections).
*/
float renderThreshold;
......
......@@ -12,7 +12,7 @@ namespace op
/**
* WrapperStructPose: Pose estimation and rendering configuration struct.
* WrapperStructPose allows the user to set up the pose estimation and rendering parameters that will be used for
* the OpenPose Wrapper class.
* the OpenPose WrapperT template and Wrapper class.
*/
struct OP_API WrapperStructPose
{
......
......@@ -2,5 +2,5 @@
namespace op
{
template class OP_API Wrapper<DATUM_BASE_NO_PTR>;
template class OP_API WrapperT<DATUM_BASE_NO_PTR>;
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册