From 8422af53732a51b3d6a4c07fd283e1b2ac9483f1 Mon Sep 17 00:00:00 2001 From: Travis CI Date: Fri, 14 Dec 2018 17:37:32 +0000 Subject: [PATCH] Deploy code docs to GitHub Pages Travis build: 446 Commit: 3caf642da03a8f2dfc5c3e308e670f4d0cb8221c --- doxygen.log | 5 +- html/classop_1_1_coco_json_saver-members.html | 2 +- html/classop_1_1_coco_json_saver.html | 12 +- html/classop_1_1_coco_json_saver.js | 2 +- html/coco_json_saver_8hpp.html | 1 + html/coco_json_saver_8hpp_source.html | 58 +- html/functions_c.html | 2 +- html/functions_func_c.html | 2 +- html/navtreeindex2.js | 2 +- html/search/all_2.js | 2 +- html/search/functions_2.js | 2 +- html/wrapper_auxiliary_8hpp_source.html | 743 +++++++++--------- 12 files changed, 423 insertions(+), 410 deletions(-) diff --git a/doxygen.log b/doxygen.log index b420c3d9..a9f90198 100644 --- a/doxygen.log +++ b/doxygen.log @@ -1047,7 +1047,8 @@ Ge/home/travis/build/CMU-Perceptual-Computing-Lab/openpose/include/openpose/cali /home/travis/build/CMU-Perceptual-Computing-Lab/openpose/include/openpose/face/faceExtractorNet.hpp:18: warning: The following parameters of op::FaceExtractorNet::FaceExtractorNet(const Point< int > &netInputSize, const Point< int > &netOutputSize, const std::vector< HeatMapType > &heatMapTypes={}, const ScaleMode heatMapScale=ScaleMode::ZeroToOne) are not documented: parameter 'heatMapTypes' parameter 'heatMapScale' -/home/travis/build/CMU-Perceptual-Computing-Lab/openpose/include/openpose/filestream/cocoJsonSaver.hpp:18: warning: The following parameters of op::CocoJsonSaver::CocoJsonSaver(const std::string &filePathToSave, const bool humanReadable=true, const CocoJsonFormat cocoJsonFormat=CocoJsonFormat::Body, const int mCocoJsonVariant=0) are not documented: +/home/travis/build/CMU-Perceptual-Computing-Lab/openpose/include/openpose/filestream/cocoJsonSaver.hpp:19: warning: The following parameters of op::CocoJsonSaver::CocoJsonSaver(const std::string &filePathToSave, const PoseModel poseModel, const bool humanReadable=true, const CocoJsonFormat cocoJsonFormat=CocoJsonFormat::Body, const int mCocoJsonVariant=0) are not documented: + parameter 'poseModel' parameter 'humanReadable' parameter 'cocoJsonFormat' parameter 'mCocoJsonVariant' @@ -1265,5 +1266,5 @@ Generating file index... Generating file member index... Generating example index... finalizing index lists... -lookup cache used 5046/65536 hits=39009 misses=5415 +lookup cache used 5050/65536 hits=39033 misses=5419 finished... diff --git a/html/classop_1_1_coco_json_saver-members.html b/html/classop_1_1_coco_json_saver-members.html index 04b8d56c..54a89eaf 100644 --- a/html/classop_1_1_coco_json_saver-members.html +++ b/html/classop_1_1_coco_json_saver-members.html @@ -112,7 +112,7 @@ $(document).ready(function(){initNavTree('classop_1_1_coco_json_saver.html','');

This is the complete list of members for op::CocoJsonSaver, including all inherited members.

- +
CocoJsonSaver(const std::string &filePathToSave, const bool humanReadable=true, const CocoJsonFormat cocoJsonFormat=CocoJsonFormat::Body, const int mCocoJsonVariant=0)op::CocoJsonSaverexplicit
CocoJsonSaver(const std::string &filePathToSave, const PoseModel poseModel, const bool humanReadable=true, const CocoJsonFormat cocoJsonFormat=CocoJsonFormat::Body, const int mCocoJsonVariant=0)op::CocoJsonSaverexplicit
record(const Array< float > &poseKeypoints, const Array< float > &poseScores, const std::string &imageName)op::CocoJsonSaver
~CocoJsonSaver()op::CocoJsonSavervirtual
diff --git a/html/classop_1_1_coco_json_saver.html b/html/classop_1_1_coco_json_saver.html index 0e2e3986..1a88f825 100644 --- a/html/classop_1_1_coco_json_saver.html +++ b/html/classop_1_1_coco_json_saver.html @@ -117,8 +117,8 @@ $(document).ready(function(){initNavTree('classop_1_1_coco_json_saver.html',''); - - + + @@ -127,7 +127,7 @@ Public Member Functions

Detailed Description

The CocoJsonSaver class creates a COCO validation json file with details about the processed images. It inherits from Recorder.

Constructor & Destructor Documentation

- +

Public Member Functions

 CocoJsonSaver (const std::string &filePathToSave, const bool humanReadable=true, const CocoJsonFormat cocoJsonFormat=CocoJsonFormat::Body, const int mCocoJsonVariant=0)
 
 CocoJsonSaver (const std::string &filePathToSave, const PoseModel poseModel, const bool humanReadable=true, const CocoJsonFormat cocoJsonFormat=CocoJsonFormat::Body, const int mCocoJsonVariant=0)
 
virtual ~CocoJsonSaver ()
 
void record (const Array< float > &poseKeypoints, const Array< float > &poseScores, const std::string &imageName)
@@ -140,6 +140,12 @@ Public Member Functions + + + + + + diff --git a/html/classop_1_1_coco_json_saver.js b/html/classop_1_1_coco_json_saver.js index 3d51e342..25152fc1 100644 --- a/html/classop_1_1_coco_json_saver.js +++ b/html/classop_1_1_coco_json_saver.js @@ -1,6 +1,6 @@ var classop_1_1_coco_json_saver = [ - [ "CocoJsonSaver", "classop_1_1_coco_json_saver.html#a380d4638d09cfe9c26551cc2efb7c3a8", null ], + [ "CocoJsonSaver", "classop_1_1_coco_json_saver.html#a6a98c5187aaa0f34cb6ce49cf2c81cfe", null ], [ "~CocoJsonSaver", "classop_1_1_coco_json_saver.html#a8bbfab84a7816cb0f189f243246f744b", null ], [ "record", "classop_1_1_coco_json_saver.html#a3a7fd417aa5d85044fb0703379af1a23", null ] ]; \ No newline at end of file diff --git a/html/coco_json_saver_8hpp.html b/html/coco_json_saver_8hpp.html index f9e5cab4..29035537 100644 --- a/html/coco_json_saver_8hpp.html +++ b/html/coco_json_saver_8hpp.html @@ -112,6 +112,7 @@ $(document).ready(function(){initNavTree('coco_json_saver_8hpp.html','');});

Go to the source code of this file.

diff --git a/html/coco_json_saver_8hpp_source.html b/html/coco_json_saver_8hpp_source.html index 41e13460..7deabd9e 100644 --- a/html/coco_json_saver_8hpp_source.html +++ b/html/coco_json_saver_8hpp_source.html @@ -112,37 +112,41 @@ $(document).ready(function(){initNavTree('coco_json_saver_8hpp_source.html','');
3 
- -
7 
-
8 namespace op
-
9 {
- -
15  {
-
16  public:
-
23  explicit CocoJsonSaver(const std::string& filePathToSave, const bool humanReadable = true,
-
24  const CocoJsonFormat cocoJsonFormat = CocoJsonFormat::Body,
-
25  const int mCocoJsonVariant = 0);
-
26 
-
27  virtual ~CocoJsonSaver();
-
28 
-
29  void record(const Array<float>& poseKeypoints, const Array<float>& poseScores, const std::string& imageName);
-
30 
-
31  private:
-
32  const CocoJsonFormat mCocoJsonFormat;
-
33  const int mCocoJsonVariant;
-
34  JsonOfstream mJsonOfstream;
-
35  bool mFirstElementAdded;
-
36 
- -
38  };
-
39 }
-
40 
-
41 #endif // OPENPOSE_FILESTREAM_POSE_JSON_COCO_SAVER_HPP
+ + +
8 
+
9 namespace op
+
10 {
+ +
16  {
+
17  public:
+
24  explicit CocoJsonSaver(
+
25  const std::string& filePathToSave, const PoseModel poseModel, const bool humanReadable = true,
+
26  const CocoJsonFormat cocoJsonFormat = CocoJsonFormat::Body, const int mCocoJsonVariant = 0);
+
27 
+
28  virtual ~CocoJsonSaver();
+
29 
+
30  void record(const Array<float>& poseKeypoints, const Array<float>& poseScores, const std::string& imageName);
+
31 
+
32  private:
+
33  const PoseModel mPoseModel;
+
34  const CocoJsonFormat mCocoJsonFormat;
+
35  const int mCocoJsonVariant;
+
36  JsonOfstream mJsonOfstream;
+
37  bool mFirstElementAdded;
+
38 
+ +
40  };
+
41 }
+
42 
+
43 #endif // OPENPOSE_FILESTREAM_POSE_JSON_COCO_SAVER_HPP
#define DELETE_COPY(className)
Definition: macros.hpp:34
+ +
PoseModel
Definition: enumClasses.hpp:9
Definition: jsonOfstream.hpp:9
-
Definition: cocoJsonSaver.hpp:14
+
Definition: cocoJsonSaver.hpp:15
diff --git a/html/functions_c.html b/html/functions_c.html index ff829004..b76706b6 100644 --- a/html/functions_c.html +++ b/html/functions_c.html @@ -194,7 +194,7 @@ $(document).ready(function(){initNavTree('functions_c.html','');}); , op::Datum
  • CocoJsonSaver() -: op::CocoJsonSaver +: op::CocoJsonSaver
  • comma() : op::JsonOfstream diff --git a/html/functions_func_c.html b/html/functions_func_c.html index a14c154d..d8304972 100644 --- a/html/functions_func_c.html +++ b/html/functions_func_c.html @@ -173,7 +173,7 @@ $(document).ready(function(){initNavTree('functions_func_c.html','');}); , op::Datum
  • CocoJsonSaver() -: op::CocoJsonSaver +: op::CocoJsonSaver
  • comma() : op::JsonOfstream diff --git a/html/navtreeindex2.js b/html/navtreeindex2.js index e2f345b0..eb445a6c 100644 --- a/html/navtreeindex2.js +++ b/html/navtreeindex2.js @@ -127,8 +127,8 @@ var NAVTREEINDEX2 = "classop_1_1_camera_parameter_reader.html#adf7ad0ef26603129a251fdc166ffa548":[1,0,3,2,5], "classop_1_1_camera_parameter_reader.html#ae33e8637012413719b389649d1e5448a":[1,0,3,2,12], "classop_1_1_coco_json_saver.html":[1,0,3,36], -"classop_1_1_coco_json_saver.html#a380d4638d09cfe9c26551cc2efb7c3a8":[1,0,3,36,0], "classop_1_1_coco_json_saver.html#a3a7fd417aa5d85044fb0703379af1a23":[1,0,3,36,2], +"classop_1_1_coco_json_saver.html#a6a98c5187aaa0f34cb6ce49cf2c81cfe":[1,0,3,36,0], "classop_1_1_coco_json_saver.html#a8bbfab84a7816cb0f189f243246f744b":[1,0,3,36,1], "classop_1_1_cv_mat_to_op_input.html":[1,0,3,6], "classop_1_1_cv_mat_to_op_input.html#a6c4ac1b8c6fc994cc332253c56e20c4a":[1,0,3,6,0], diff --git a/html/search/all_2.js b/html/search/all_2.js index 0d22e8dd..016de7a8 100644 --- a/html/search/all_2.js +++ b/html/search/all_2.js @@ -59,7 +59,7 @@ var searchData= ['coco_5f18',['COCO_18',['../namespaceop.html#af5b3ce2a5d3de87cb31b9b67e96f261fa0c4a19d9254adcb3ca1f0f527ee141fd',1,'op']]], ['cocojsonformat',['CocoJsonFormat',['../namespaceop.html#a5418b76dad5b4aea1133325f4aa715ac',1,'op']]], ['cocojsonsaver',['CocoJsonSaver',['../classop_1_1_coco_json_saver.html',1,'op']]], - ['cocojsonsaver',['CocoJsonSaver',['../classop_1_1_coco_json_saver.html#a380d4638d09cfe9c26551cc2efb7c3a8',1,'op::CocoJsonSaver']]], + ['cocojsonsaver',['CocoJsonSaver',['../classop_1_1_coco_json_saver.html#a6a98c5187aaa0f34cb6ce49cf2c81cfe',1,'op::CocoJsonSaver']]], ['cocojsonsaver_2ehpp',['cocoJsonSaver.hpp',['../coco_json_saver_8hpp.html',1,'']]], ['comma',['comma',['../classop_1_1_json_ofstream.html#ae4468279f789c8026d431b2ef62646f9',1,'op::JsonOfstream']]], ['commandqueue',['CommandQueue',['../classcl_1_1_command_queue.html#a8462de408ebfaf6332429a92b7938490',1,'cl::CommandQueue::CommandQueue(cl_command_queue_properties properties, cl_int *err=NULL)'],['../classcl_1_1_command_queue.html#a05ae8e9e44e9b28fc755937490535550',1,'cl::CommandQueue::CommandQueue(QueueProperties properties, cl_int *err=NULL)'],['../classcl_1_1_command_queue.html#adcb116a4e1a53417dad3d3850c33d42f',1,'cl::CommandQueue::CommandQueue(const Context &context, cl_command_queue_properties properties=0, cl_int *err=NULL)'],['../classcl_1_1_command_queue.html#a975c3dce399cb77a5c6b0e294e4778fe',1,'cl::CommandQueue::CommandQueue(const Context &context, QueueProperties properties, cl_int *err=NULL)'],['../classcl_1_1_command_queue.html#a887826e515b03224aec87b33ac59f327',1,'cl::CommandQueue::CommandQueue(const Context &context, const Device &device, cl_command_queue_properties properties=0, cl_int *err=NULL)'],['../classcl_1_1_command_queue.html#a8dd467bd94839921b7318cb30f92b5a4',1,'cl::CommandQueue::CommandQueue(const Context &context, const Device &device, QueueProperties properties, cl_int *err=NULL)'],['../classcl_1_1_command_queue.html#ab1beb7ab6e619a4e050d87c70bb001a6',1,'cl::CommandQueue::CommandQueue()'],['../classcl_1_1_command_queue.html#a09be675998c51f36aa7744b47eabebd3',1,'cl::CommandQueue::CommandQueue(const cl_command_queue &commandQueue, bool retainObject=false)'],['../classcl_1_1_command_queue.html#ae2ce434c5100e5b467ea8c6561e1f11e',1,'cl::CommandQueue::CommandQueue(const CommandQueue &queue)'],['../classcl_1_1_command_queue.html#a1c5830678be567e34dccbb0065c89b21',1,'cl::CommandQueue::CommandQueue(CommandQueue &&queue) CL_HPP_NOEXCEPT_']]], diff --git a/html/search/functions_2.js b/html/search/functions_2.js index 41460ffa..7cabd8c9 100644 --- a/html/search/functions_2.js +++ b/html/search/functions_2.js @@ -17,7 +17,7 @@ var searchData= ['checkthread',['checkThread',['../classop_1_1_pose_extractor_net.html#a073db5b9847c8afbc10ce534ea533a84',1,'op::PoseExtractorNet']]], ['clear',['clear',['../classop_1_1_pose_extractor_net.html#a3fe7256d9860f4c624f5cf928556bc28',1,'op::PoseExtractorNet::clear()'],['../classop_1_1_queue_base.html#a247f435c95709f3246d352eee4f757af',1,'op::QueueBase::clear()']]], ['clone',['clone',['../classop_1_1_array.html#af42f4570122d1b8259c211f52335909b',1,'op::Array::clone()'],['../structop_1_1_datum.html#a847f62b3060c5d0d106e60c29df87a0b',1,'op::Datum::clone()']]], - ['cocojsonsaver',['CocoJsonSaver',['../classop_1_1_coco_json_saver.html#a380d4638d09cfe9c26551cc2efb7c3a8',1,'op::CocoJsonSaver']]], + ['cocojsonsaver',['CocoJsonSaver',['../classop_1_1_coco_json_saver.html#a6a98c5187aaa0f34cb6ce49cf2c81cfe',1,'op::CocoJsonSaver']]], ['comma',['comma',['../classop_1_1_json_ofstream.html#ae4468279f789c8026d431b2ef62646f9',1,'op::JsonOfstream']]], ['commandqueue',['CommandQueue',['../classcl_1_1_command_queue.html#a8462de408ebfaf6332429a92b7938490',1,'cl::CommandQueue::CommandQueue(cl_command_queue_properties properties, cl_int *err=NULL)'],['../classcl_1_1_command_queue.html#a05ae8e9e44e9b28fc755937490535550',1,'cl::CommandQueue::CommandQueue(QueueProperties properties, cl_int *err=NULL)'],['../classcl_1_1_command_queue.html#adcb116a4e1a53417dad3d3850c33d42f',1,'cl::CommandQueue::CommandQueue(const Context &context, cl_command_queue_properties properties=0, cl_int *err=NULL)'],['../classcl_1_1_command_queue.html#a975c3dce399cb77a5c6b0e294e4778fe',1,'cl::CommandQueue::CommandQueue(const Context &context, QueueProperties properties, cl_int *err=NULL)'],['../classcl_1_1_command_queue.html#a887826e515b03224aec87b33ac59f327',1,'cl::CommandQueue::CommandQueue(const Context &context, const Device &device, cl_command_queue_properties properties=0, cl_int *err=NULL)'],['../classcl_1_1_command_queue.html#a8dd467bd94839921b7318cb30f92b5a4',1,'cl::CommandQueue::CommandQueue(const Context &context, const Device &device, QueueProperties properties, cl_int *err=NULL)'],['../classcl_1_1_command_queue.html#ab1beb7ab6e619a4e050d87c70bb001a6',1,'cl::CommandQueue::CommandQueue()'],['../classcl_1_1_command_queue.html#a09be675998c51f36aa7744b47eabebd3',1,'cl::CommandQueue::CommandQueue(const cl_command_queue &commandQueue, bool retainObject=false)'],['../classcl_1_1_command_queue.html#ae2ce434c5100e5b467ea8c6561e1f11e',1,'cl::CommandQueue::CommandQueue(const CommandQueue &queue)'],['../classcl_1_1_command_queue.html#a1c5830678be567e34dccbb0065c89b21',1,'cl::CommandQueue::CommandQueue(CommandQueue &&queue) CL_HPP_NOEXCEPT_']]], ['compile',['compile',['../classcl_1_1_program.html#a8da346ecc73cf9df257690815039ddb5',1,'cl::Program']]], diff --git a/html/wrapper_auxiliary_8hpp_source.html b/html/wrapper_auxiliary_8hpp_source.html index 30a1d290..22dc67f2 100644 --- a/html/wrapper_auxiliary_8hpp_source.html +++ b/html/wrapper_auxiliary_8hpp_source.html @@ -703,7 +703,7 @@ $(document).ready(function(){initNavTree('wrapper_auxiliary_8hpp_source.html',''
    621  // If humanFormat: bigger size (& maybe slower to process), but easier for user to read it
    622  const auto humanFormat = true;
    623  const auto cocoJsonSaver = std::make_shared<CocoJsonSaver>(
    -
    624  wrapperStructOutput.writeCocoJson, humanFormat,
    +
    624  wrapperStructOutput.writeCocoJson, wrapperStructPose.poseModel, humanFormat,
    625  (wrapperStructPose.poseModel != PoseModel::CAR_22
    626  && wrapperStructPose.poseModel != PoseModel::CAR_12
    @@ -715,380 +715,381 @@ $(document).ready(function(){initNavTree('wrapper_auxiliary_8hpp_source.html',''
    633  {
    634  // If humanFormat: bigger size (& maybe slower to process), but easier for user to read it
    635  const auto humanFormat = true;
    -
    636  const auto cocoJsonSaver = std::make_shared<CocoJsonSaver>(wrapperStructOutput.writeCocoFootJson,
    -
    637  humanFormat, CocoJsonFormat::Foot);
    -
    638  outputWs.emplace_back(std::make_shared<WCocoJsonSaver<TDatumsSP>>(cocoJsonSaver));
    -
    639  }
    -
    640  // Write frames as desired image format on hard disk
    -
    641  if (!writeImagesCleaned.empty())
    -
    642  {
    -
    643  const auto imageSaver = std::make_shared<ImageSaver>(writeImagesCleaned,
    -
    644  wrapperStructOutput.writeImagesFormat);
    -
    645  outputWs.emplace_back(std::make_shared<WImageSaver<TDatumsSP>>(imageSaver));
    -
    646  }
    -
    647  // Write frames as *.avi video on hard disk
    -
    648  if (!wrapperStructOutput.writeVideo.empty() || !wrapperStructOutput.writeBvh.empty())
    -
    649  {
    -
    650  if (wrapperStructOutput.writeVideoFps <= 0
    -
    651  && (!oPProducer || producerSharedPtr->get(CV_CAP_PROP_FPS) <= 0))
    -
    652  error("The frame rate of the frames producer is unknown. Set `--write_video_fps` to your desired"
    -
    653  " FPS if you wanna record video (`--write_video`). E.g., if it is a folder of images, you"
    -
    654  " will have to know or guess the frame rate; if it is a webcam, you should use the OpenPose"
    -
    655  " displayed FPS as desired value. If you do not care, simply add `--write_video_fps 30`.",
    -
    656  __LINE__, __FUNCTION__, __FILE__);
    -
    657  const auto originalVideoFps = (
    -
    658  wrapperStructOutput.writeVideoFps > 0 ?
    -
    659  wrapperStructOutput.writeVideoFps : producerSharedPtr->get(CV_CAP_PROP_FPS));
    -
    660  if (!wrapperStructOutput.writeVideo.empty())
    -
    661  {
    -
    662  if (!oPProducer)
    -
    663  error("Video file can only be recorded inside `wrapper/wrapper.hpp` if the producer"
    -
    664  " is one of the default ones (e.g., video, webcam, ...).",
    -
    665  __LINE__, __FUNCTION__, __FILE__);
    -
    666  const auto videoSaver = std::make_shared<VideoSaver>(
    -
    667  wrapperStructOutput.writeVideo, CV_FOURCC('M','J','P','G'), originalVideoFps);
    -
    668  outputWs.emplace_back(std::make_shared<WVideoSaver<TDatumsSP>>(videoSaver));
    -
    669  }
    -
    670  // Write joint angles as *.bvh file on hard disk
    -
    671 #ifdef USE_3D_ADAM_MODEL
    -
    672  if (!wrapperStructOutput.writeBvh.empty())
    -
    673  {
    -
    674  const auto bvhSaver = std::make_shared<BvhSaver>(
    -
    675  wrapperStructOutput.writeBvh, JointAngleEstimation::getTotalModel(), originalVideoFps
    -
    676  );
    -
    677  outputWs.emplace_back(std::make_shared<WBvhSaver<TDatumsSP>>(bvhSaver));
    -
    678  }
    -
    679 #endif
    -
    680  }
    -
    681  // Write heat maps as desired image format on hard disk
    -
    682  if (!writeHeatMapsCleaned.empty())
    -
    683  {
    -
    684  const auto heatMapSaver = std::make_shared<HeatMapSaver>(writeHeatMapsCleaned,
    -
    685  wrapperStructOutput.writeHeatMapsFormat);
    -
    686  outputWs.emplace_back(std::make_shared<WHeatMapSaver<TDatumsSP>>(heatMapSaver));
    -
    687  }
    -
    688  // Add frame information for GUI
    -
    689  const bool guiEnabled = (wrapperStructGui.displayMode != DisplayMode::NoDisplay);
    -
    690  // If this WGuiInfoAdder instance is placed before the WImageSaver or WVideoSaver, then the resulting
    -
    691  // recorded frames will look exactly as the final displayed image by the GUI
    -
    692  if (wrapperStructGui.guiVerbose && (guiEnabled || !userOutputWs.empty()
    -
    693  || threadManagerMode == ThreadManagerMode::Asynchronous
    -
    694  || threadManagerMode == ThreadManagerMode::AsynchronousOut))
    -
    695  {
    -
    696  const auto guiInfoAdder = std::make_shared<GuiInfoAdder>(numberThreads, guiEnabled);
    -
    697  outputWs.emplace_back(std::make_shared<WGuiInfoAdder<TDatumsSP>>(guiInfoAdder));
    -
    698  }
    -
    699  // Minimal graphical user interface (GUI)
    -
    700  TWorker guiW;
    -
    701  if (guiEnabled)
    -
    702  {
    -
    703  // PoseRenderers to Renderers
    -
    704  std::vector<std::shared_ptr<Renderer>> renderers;
    -
    705  if (wrapperStructPose.renderMode == RenderMode::Cpu)
    -
    706  renderers.emplace_back(std::static_pointer_cast<Renderer>(poseCpuRenderer));
    -
    707  else
    -
    708  for (const auto& poseGpuRenderer : poseGpuRenderers)
    -
    709  renderers.emplace_back(std::static_pointer_cast<Renderer>(poseGpuRenderer));
    -
    710  // Display
    -
    711  const auto numberViews = (intRound(producerSharedPtr->get(ProducerProperty::NumberViews)));
    -
    712  auto finalOutputSizeGui = finalOutputSize;
    -
    713  if (numberViews > 1 && finalOutputSizeGui.x > 0)
    -
    714  finalOutputSizeGui.x *= numberViews;
    -
    715  // Adam (+3-D/2-D) display
    -
    716  if (displayAdam)
    -
    717  {
    -
    718 #ifdef USE_3D_ADAM_MODEL
    -
    719  // Gui
    -
    720  const auto gui = std::make_shared<GuiAdam>(
    -
    721  finalOutputSizeGui, wrapperStructGui.fullScreen, threadManager.getIsRunningSharedPtr(),
    -
    722  spVideoSeek, poseExtractorNets, faceExtractorNets, handExtractorNets, renderers,
    -
    723  wrapperStructGui.displayMode, JointAngleEstimation::getTotalModel(),
    -
    724  wrapperStructOutput.writeVideoAdam
    -
    725  );
    -
    726  // WGui
    -
    727  guiW = {std::make_shared<WGuiAdam<TDatumsSP>>(gui)};
    -
    728 #endif
    -
    729  }
    -
    730  // 3-D (+2-D) display
    -
    731  else if (wrapperStructGui.displayMode == DisplayMode::Display3D
    -
    732  || wrapperStructGui.displayMode == DisplayMode::DisplayAll)
    -
    733  {
    -
    734  // Gui
    -
    735  const auto gui = std::make_shared<Gui3D>(
    -
    736  finalOutputSizeGui, wrapperStructGui.fullScreen, threadManager.getIsRunningSharedPtr(),
    -
    737  spVideoSeek, poseExtractorNets, faceExtractorNets, handExtractorNets, renderers,
    -
    738  wrapperStructPose.poseModel, wrapperStructGui.displayMode
    -
    739  );
    -
    740  // WGui
    -
    741  guiW = {std::make_shared<WGui3D<TDatumsSP>>(gui)};
    -
    742  }
    -
    743  // 2-D display
    -
    744  else if (wrapperStructGui.displayMode == DisplayMode::Display2D)
    -
    745  {
    -
    746  // Gui
    -
    747  const auto gui = std::make_shared<Gui>(
    -
    748  finalOutputSizeGui, wrapperStructGui.fullScreen, threadManager.getIsRunningSharedPtr(),
    -
    749  spVideoSeek, poseExtractorNets, faceExtractorNets, handExtractorNets, renderers
    -
    750  );
    -
    751  // WGui
    -
    752  guiW = {std::make_shared<WGui<TDatumsSP>>(gui)};
    -
    753  }
    -
    754  else
    -
    755  error("Unknown DisplayMode.", __LINE__, __FUNCTION__, __FILE__);
    -
    756  }
    -
    757  // Set FpsMax
    -
    758  TWorker wFpsMax;
    -
    759  if (wrapperStructPose.fpsMax > 0.)
    -
    760  wFpsMax = std::make_shared<WFpsMax<TDatumsSP>>(wrapperStructPose.fpsMax);
    -
    761  // Set wrapper as configured
    -
    762  log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__);
    -
    763 
    +
    636  const auto cocoJsonSaver = std::make_shared<CocoJsonSaver>(
    +
    637  wrapperStructOutput.writeCocoFootJson, wrapperStructPose.poseModel, humanFormat,
    + +
    639  outputWs.emplace_back(std::make_shared<WCocoJsonSaver<TDatumsSP>>(cocoJsonSaver));
    +
    640  }
    +
    641  // Write frames as desired image format on hard disk
    +
    642  if (!writeImagesCleaned.empty())
    +
    643  {
    +
    644  const auto imageSaver = std::make_shared<ImageSaver>(writeImagesCleaned,
    +
    645  wrapperStructOutput.writeImagesFormat);
    +
    646  outputWs.emplace_back(std::make_shared<WImageSaver<TDatumsSP>>(imageSaver));
    +
    647  }
    +
    648  // Write frames as *.avi video on hard disk
    +
    649  if (!wrapperStructOutput.writeVideo.empty() || !wrapperStructOutput.writeBvh.empty())
    +
    650  {
    +
    651  if (wrapperStructOutput.writeVideoFps <= 0
    +
    652  && (!oPProducer || producerSharedPtr->get(CV_CAP_PROP_FPS) <= 0))
    +
    653  error("The frame rate of the frames producer is unknown. Set `--write_video_fps` to your desired"
    +
    654  " FPS if you wanna record video (`--write_video`). E.g., if it is a folder of images, you"
    +
    655  " will have to know or guess the frame rate; if it is a webcam, you should use the OpenPose"
    +
    656  " displayed FPS as desired value. If you do not care, simply add `--write_video_fps 30`.",
    +
    657  __LINE__, __FUNCTION__, __FILE__);
    +
    658  const auto originalVideoFps = (
    +
    659  wrapperStructOutput.writeVideoFps > 0 ?
    +
    660  wrapperStructOutput.writeVideoFps : producerSharedPtr->get(CV_CAP_PROP_FPS));
    +
    661  if (!wrapperStructOutput.writeVideo.empty())
    +
    662  {
    +
    663  if (!oPProducer)
    +
    664  error("Video file can only be recorded inside `wrapper/wrapper.hpp` if the producer"
    +
    665  " is one of the default ones (e.g., video, webcam, ...).",
    +
    666  __LINE__, __FUNCTION__, __FILE__);
    +
    667  const auto videoSaver = std::make_shared<VideoSaver>(
    +
    668  wrapperStructOutput.writeVideo, CV_FOURCC('M','J','P','G'), originalVideoFps);
    +
    669  outputWs.emplace_back(std::make_shared<WVideoSaver<TDatumsSP>>(videoSaver));
    +
    670  }
    +
    671  // Write joint angles as *.bvh file on hard disk
    +
    672 #ifdef USE_3D_ADAM_MODEL
    +
    673  if (!wrapperStructOutput.writeBvh.empty())
    +
    674  {
    +
    675  const auto bvhSaver = std::make_shared<BvhSaver>(
    +
    676  wrapperStructOutput.writeBvh, JointAngleEstimation::getTotalModel(), originalVideoFps
    +
    677  );
    +
    678  outputWs.emplace_back(std::make_shared<WBvhSaver<TDatumsSP>>(bvhSaver));
    +
    679  }
    +
    680 #endif
    +
    681  }
    +
    682  // Write heat maps as desired image format on hard disk
    +
    683  if (!writeHeatMapsCleaned.empty())
    +
    684  {
    +
    685  const auto heatMapSaver = std::make_shared<HeatMapSaver>(writeHeatMapsCleaned,
    +
    686  wrapperStructOutput.writeHeatMapsFormat);
    +
    687  outputWs.emplace_back(std::make_shared<WHeatMapSaver<TDatumsSP>>(heatMapSaver));
    +
    688  }
    +
    689  // Add frame information for GUI
    +
    690  const bool guiEnabled = (wrapperStructGui.displayMode != DisplayMode::NoDisplay);
    +
    691  // If this WGuiInfoAdder instance is placed before the WImageSaver or WVideoSaver, then the resulting
    +
    692  // recorded frames will look exactly as the final displayed image by the GUI
    +
    693  if (wrapperStructGui.guiVerbose && (guiEnabled || !userOutputWs.empty()
    +
    694  || threadManagerMode == ThreadManagerMode::Asynchronous
    +
    695  || threadManagerMode == ThreadManagerMode::AsynchronousOut))
    +
    696  {
    +
    697  const auto guiInfoAdder = std::make_shared<GuiInfoAdder>(numberThreads, guiEnabled);
    +
    698  outputWs.emplace_back(std::make_shared<WGuiInfoAdder<TDatumsSP>>(guiInfoAdder));
    +
    699  }
    +
    700  // Minimal graphical user interface (GUI)
    +
    701  TWorker guiW;
    +
    702  if (guiEnabled)
    +
    703  {
    +
    704  // PoseRenderers to Renderers
    +
    705  std::vector<std::shared_ptr<Renderer>> renderers;
    +
    706  if (wrapperStructPose.renderMode == RenderMode::Cpu)
    +
    707  renderers.emplace_back(std::static_pointer_cast<Renderer>(poseCpuRenderer));
    +
    708  else
    +
    709  for (const auto& poseGpuRenderer : poseGpuRenderers)
    +
    710  renderers.emplace_back(std::static_pointer_cast<Renderer>(poseGpuRenderer));
    +
    711  // Display
    +
    712  const auto numberViews = (intRound(producerSharedPtr->get(ProducerProperty::NumberViews)));
    +
    713  auto finalOutputSizeGui = finalOutputSize;
    +
    714  if (numberViews > 1 && finalOutputSizeGui.x > 0)
    +
    715  finalOutputSizeGui.x *= numberViews;
    +
    716  // Adam (+3-D/2-D) display
    +
    717  if (displayAdam)
    +
    718  {
    +
    719 #ifdef USE_3D_ADAM_MODEL
    +
    720  // Gui
    +
    721  const auto gui = std::make_shared<GuiAdam>(
    +
    722  finalOutputSizeGui, wrapperStructGui.fullScreen, threadManager.getIsRunningSharedPtr(),
    +
    723  spVideoSeek, poseExtractorNets, faceExtractorNets, handExtractorNets, renderers,
    +
    724  wrapperStructGui.displayMode, JointAngleEstimation::getTotalModel(),
    +
    725  wrapperStructOutput.writeVideoAdam
    +
    726  );
    +
    727  // WGui
    +
    728  guiW = {std::make_shared<WGuiAdam<TDatumsSP>>(gui)};
    +
    729 #endif
    +
    730  }
    +
    731  // 3-D (+2-D) display
    +
    732  else if (wrapperStructGui.displayMode == DisplayMode::Display3D
    +
    733  || wrapperStructGui.displayMode == DisplayMode::DisplayAll)
    +
    734  {
    +
    735  // Gui
    +
    736  const auto gui = std::make_shared<Gui3D>(
    +
    737  finalOutputSizeGui, wrapperStructGui.fullScreen, threadManager.getIsRunningSharedPtr(),
    +
    738  spVideoSeek, poseExtractorNets, faceExtractorNets, handExtractorNets, renderers,
    +
    739  wrapperStructPose.poseModel, wrapperStructGui.displayMode
    +
    740  );
    +
    741  // WGui
    +
    742  guiW = {std::make_shared<WGui3D<TDatumsSP>>(gui)};
    +
    743  }
    +
    744  // 2-D display
    +
    745  else if (wrapperStructGui.displayMode == DisplayMode::Display2D)
    +
    746  {
    +
    747  // Gui
    +
    748  const auto gui = std::make_shared<Gui>(
    +
    749  finalOutputSizeGui, wrapperStructGui.fullScreen, threadManager.getIsRunningSharedPtr(),
    +
    750  spVideoSeek, poseExtractorNets, faceExtractorNets, handExtractorNets, renderers
    +
    751  );
    +
    752  // WGui
    +
    753  guiW = {std::make_shared<WGui<TDatumsSP>>(gui)};
    +
    754  }
    +
    755  else
    +
    756  error("Unknown DisplayMode.", __LINE__, __FUNCTION__, __FILE__);
    +
    757  }
    +
    758  // Set FpsMax
    +
    759  TWorker wFpsMax;
    +
    760  if (wrapperStructPose.fpsMax > 0.)
    +
    761  wFpsMax = std::make_shared<WFpsMax<TDatumsSP>>(wrapperStructPose.fpsMax);
    +
    762  // Set wrapper as configured
    +
    763  log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__);
    764 
    765 
    766 
    767 
    -
    768  // The less number of queues -> the less threads opened, and potentially the less lag
    -
    769 
    -
    770  // Sanity checks
    -
    771  if ((datumProducerW == nullptr) == (userInputWs.empty())
    -
    772  && threadManagerMode != ThreadManagerMode::Asynchronous
    -
    773  && threadManagerMode != ThreadManagerMode::AsynchronousIn)
    -
    774  {
    -
    775  const auto message = "You need to have 1 and only 1 producer selected. You can introduce your own"
    -
    776  " producer by using setWorker(WorkerType::Input, ...) or use the OpenPose"
    -
    777  " default producer by configuring it in the configure function) or use the"
    -
    778  " ThreadManagerMode::Asynchronous(In) mode.";
    -
    779  error(message, __LINE__, __FUNCTION__, __FILE__);
    -
    780  }
    -
    781  if (outputWs.empty() && userOutputWs.empty() && guiW == nullptr
    -
    782  && threadManagerMode != ThreadManagerMode::Asynchronous
    -
    783  && threadManagerMode != ThreadManagerMode::AsynchronousOut)
    -
    784  {
    -
    785  error("No output selected.", __LINE__, __FUNCTION__, __FILE__);
    -
    786  }
    -
    787 
    -
    788  // Thread Manager
    -
    789  // Clean previous thread manager (avoid configure to crash the program if used more than once)
    -
    790  threadManager.reset();
    -
    791  unsigned long long threadId = 0ull;
    -
    792  auto queueIn = 0ull;
    -
    793  auto queueOut = 1ull;
    -
    794  // After producer
    -
    795  // ID generator (before any multi-threading or any function that requires the ID)
    -
    796  const auto wIdGenerator = std::make_shared<WIdGenerator<TDatumsSP>>();
    -
    797  std::vector<TWorker> workersAux{wIdGenerator};
    -
    798  // Scale & cv::Mat to OP format
    -
    799  if (scaleAndSizeExtractorW != nullptr)
    -
    800  workersAux = mergeVectors(workersAux, {scaleAndSizeExtractorW});
    -
    801  if (cvMatToOpInputW != nullptr)
    -
    802  workersAux = mergeVectors(workersAux, {cvMatToOpInputW});
    -
    803  // cv::Mat to output format
    -
    804  if (cvMatToOpOutputW != nullptr)
    -
    805  workersAux = mergeVectors(workersAux, {cvMatToOpOutputW});
    -
    806 
    -
    807  // Producer
    -
    808  // If custom user Worker and uses its own thread
    -
    809  if (!userInputWs.empty() && userInputWsOnNewThread)
    -
    810  {
    -
    811  // Thread 0, queues 0 -> 1
    -
    812  log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__);
    -
    813  threadManager.add(threadId, userInputWs, queueIn++, queueOut++);
    -
    814  threadIdPP(threadId, multiThreadEnabled);
    -
    815  }
    -
    816  // If custom user Worker in same thread
    -
    817  else if (!userInputWs.empty())
    -
    818  workersAux = mergeVectors(userInputWs, workersAux);
    -
    819  // If OpenPose producer (same thread)
    -
    820  else if (datumProducerW != nullptr)
    -
    821  workersAux = mergeVectors({datumProducerW}, workersAux);
    -
    822  // Otherwise
    -
    823  else if (threadManagerMode != ThreadManagerMode::Asynchronous
    -
    824  && threadManagerMode != ThreadManagerMode::AsynchronousIn)
    -
    825  error("No input selected.", __LINE__, __FUNCTION__, __FILE__);
    -
    826  // Thread 0 or 1, queues 0 -> 1
    -
    827  log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__);
    -
    828  threadManager.add(threadId, workersAux, queueIn++, queueOut++);
    -
    829  // Increase thread
    -
    830  threadIdPP(threadId, multiThreadEnabled);
    -
    831 
    -
    832  // Pose estimation & rendering
    -
    833  // Thread 1 or 2...X, queues 1 -> 2, X = 2 + #GPUs
    -
    834  if (!poseExtractorsWs.empty())
    -
    835  {
    -
    836  if (multiThreadEnabled)
    -
    837  {
    -
    838  for (auto& wPose : poseExtractorsWs)
    -
    839  {
    -
    840  log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__);
    -
    841  threadManager.add(threadId, wPose, queueIn, queueOut);
    -
    842  threadIdPP(threadId, multiThreadEnabled);
    -
    843  }
    -
    844  queueIn++;
    -
    845  queueOut++;
    -
    846  // Sort frames - Required own thread
    -
    847  if (poseExtractorsWs.size() > 1u)
    -
    848  {
    -
    849  const auto wQueueOrderer = std::make_shared<WQueueOrderer<TDatumsSP>>();
    -
    850  log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__);
    -
    851  threadManager.add(threadId, wQueueOrderer, queueIn++, queueOut++);
    -
    852  threadIdPP(threadId, multiThreadEnabled);
    -
    853  }
    -
    854  }
    -
    855  else
    -
    856  {
    -
    857  if (poseExtractorsWs.size() > 1)
    -
    858  log("Multi-threading disabled, only 1 thread running. All GPUs have been disabled but the"
    -
    859  " first one, which is defined by gpuNumberStart (e.g., in the OpenPose demo, it is set"
    -
    860  " with the `--num_gpu_start` flag).", Priority::High);
    -
    861  log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__);
    -
    862  threadManager.add(threadId, poseExtractorsWs.at(0), queueIn++, queueOut++);
    -
    863  }
    -
    864  }
    -
    865  // Assemble all frames from same time instant (3-D module)
    -
    866  const auto wQueueAssembler = std::make_shared<WQueueAssembler<TDatumsSP, TDatums>>();
    -
    867  // 3-D reconstruction
    -
    868  if (!poseTriangulationsWs.empty())
    -
    869  {
    -
    870  // Assemble frames
    -
    871  log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__);
    -
    872  threadManager.add(threadId, wQueueAssembler, queueIn++, queueOut++);
    -
    873  threadIdPP(threadId, multiThreadEnabled);
    -
    874  // 3-D reconstruction
    -
    875  if (multiThreadEnabled)
    -
    876  {
    -
    877  for (auto& wPoseTriangulations : poseTriangulationsWs)
    -
    878  {
    -
    879  log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__);
    -
    880  threadManager.add(threadId, wPoseTriangulations, queueIn, queueOut);
    -
    881  threadIdPP(threadId, multiThreadEnabled);
    -
    882  }
    -
    883  queueIn++;
    -
    884  queueOut++;
    -
    885  // Sort frames
    -
    886  if (poseTriangulationsWs.size() > 1u)
    -
    887  {
    -
    888  const auto wQueueOrderer = std::make_shared<WQueueOrderer<TDatumsSP>>();
    -
    889  log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__);
    -
    890  threadManager.add(threadId, wQueueOrderer, queueIn++, queueOut++);
    -
    891  threadIdPP(threadId, multiThreadEnabled);
    -
    892  }
    -
    893  }
    -
    894  else
    -
    895  {
    -
    896  if (poseTriangulationsWs.size() > 1)
    -
    897  log("Multi-threading disabled, only 1 thread running for 3-D triangulation.",
    - -
    899  log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__);
    -
    900  threadManager.add(threadId, poseTriangulationsWs.at(0), queueIn++, queueOut++);
    -
    901  }
    -
    902  }
    -
    903  else
    -
    904  postProcessingWs = mergeVectors({wQueueAssembler}, postProcessingWs);
    -
    905  // Adam/IK step
    -
    906  if (!jointAngleEstimationsWs.empty())
    -
    907  {
    -
    908  if (multiThreadEnabled)
    -
    909  {
    -
    910  for (auto& wJointAngleEstimator : jointAngleEstimationsWs)
    -
    911  {
    -
    912  log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__);
    -
    913  threadManager.add(threadId, wJointAngleEstimator, queueIn, queueOut);
    -
    914  threadIdPP(threadId, multiThreadEnabled);
    -
    915  }
    -
    916  queueIn++;
    -
    917  queueOut++;
    -
    918  // Sort frames
    -
    919  if (jointAngleEstimationsWs.size() > 1)
    -
    920  {
    -
    921  const auto wQueueOrderer = std::make_shared<WQueueOrderer<TDatumsSP>>();
    -
    922  log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__);
    -
    923  threadManager.add(threadId, wQueueOrderer, queueIn++, queueOut++);
    -
    924  threadIdPP(threadId, multiThreadEnabled);
    -
    925  }
    -
    926  }
    -
    927  else
    -
    928  {
    -
    929  if (jointAngleEstimationsWs.size() > 1)
    -
    930  log("Multi-threading disabled, only 1 thread running for joint angle estimation.",
    - -
    932  log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__);
    -
    933  threadManager.add(threadId, jointAngleEstimationsWs.at(0), queueIn++, queueOut++);
    -
    934  }
    -
    935  }
    -
    936  // Post processing workers
    -
    937  if (!postProcessingWs.empty())
    -
    938  {
    -
    939  // Combining postProcessingWs and outputWs
    -
    940  outputWs = mergeVectors(postProcessingWs, outputWs);
    -
    941  // // If I wanna split them
    -
    942  // log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__);
    -
    943  // threadManager.add(threadId, postProcessingWs, queueIn++, queueOut++);
    -
    944  // threadIdPP(threadId, multiThreadEnabled);
    -
    945  }
    -
    946  // If custom user Worker and uses its own thread
    -
    947  if (!userPostProcessingWs.empty())
    -
    948  {
    -
    949  // If custom user Worker in its own thread
    -
    950  if (userPostProcessingWsOnNewThread)
    -
    951  {
    -
    952  log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__);
    -
    953  threadManager.add(threadId, userPostProcessingWs, queueIn++, queueOut++);
    -
    954  threadIdPP(threadId, multiThreadEnabled);
    -
    955  }
    -
    956  // If custom user Worker in same thread
    -
    957  // Merge with outputWs
    -
    958  else
    -
    959  outputWs = mergeVectors(outputWs, userPostProcessingWs);
    -
    960  }
    -
    961  // Output workers
    -
    962  if (!outputWs.empty())
    -
    963  {
    -
    964  // Thread 4 or 5, queues 4 -> 5
    -
    965  log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__);
    -
    966  threadManager.add(threadId, outputWs, queueIn++, queueOut++);
    -
    967  threadIdPP(threadId, multiThreadEnabled);
    -
    968  }
    -
    969  // User output worker
    -
    970  // Thread Y, queues Q -> Q+1
    -
    971  if (!userOutputWs.empty())
    -
    972  {
    -
    973  if (userOutputWsOnNewThread)
    -
    974  {
    -
    975  log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__);
    -
    976  threadManager.add(threadId, userOutputWs, queueIn++, queueOut++);
    -
    977  threadIdPP(threadId, multiThreadEnabled);
    -
    978  }
    -
    979  else
    -
    980  {
    -
    981  log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__);
    -
    982  threadManager.add(threadId-1, userOutputWs, queueIn++, queueOut++);
    -
    983  }
    -
    984  }
    -
    985  // OpenPose GUI
    -
    986  if (guiW != nullptr)
    -
    987  {
    -
    988  // Thread Y+1, queues Q+1 -> Q+2
    -
    989  log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__);
    -
    990  threadManager.add(threadId, guiW, queueIn++, queueOut++);
    -
    991  threadIdPP(threadId, multiThreadEnabled);
    -
    992  }
    -
    993  log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__);
    -
    994  // Setting maximum speed
    -
    995  if (wFpsMax != nullptr)
    -
    996  {
    -
    997  log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__);
    -
    998  threadManager.add(threadId, wFpsMax, queueIn++, queueOut++);
    -
    999  threadIdPP(threadId, multiThreadEnabled);
    -
    1000  }
    -
    1001  }
    -
    1002  catch (const std::exception& e)
    -
    1003  {
    -
    1004  error(e.what(), __LINE__, __FUNCTION__, __FILE__);
    -
    1005  }
    -
    1006  }
    -
    1007 }
    -
    1008 
    -
    1009 #endif // OPENPOSE_WRAPPER_WRAPPER_AUXILIARY_HPP
    +
    768 
    +
    769  // The less number of queues -> the less threads opened, and potentially the less lag
    +
    770 
    +
    771  // Sanity checks
    +
    772  if ((datumProducerW == nullptr) == (userInputWs.empty())
    +
    773  && threadManagerMode != ThreadManagerMode::Asynchronous
    +
    774  && threadManagerMode != ThreadManagerMode::AsynchronousIn)
    +
    775  {
    +
    776  const auto message = "You need to have 1 and only 1 producer selected. You can introduce your own"
    +
    777  " producer by using setWorker(WorkerType::Input, ...) or use the OpenPose"
    +
    778  " default producer by configuring it in the configure function) or use the"
    +
    779  " ThreadManagerMode::Asynchronous(In) mode.";
    +
    780  error(message, __LINE__, __FUNCTION__, __FILE__);
    +
    781  }
    +
    782  if (outputWs.empty() && userOutputWs.empty() && guiW == nullptr
    +
    783  && threadManagerMode != ThreadManagerMode::Asynchronous
    +
    784  && threadManagerMode != ThreadManagerMode::AsynchronousOut)
    +
    785  {
    +
    786  error("No output selected.", __LINE__, __FUNCTION__, __FILE__);
    +
    787  }
    +
    788 
    +
    789  // Thread Manager
    +
    790  // Clean previous thread manager (avoid configure to crash the program if used more than once)
    +
    791  threadManager.reset();
    +
    792  unsigned long long threadId = 0ull;
    +
    793  auto queueIn = 0ull;
    +
    794  auto queueOut = 1ull;
    +
    795  // After producer
    +
    796  // ID generator (before any multi-threading or any function that requires the ID)
    +
    797  const auto wIdGenerator = std::make_shared<WIdGenerator<TDatumsSP>>();
    +
    798  std::vector<TWorker> workersAux{wIdGenerator};
    +
    799  // Scale & cv::Mat to OP format
    +
    800  if (scaleAndSizeExtractorW != nullptr)
    +
    801  workersAux = mergeVectors(workersAux, {scaleAndSizeExtractorW});
    +
    802  if (cvMatToOpInputW != nullptr)
    +
    803  workersAux = mergeVectors(workersAux, {cvMatToOpInputW});
    +
    804  // cv::Mat to output format
    +
    805  if (cvMatToOpOutputW != nullptr)
    +
    806  workersAux = mergeVectors(workersAux, {cvMatToOpOutputW});
    +
    807 
    +
    808  // Producer
    +
    809  // If custom user Worker and uses its own thread
    +
    810  if (!userInputWs.empty() && userInputWsOnNewThread)
    +
    811  {
    +
    812  // Thread 0, queues 0 -> 1
    +
    813  log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__);
    +
    814  threadManager.add(threadId, userInputWs, queueIn++, queueOut++);
    +
    815  threadIdPP(threadId, multiThreadEnabled);
    +
    816  }
    +
    817  // If custom user Worker in same thread
    +
    818  else if (!userInputWs.empty())
    +
    819  workersAux = mergeVectors(userInputWs, workersAux);
    +
    820  // If OpenPose producer (same thread)
    +
    821  else if (datumProducerW != nullptr)
    +
    822  workersAux = mergeVectors({datumProducerW}, workersAux);
    +
    823  // Otherwise
    +
    824  else if (threadManagerMode != ThreadManagerMode::Asynchronous
    +
    825  && threadManagerMode != ThreadManagerMode::AsynchronousIn)
    +
    826  error("No input selected.", __LINE__, __FUNCTION__, __FILE__);
    +
    827  // Thread 0 or 1, queues 0 -> 1
    +
    828  log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__);
    +
    829  threadManager.add(threadId, workersAux, queueIn++, queueOut++);
    +
    830  // Increase thread
    +
    831  threadIdPP(threadId, multiThreadEnabled);
    +
    832 
    +
    833  // Pose estimation & rendering
    +
    834  // Thread 1 or 2...X, queues 1 -> 2, X = 2 + #GPUs
    +
    835  if (!poseExtractorsWs.empty())
    +
    836  {
    +
    837  if (multiThreadEnabled)
    +
    838  {
    +
    839  for (auto& wPose : poseExtractorsWs)
    +
    840  {
    +
    841  log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__);
    +
    842  threadManager.add(threadId, wPose, queueIn, queueOut);
    +
    843  threadIdPP(threadId, multiThreadEnabled);
    +
    844  }
    +
    845  queueIn++;
    +
    846  queueOut++;
    +
    847  // Sort frames - Required own thread
    +
    848  if (poseExtractorsWs.size() > 1u)
    +
    849  {
    +
    850  const auto wQueueOrderer = std::make_shared<WQueueOrderer<TDatumsSP>>();
    +
    851  log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__);
    +
    852  threadManager.add(threadId, wQueueOrderer, queueIn++, queueOut++);
    +
    853  threadIdPP(threadId, multiThreadEnabled);
    +
    854  }
    +
    855  }
    +
    856  else
    +
    857  {
    +
    858  if (poseExtractorsWs.size() > 1)
    +
    859  log("Multi-threading disabled, only 1 thread running. All GPUs have been disabled but the"
    +
    860  " first one, which is defined by gpuNumberStart (e.g., in the OpenPose demo, it is set"
    +
    861  " with the `--num_gpu_start` flag).", Priority::High);
    +
    862  log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__);
    +
    863  threadManager.add(threadId, poseExtractorsWs.at(0), queueIn++, queueOut++);
    +
    864  }
    +
    865  }
    +
    866  // Assemble all frames from same time instant (3-D module)
    +
    867  const auto wQueueAssembler = std::make_shared<WQueueAssembler<TDatumsSP, TDatums>>();
    +
    868  // 3-D reconstruction
    +
    869  if (!poseTriangulationsWs.empty())
    +
    870  {
    +
    871  // Assemble frames
    +
    872  log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__);
    +
    873  threadManager.add(threadId, wQueueAssembler, queueIn++, queueOut++);
    +
    874  threadIdPP(threadId, multiThreadEnabled);
    +
    875  // 3-D reconstruction
    +
    876  if (multiThreadEnabled)
    +
    877  {
    +
    878  for (auto& wPoseTriangulations : poseTriangulationsWs)
    +
    879  {
    +
    880  log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__);
    +
    881  threadManager.add(threadId, wPoseTriangulations, queueIn, queueOut);
    +
    882  threadIdPP(threadId, multiThreadEnabled);
    +
    883  }
    +
    884  queueIn++;
    +
    885  queueOut++;
    +
    886  // Sort frames
    +
    887  if (poseTriangulationsWs.size() > 1u)
    +
    888  {
    +
    889  const auto wQueueOrderer = std::make_shared<WQueueOrderer<TDatumsSP>>();
    +
    890  log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__);
    +
    891  threadManager.add(threadId, wQueueOrderer, queueIn++, queueOut++);
    +
    892  threadIdPP(threadId, multiThreadEnabled);
    +
    893  }
    +
    894  }
    +
    895  else
    +
    896  {
    +
    897  if (poseTriangulationsWs.size() > 1)
    +
    898  log("Multi-threading disabled, only 1 thread running for 3-D triangulation.",
    + +
    900  log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__);
    +
    901  threadManager.add(threadId, poseTriangulationsWs.at(0), queueIn++, queueOut++);
    +
    902  }
    +
    903  }
    +
    904  else
    +
    905  postProcessingWs = mergeVectors({wQueueAssembler}, postProcessingWs);
    +
    906  // Adam/IK step
    +
    907  if (!jointAngleEstimationsWs.empty())
    +
    908  {
    +
    909  if (multiThreadEnabled)
    +
    910  {
    +
    911  for (auto& wJointAngleEstimator : jointAngleEstimationsWs)
    +
    912  {
    +
    913  log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__);
    +
    914  threadManager.add(threadId, wJointAngleEstimator, queueIn, queueOut);
    +
    915  threadIdPP(threadId, multiThreadEnabled);
    +
    916  }
    +
    917  queueIn++;
    +
    918  queueOut++;
    +
    919  // Sort frames
    +
    920  if (jointAngleEstimationsWs.size() > 1)
    +
    921  {
    +
    922  const auto wQueueOrderer = std::make_shared<WQueueOrderer<TDatumsSP>>();
    +
    923  log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__);
    +
    924  threadManager.add(threadId, wQueueOrderer, queueIn++, queueOut++);
    +
    925  threadIdPP(threadId, multiThreadEnabled);
    +
    926  }
    +
    927  }
    +
    928  else
    +
    929  {
    +
    930  if (jointAngleEstimationsWs.size() > 1)
    +
    931  log("Multi-threading disabled, only 1 thread running for joint angle estimation.",
    + +
    933  log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__);
    +
    934  threadManager.add(threadId, jointAngleEstimationsWs.at(0), queueIn++, queueOut++);
    +
    935  }
    +
    936  }
    +
    937  // Post processing workers
    +
    938  if (!postProcessingWs.empty())
    +
    939  {
    +
    940  // Combining postProcessingWs and outputWs
    +
    941  outputWs = mergeVectors(postProcessingWs, outputWs);
    +
    942  // // If I wanna split them
    +
    943  // log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__);
    +
    944  // threadManager.add(threadId, postProcessingWs, queueIn++, queueOut++);
    +
    945  // threadIdPP(threadId, multiThreadEnabled);
    +
    946  }
    +
    947  // If custom user Worker and uses its own thread
    +
    948  if (!userPostProcessingWs.empty())
    +
    949  {
    +
    950  // If custom user Worker in its own thread
    +
    951  if (userPostProcessingWsOnNewThread)
    +
    952  {
    +
    953  log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__);
    +
    954  threadManager.add(threadId, userPostProcessingWs, queueIn++, queueOut++);
    +
    955  threadIdPP(threadId, multiThreadEnabled);
    +
    956  }
    +
    957  // If custom user Worker in same thread
    +
    958  // Merge with outputWs
    +
    959  else
    +
    960  outputWs = mergeVectors(outputWs, userPostProcessingWs);
    +
    961  }
    +
    962  // Output workers
    +
    963  if (!outputWs.empty())
    +
    964  {
    +
    965  // Thread 4 or 5, queues 4 -> 5
    +
    966  log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__);
    +
    967  threadManager.add(threadId, outputWs, queueIn++, queueOut++);
    +
    968  threadIdPP(threadId, multiThreadEnabled);
    +
    969  }
    +
    970  // User output worker
    +
    971  // Thread Y, queues Q -> Q+1
    +
    972  if (!userOutputWs.empty())
    +
    973  {
    +
    974  if (userOutputWsOnNewThread)
    +
    975  {
    +
    976  log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__);
    +
    977  threadManager.add(threadId, userOutputWs, queueIn++, queueOut++);
    +
    978  threadIdPP(threadId, multiThreadEnabled);
    +
    979  }
    +
    980  else
    +
    981  {
    +
    982  log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__);
    +
    983  threadManager.add(threadId-1, userOutputWs, queueIn++, queueOut++);
    +
    984  }
    +
    985  }
    +
    986  // OpenPose GUI
    +
    987  if (guiW != nullptr)
    +
    988  {
    +
    989  // Thread Y+1, queues Q+1 -> Q+2
    +
    990  log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__);
    +
    991  threadManager.add(threadId, guiW, queueIn++, queueOut++);
    +
    992  threadIdPP(threadId, multiThreadEnabled);
    +
    993  }
    +
    994  log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__);
    +
    995  // Setting maximum speed
    +
    996  if (wFpsMax != nullptr)
    +
    997  {
    +
    998  log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__);
    +
    999  threadManager.add(threadId, wFpsMax, queueIn++, queueOut++);
    +
    1000  threadIdPP(threadId, multiThreadEnabled);
    +
    1001  }
    +
    1002  }
    +
    1003  catch (const std::exception& e)
    +
    1004  {
    +
    1005  error(e.what(), __LINE__, __FUNCTION__, __FILE__);
    +
    1006  }
    +
    1007  }
    +
    1008 }
    +
    1009 
    +
    1010 #endif // OPENPOSE_WRAPPER_WRAPPER_AUXILIARY_HPP
    OP_API void threadIdPP(unsigned long long &threadId, const bool multiThreadEnabled)
    -- GitLab
  • const std::string &  filePathToSave,
    const PoseModel poseModel,