diff --git a/README.md b/README.md index 163274b803d9fc9f01df1f6229c88c9c829e9f61..c880feb163ebf333760b1d53dcf6fb6e480178e6 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/doc/installation.md b/doc/installation.md index bd4a954d6d22e55a786b0b2b3b79b0d95941fccd..098066c44a14d101c9aaf9dcc8db303cee80c7b4 100644 --- a/doc/installation.md +++ b/doc/installation.md @@ -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. diff --git a/doc/installation_jetson_tx2.md b/doc/installation_jetson_tx2.md index fa9496990db5ce35bac3cce31833c8aca5c64acc..508dea758764e71999e7280dcc7fbcc514e3b0e5 100644 --- a/doc/installation_jetson_tx2.md +++ b/doc/installation_jetson_tx2.md @@ -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: diff --git a/doc/library_add_new_module.md b/doc/library_add_new_module.md index fadce0da8adfcab474abcd1971f4ba0cda675447..501c879718065ada880912b2c2f4fc194723fd09 100644 --- a/doc/library_add_new_module.md +++ b/doc/library_add_new_module.md @@ -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> 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> 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`. diff --git a/doc/release_notes.md b/doc/release_notes.md index b9153ef0dc7b8645a615c9fb2470d6d3f34bef77..1d1d7ff053d3d2a4f4f6f121aa5688aea4063f5f 100644 --- a/doc/release_notes.md +++ b/doc/release_notes.md @@ -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. diff --git a/examples/openpose/openpose.cpp b/examples/openpose/openpose.cpp index 1661c2f5cd224d8de5a9146a0e5f5bb29defa577..a2dbbcdf6e93fe8008b2d9a0412bd75dcba44d44 100755 --- a/examples/openpose/openpose.cpp +++ b/examples/openpose/openpose.cpp @@ -74,7 +74,7 @@ int openPoseDemo() // OpenPose wrapper op::log("Configuring OpenPose wrapper...", op::Priority::Low, __LINE__, __FUNCTION__, __FILE__); - op::Wrapper> 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, diff --git a/examples/tutorial_add_module/1_custom_post_processing.cpp b/examples/tutorial_add_module/1_custom_post_processing.cpp index c1c2c19ca95e77bc0e9b3796045a1e14abaf74e0..aac250fbc4b108875efaa7c5053328ee9269304c 100644 --- a/examples/tutorial_add_module/1_custom_post_processing.cpp +++ b/examples/tutorial_add_module/1_custom_post_processing.cpp @@ -78,7 +78,7 @@ int openPoseTutorialWrapper4() // OpenPose wrapper op::log("Configuring OpenPose wrapper...", op::Priority::Low, __LINE__, __FUNCTION__, __FILE__); - op::Wrapper> opWrapper; + op::WrapperT> 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, diff --git a/examples/tutorial_api_cpp/1_body_from_image.cpp b/examples/tutorial_api_cpp/1_body_from_image.cpp index 98e038a36b6df976f987f2475fecc5aa8226f867..3aa24214c70a95308c03ff994fd35363ca394728 100644 --- a/examples/tutorial_api_cpp/1_body_from_image.cpp +++ b/examples/tutorial_api_cpp/1_body_from_image.cpp @@ -1,4 +1,4 @@ -// ------------------------- 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> 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(); diff --git a/examples/tutorial_api_cpp/2_whole_body_from_image.cpp b/examples/tutorial_api_cpp/2_whole_body_from_image.cpp index 92e11100338b079a3ecb66d8358976d4fada40eb..82fcde619ab8b0913c28f303555dedaa45112805 100644 --- a/examples/tutorial_api_cpp/2_whole_body_from_image.cpp +++ b/examples/tutorial_api_cpp/2_whole_body_from_image.cpp @@ -1,4 +1,4 @@ -// ------------------------- 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> opWrapper{op::ThreadManagerMode::Asynchronous}; + op::Wrapper opWrapper{op::ThreadManagerMode::Asynchronous}; // Add hand and face opWrapper.configure(op::WrapperStructFace{true}); opWrapper.configure(op::WrapperStructHand{true}); diff --git a/examples/tutorial_api_cpp/3_keypoints_from_image_configurable.cpp b/examples/tutorial_api_cpp/3_keypoints_from_image_configurable.cpp index 57054a8498e15959241d4bee6431c3f8f5be7d62..8b42670942170d948b304bcc273c595167587bb7 100644 --- a/examples/tutorial_api_cpp/3_keypoints_from_image_configurable.cpp +++ b/examples/tutorial_api_cpp/3_keypoints_from_image_configurable.cpp @@ -1,4 +1,4 @@ -// ------------------------- 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> 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, diff --git a/examples/tutorial_api_cpp/4_asynchronous_loop_custom_input_and_output.cpp b/examples/tutorial_api_cpp/4_asynchronous_loop_custom_input_and_output.cpp index 765bfb12a5000a42bc69f1ffd4784641b4948cc9..de84a6b559e49e997cf75676592a91bad4809499 100644 --- a/examples/tutorial_api_cpp/4_asynchronous_loop_custom_input_and_output.cpp +++ b/examples/tutorial_api_cpp/4_asynchronous_loop_custom_input_and_output.cpp @@ -1,4 +1,4 @@ -// ------------------------- 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 instead of -// Wrapper +// 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> instead of Wrapper (or equivalently WrapperT>) 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> opWrapper{op::ThreadManagerMode::Asynchronous}; + op::WrapperT> 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> 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(); } diff --git a/examples/tutorial_api_cpp/5_asynchronous_loop_custom_output.cpp b/examples/tutorial_api_cpp/5_asynchronous_loop_custom_output.cpp index 4e146373766c76a025ca733162b6f650a097e124..f574dfc5cc093a960dd239d33fac2380044e40c3 100644 --- a/examples/tutorial_api_cpp/5_asynchronous_loop_custom_output.cpp +++ b/examples/tutorial_api_cpp/5_asynchronous_loop_custom_output.cpp @@ -1,6 +1,6 @@ -// ------------------------- 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 -// 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 instead of Wrapper +// WrapperT> instead of Wrapper (or equivalently WrapperT>) 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> opWrapper{op::ThreadManagerMode::AsynchronousOut}; + op::WrapperT> 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> 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(); diff --git a/examples/tutorial_api_cpp/6_synchronous_custom_postprocessing.cpp b/examples/tutorial_api_cpp/6_synchronous_custom_postprocessing.cpp index 539bd3fc435cca90d6f0ef0dd0049cae2a211457..cc193eee27bf76d093e3029e0fd79c5174ebca2a 100644 --- a/examples/tutorial_api_cpp/6_synchronous_custom_postprocessing.cpp +++ b/examples/tutorial_api_cpp/6_synchronous_custom_postprocessing.cpp @@ -1,4 +1,4 @@ -// ------------------------- 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 -// 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 instead of Wrapper +// WrapperT> instead of Wrapper (or equivalently WrapperT>) 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> opWrapper; - op::Wrapper> opWrapper; + op::WrapperT> opWrapper; // Initializing the user custom classes // Processing diff --git a/examples/tutorial_api_cpp/7_synchronous_custom_input.cpp b/examples/tutorial_api_cpp/7_synchronous_custom_input.cpp index e35d729bf40ddc835714f32260dba22ab0ae94fd..d2646f017b0dbaf93cc191d41b6e166f86ed0310 100644 --- a/examples/tutorial_api_cpp/7_synchronous_custom_input.cpp +++ b/examples/tutorial_api_cpp/7_synchronous_custom_input.cpp @@ -1,4 +1,4 @@ -// ------------------------- 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 instead of Wrapper +// WrapperT> instead of Wrapper (or equivalently WrapperT>) 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> opWrapper; - op::Wrapper> opWrapper; + op::WrapperT> opWrapperT; // Initializing the user custom classes // Frames producer (e.g. video, webcam, ...) auto wUserInput = std::make_shared(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(); diff --git a/examples/tutorial_api_cpp/8_synchronous_custom_output.cpp b/examples/tutorial_api_cpp/8_synchronous_custom_output.cpp index ade60a016540a664da345bee8fb6e2b3c78a41ae..4522c98888c04a5e3d691bdf077c6054c14f7e99 100644 --- a/examples/tutorial_api_cpp/8_synchronous_custom_output.cpp +++ b/examples/tutorial_api_cpp/8_synchronous_custom_output.cpp @@ -1,4 +1,4 @@ -// ------------------------- 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 -// 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 instead of Wrapper +// WrapperT> instead of Wrapper (or equivalently WrapperT>) 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> opWrapper; - op::Wrapper> opWrapper; + op::WrapperT> opWrapperT; // Initializing the user custom classes // GUI (Display) auto wUserOutput = std::make_shared(); // 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(); diff --git a/examples/tutorial_api_cpp/9_synchronous_custom_all.cpp b/examples/tutorial_api_cpp/9_synchronous_custom_all.cpp index 682176cfa5534a7b065b9ccaa14ef766dbf1da8f..258f1961acf77be1beb919f2759599d0d59524f0 100644 --- a/examples/tutorial_api_cpp/9_synchronous_custom_all.cpp +++ b/examples/tutorial_api_cpp/9_synchronous_custom_all.cpp @@ -1,4 +1,4 @@ -// ------------------------- 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 instead of Wrapper +// WrapperT> instead of Wrapper (or equivalently WrapperT>) struct UserDatum : public op::Datum { bool boolThatUserNeedsForSomeReason; @@ -264,16 +264,16 @@ int openPoseTutorialWrapper2() // GUI (Display) auto wUserOutput = std::make_shared(); - op::Wrapper> opWrapper; + op::WrapperT> 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(); diff --git a/examples/tutorial_developer/thread_4_user_input_processing_output_and_datum.cpp b/examples/tutorial_developer/thread_4_user_input_processing_output_and_datum.cpp index ec51cf29a953364a2fd3d409812c5908adc9f064..71ba2e200fdf13922db15bf6d3700059fc00610d 100644 --- a/examples/tutorial_developer/thread_4_user_input_processing_output_and_datum.cpp +++ b/examples/tutorial_developer/thread_4_user_input_processing_output_and_datum.cpp @@ -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 instead of Wrapper +// WrapperT> instead of Wrapper (or equivalently WrapperT>) struct UserDatum : public op::Datum { bool boolThatUserNeedsForSomeReason; diff --git a/include/openpose/wrapper/wrapper.hpp b/include/openpose/wrapper/wrapper.hpp index 6122d6422fb8f8210518122e359a52c99770e3f7..e9548153a5681bc2c7ed4c59df137386754ebe36 100644 --- a/include/openpose/wrapper/wrapper.hpp +++ b/include/openpose/wrapper/wrapper.hpp @@ -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> + * 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 TDatumsSP = std::shared_ptr, typename TWorker = std::shared_ptr>> - 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 mUserWsOnNewThread; std::array, int(WorkerType::Size)> mUserWs; - DELETE_COPY(Wrapper); + DELETE_COPY(WrapperT); }; + + // Type + typedef WrapperT Wrapper; } @@ -232,7 +235,7 @@ namespace op namespace op { template - Wrapper::Wrapper(const ThreadManagerMode threadManagerMode) : + WrapperT::WrapperT(const ThreadManagerMode threadManagerMode) : mThreadManagerMode{threadManagerMode}, mThreadManager{threadManagerMode}, mMultiThreadEnabled{true} @@ -240,7 +243,7 @@ namespace op } template - Wrapper::~Wrapper() + WrapperT::~WrapperT() { try { @@ -258,7 +261,7 @@ namespace op } template - void Wrapper::disableMultiThreading() + void WrapperT::disableMultiThreading() { try { @@ -271,7 +274,7 @@ namespace op } template - void Wrapper::setWorker( + void WrapperT::setWorker( const WorkerType workerType, const TWorker& worker, const bool workerOnNewThread) { try @@ -291,12 +294,12 @@ namespace op } template - void Wrapper::configure(const WrapperStructPose& wrapperStructPose, - const WrapperStructFace& wrapperStructFace, - const WrapperStructHand& wrapperStructHand, - const WrapperStructExtra& wrapperStructExtra, - const WrapperStructInput& wrapperStructInput, - const WrapperStructOutput& wrapperStructOutput) + void WrapperT::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 - // void Wrapper::configure(const WrapperStructPose& wrapperStructPose) + // void WrapperT::configure(const WrapperStructPose& wrapperStructPose) // { // try // { @@ -327,7 +330,7 @@ namespace op // } template - void Wrapper::configure(const WrapperStructFace& wrapperStructFace) + void WrapperT::configure(const WrapperStructFace& wrapperStructFace) { try { @@ -340,7 +343,7 @@ namespace op } template - void Wrapper::configure(const WrapperStructHand& wrapperStructHand) + void WrapperT::configure(const WrapperStructHand& wrapperStructHand) { try { @@ -353,7 +356,7 @@ namespace op } template - void Wrapper::configure(const WrapperStructExtra& wrapperStructExtra) + void WrapperT::configure(const WrapperStructExtra& wrapperStructExtra) { try { @@ -366,7 +369,7 @@ namespace op } template - void Wrapper::configure(const WrapperStructInput& wrapperStructInput) + void WrapperT::configure(const WrapperStructInput& wrapperStructInput) { try { @@ -379,7 +382,7 @@ namespace op } template - void Wrapper::configure(const WrapperStructOutput& wrapperStructOutput) + void WrapperT::configure(const WrapperStructOutput& wrapperStructOutput) { try { @@ -392,7 +395,7 @@ namespace op } template - void Wrapper::exec() + void WrapperT::exec() { try { @@ -410,7 +413,7 @@ namespace op } template - void Wrapper::start() + void WrapperT::start() { try { @@ -428,7 +431,7 @@ namespace op } template - void Wrapper::stop() + void WrapperT::stop() { try { @@ -441,7 +444,7 @@ namespace op } template - bool Wrapper::isRunning() const + bool WrapperT::isRunning() const { try { @@ -455,7 +458,7 @@ namespace op } template - bool Wrapper::tryEmplace(TDatumsSP& tDatums) + bool WrapperT::tryEmplace(TDatumsSP& tDatums) { try { @@ -472,7 +475,7 @@ namespace op } template - bool Wrapper::waitAndEmplace(TDatumsSP& tDatums) + bool WrapperT::waitAndEmplace(TDatumsSP& tDatums) { try { @@ -489,7 +492,7 @@ namespace op } template - bool Wrapper::tryPush(const TDatumsSP& tDatums) + bool WrapperT::tryPush(const TDatumsSP& tDatums) { try { @@ -506,7 +509,7 @@ namespace op } template - bool Wrapper::waitAndPush(const TDatumsSP& tDatums) + bool WrapperT::waitAndPush(const TDatumsSP& tDatums) { try { @@ -523,7 +526,7 @@ namespace op } template - bool Wrapper::tryPop(TDatumsSP& tDatums) + bool WrapperT::tryPop(TDatumsSP& tDatums) { try { @@ -540,7 +543,7 @@ namespace op } template - bool Wrapper::waitAndPop(TDatumsSP& tDatums) + bool WrapperT::waitAndPop(TDatumsSP& tDatums) { try { @@ -557,7 +560,7 @@ namespace op } template - bool Wrapper::emplaceAndPop(TDatumsSP& tDatums) + bool WrapperT::emplaceAndPop(TDatumsSP& tDatums) { try { @@ -574,7 +577,7 @@ namespace op } template - TDatumsSP Wrapper::emplaceAndPop(const cv::Mat& cvMat) + TDatumsSP WrapperT::emplaceAndPop(const cv::Mat& cvMat) { try { @@ -596,7 +599,7 @@ namespace op } } - extern template class Wrapper; + extern template class WrapperT; } #endif // OPENPOSE_WRAPPER_WRAPPER_HPP diff --git a/include/openpose/wrapper/wrapperAuxiliary.hpp b/include/openpose/wrapper/wrapperAuxiliary.hpp index 193ae5df3764b92de931e23822d52da1f30b4a2b..f6f537237b224fdedb73a8b3a3f0f2a31151ab94 100644 --- a/include/openpose/wrapper/wrapperAuxiliary.hpp +++ b/include/openpose/wrapper/wrapperAuxiliary.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. */ diff --git a/include/openpose/wrapper/wrapperStructExtra.hpp b/include/openpose/wrapper/wrapperStructExtra.hpp index 3e6d8d3ba8d6c20c16f1eabdddab8b2be1dd4b82..b8a0f80288f1b747686482e9c1929ea5f6b2d7af 100644 --- a/include/openpose/wrapper/wrapperStructExtra.hpp +++ b/include/openpose/wrapper/wrapperStructExtra.hpp @@ -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 { diff --git a/include/openpose/wrapper/wrapperStructFace.hpp b/include/openpose/wrapper/wrapperStructFace.hpp index 7a4ec6661a5c8e3e8e59cbf7fe52cb455e1ea58d..2c049b22176e62006b9ce3c1fbf07057745982ce 100644 --- a/include/openpose/wrapper/wrapperStructFace.hpp +++ b/include/openpose/wrapper/wrapperStructFace.hpp @@ -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; diff --git a/include/openpose/wrapper/wrapperStructHand.hpp b/include/openpose/wrapper/wrapperStructHand.hpp index 38e46551e06e65dea2540ce763665bca334ad098..48505be670922c614cbc321addea25dd2f019e73 100644 --- a/include/openpose/wrapper/wrapperStructHand.hpp +++ b/include/openpose/wrapper/wrapperStructHand.hpp @@ -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; diff --git a/include/openpose/wrapper/wrapperStructPose.hpp b/include/openpose/wrapper/wrapperStructPose.hpp index 2a5433f852d6b26ebf0212742181f5ec99c2e8a9..03640388f6862c57878e0fea78b2a7c94cc685fb 100644 --- a/include/openpose/wrapper/wrapperStructPose.hpp +++ b/include/openpose/wrapper/wrapperStructPose.hpp @@ -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 { diff --git a/src/openpose/wrapper/defineTemplates.cpp b/src/openpose/wrapper/defineTemplates.cpp index 2dfe48c18b3d52b432ac2c86446185b583d85d31..986e95c3dc7ad3173dcd021fc975571232b6e011 100644 --- a/src/openpose/wrapper/defineTemplates.cpp +++ b/src/openpose/wrapper/defineTemplates.cpp @@ -2,5 +2,5 @@ namespace op { - template class OP_API Wrapper; + template class OP_API WrapperT; }