1 #ifndef OPENPOSE_WRAPPER_WRAPPER_AUXILIARY_HPP
2 #define OPENPOSE_WRAPPER_WRAPPER_AUXILIARY_HPP
30 WrapperStructPose& wrapperStructPose,
const WrapperStructFace& wrapperStructFace,
31 const WrapperStructHand& wrapperStructHand,
const WrapperStructExtra& wrapperStructExtra,
32 const WrapperStructInput& wrapperStructInput,
const WrapperStructOutput& wrapperStructOutput,
33 const WrapperStructGui& wrapperStructGui,
const bool renderOutput,
const bool userOutputWsEmpty,
34 const std::shared_ptr<Producer>& producerSharedPtr,
const ThreadManagerMode threadManagerMode);
44 OP_API void threadIdPP(
unsigned long long& threadId,
const bool multiThreadEnabled);
52 template<
typename TDatums,
53 typename TDatumsSP = std::shared_ptr<TDatums>,
54 typename TWorker = std::shared_ptr<Worker<TDatumsSP>>>
56 ThreadManager<TDatumsSP>& threadManager,
const bool multiThreadEnabled,
57 const ThreadManagerMode threadManagerMode,
const WrapperStructPose& wrapperStructPose,
58 const WrapperStructFace& wrapperStructFace,
const WrapperStructHand& wrapperStructHand,
59 const WrapperStructExtra& wrapperStructExtra,
const WrapperStructInput& wrapperStructInput,
60 const WrapperStructOutput& wrapperStructOutput,
const WrapperStructGui& wrapperStructGui,
84 template<
typename TDatums,
typename TDatumsSP,
typename TWorker>
105 auto wrapperStructPose = wrapperStructPoseTemp;
106 auto multiThreadEnabled = multiThreadEnabledTemp;
117 const auto spVideoSeek = std::make_shared<std::pair<std::atomic<bool>, std::atomic<int>>>();
119 spVideoSeek->first =
false;
120 spVideoSeek->second = 0;
126 const auto renderOutputGpu = wrapperStructPose.renderMode ==
RenderMode::Gpu
134 const auto userOutputWsEmpty = userOutputWs.empty();
136 wrapperStructPose, wrapperStructFace, wrapperStructHand, wrapperStructExtra, wrapperStructInput,
137 wrapperStructOutput, wrapperStructGui, renderOutput, userOutputWsEmpty, producerSharedPtr,
141 auto numberThreads = wrapperStructPose.gpuNumber;
142 auto gpuNumberStart = wrapperStructPose.gpuNumberStart;
146 numberThreads = (wrapperStructPose.gpuNumber == 0 ? 0 : 1);
151 multiThreadEnabled =
false;
159 if (numberThreads < 0)
161 if (totalGpuNumber <= gpuNumberStart)
162 error(
"Number of initial GPU (`--number_gpu_start`) must be lower than the total number of"
163 " used GPUs (`--number_gpu`)", __LINE__, __FUNCTION__, __FILE__);
164 numberThreads = totalGpuNumber - gpuNumberStart;
167 log(
"Auto-detecting all available GPUs... Detected " + std::to_string(totalGpuNumber)
168 +
" GPU(s), using " + std::to_string(numberThreads) +
" of them starting at GPU "
172 if (gpuNumberStart + numberThreads > totalGpuNumber)
173 error(
"Initial GPU selected (`--number_gpu_start`) + number GPUs to use (`--number_gpu`) must"
174 " be lower or equal than the total number of GPUs in your machine ("
175 + std::to_string(gpuNumberStart) +
" + "
176 + std::to_string(numberThreads) +
" vs. "
177 + std::to_string(totalGpuNumber) +
").",
178 __LINE__, __FUNCTION__, __FILE__);
189 auto finalOutputSize = wrapperStructPose.outputSize;
191 const auto oPProducer = (producerSharedPtr !=
nullptr);
197 producerSharedPtr->setProducerFpsMode(displayProducerFpsMode);
202 producerSize =
Point<int>{(int)producerSharedPtr->get(CV_CAP_PROP_FRAME_WIDTH),
203 (int)producerSharedPtr->get(CV_CAP_PROP_FRAME_HEIGHT)};
205 if (finalOutputSize.x == -1 || finalOutputSize.y == -1)
206 finalOutputSize = producerSize;
210 TWorker datumProducerW;
213 const auto datumProducer = std::make_shared<DatumProducer<TDatums>>(
215 wrapperStructInput.
frameLast, spVideoSeek
217 datumProducerW = std::make_shared<WDatumProducer<TDatumsSP, TDatums>>(datumProducer);
220 datumProducerW =
nullptr;
222 std::vector<std::shared_ptr<PoseExtractorNet>> poseExtractorNets;
223 std::vector<std::shared_ptr<FaceExtractorNet>> faceExtractorNets;
224 std::vector<std::shared_ptr<HandExtractorNet>> handExtractorNets;
225 std::vector<std::shared_ptr<PoseGpuRenderer>> poseGpuRenderers;
226 std::shared_ptr<PoseCpuRenderer> poseCpuRenderer;
228 TWorker scaleAndSizeExtractorW;
229 TWorker cvMatToOpInputW;
230 TWorker cvMatToOpOutputW;
231 std::vector<std::vector<TWorker>> poseExtractorsWs;
232 std::vector<std::vector<TWorker>> poseTriangulationsWs;
233 std::vector<std::vector<TWorker>> jointAngleEstimationsWs;
234 std::vector<TWorker> postProcessingWs;
235 if (numberThreads > 0)
238 const auto scaleAndSizeExtractor = std::make_shared<ScaleAndSizeExtractor>(
239 wrapperStructPose.netInputSize, finalOutputSize, wrapperStructPose.scalesNumber,
240 wrapperStructPose.scaleGap
242 scaleAndSizeExtractorW = std::make_shared<WScaleAndSizeExtractor<TDatumsSP>>(scaleAndSizeExtractor);
245 const auto cvMatToOpInput = std::make_shared<CvMatToOpInput>(wrapperStructPose.poseModel);
246 cvMatToOpInputW = std::make_shared<WCvMatToOpInput<TDatumsSP>>(cvMatToOpInput);
249 const auto cvMatToOpOutput = std::make_shared<CvMatToOpOutput>();
250 cvMatToOpOutputW = std::make_shared<WCvMatToOpOutput<TDatumsSP>>(cvMatToOpOutput);
254 std::vector<TWorker> cpuRenderers;
255 poseExtractorsWs.clear();
256 poseExtractorsWs.resize(numberThreads);
257 if (wrapperStructPose.enable)
260 for (
auto gpuId = 0; gpuId < numberThreads; gpuId++)
261 poseExtractorNets.emplace_back(std::make_shared<PoseExtractorCaffe>(
262 wrapperStructPose.poseModel, modelFolder, gpuId + gpuNumberStart,
263 wrapperStructPose.heatMapTypes, wrapperStructPose.heatMapScale,
264 wrapperStructPose.addPartCandidates, wrapperStructPose.maximizePositives,
265 wrapperStructPose.enableGoogleLogging
269 if (renderOutputGpu || wrapperStructPose.renderMode ==
RenderMode::Cpu)
273 const auto alphaKeypoint = (wrapperStructPose.renderMode !=
RenderMode::None
274 ? wrapperStructPose.alphaKeypoint : 0.f);
276 ? wrapperStructPose.alphaHeatMap : 0.f);
280 for (
const auto& poseExtractorNet : poseExtractorNets)
282 poseGpuRenderers.emplace_back(std::make_shared<PoseGpuRenderer>(
283 wrapperStructPose.poseModel, poseExtractorNet, wrapperStructPose.renderThreshold,
284 wrapperStructPose.blendOriginalFrame, alphaKeypoint,
285 alphaHeatMap, wrapperStructPose.defaultPartToRender
292 poseCpuRenderer = std::make_shared<PoseCpuRenderer>(
293 wrapperStructPose.poseModel, wrapperStructPose.renderThreshold,
294 wrapperStructPose.blendOriginalFrame, alphaKeypoint, alphaHeatMap,
295 wrapperStructPose.defaultPartToRender);
302 poseExtractorsWs.resize(poseExtractorNets.size());
304 ? std::make_shared<PersonIdExtractor>() :
nullptr);
311 const auto keepTopNPeople = (wrapperStructPose.numberPeopleMax > 0 ?
312 std::make_shared<KeepTopNPeople>(wrapperStructPose.numberPeopleMax)
315 auto personTrackers = std::make_shared<std::vector<std::shared_ptr<PersonTracker>>>();
316 if (wrapperStructExtra.
tracking > -1)
317 personTrackers->emplace_back(
318 std::make_shared<PersonTracker>(wrapperStructExtra.
tracking == 0));
319 for (
auto i = 0u; i < poseExtractorsWs.size(); i++)
323 const auto poseExtractor = std::make_shared<PoseExtractor>(
324 poseExtractorNets.at(i), keepTopNPeople, personIdExtractor, personTrackers,
325 wrapperStructPose.numberPeopleMax, wrapperStructExtra.
tracking);
326 poseExtractorsWs.at(i) = {std::make_shared<WPoseExtractor<TDatumsSP>>(poseExtractor)};
348 if (wrapperStructFace.
enable)
353 if (wrapperStructPose.enable)
355 const auto faceDetector = std::make_shared<FaceDetector>(wrapperStructPose.poseModel);
356 for (
auto& wPose : poseExtractorsWs)
362 log(
"Body keypoint detection is disabled. Hence, using OpenCV face detector (much less"
364 for (
auto& wPose : poseExtractorsWs)
367 const auto faceDetectorOpenCV = std::make_shared<FaceDetectorOpenCV>(modelFolder);
374 for (
auto gpu = 0u; gpu < poseExtractorsWs.size(); gpu++)
377 const auto netOutputSize = wrapperStructFace.
netInputSize;
378 const auto faceExtractorNet = std::make_shared<FaceExtractorCaffe>(
379 wrapperStructFace.
netInputSize, netOutputSize, modelFolder,
380 gpu + gpuNumberStart, wrapperStructPose.heatMapTypes, wrapperStructPose.heatMapScale,
381 wrapperStructPose.enableGoogleLogging
383 faceExtractorNets.emplace_back(faceExtractorNet);
384 poseExtractorsWs.at(gpu).emplace_back(
391 if (wrapperStructHand.
enable)
394 const auto handDetector = std::make_shared<HandDetector>(wrapperStructPose.poseModel);
395 for (
auto gpu = 0u; gpu < poseExtractorsWs.size(); gpu++)
400 poseExtractorsWs.at(gpu).emplace_back(
405 poseExtractorsWs.at(gpu).emplace_back(
408 const auto netOutputSize = wrapperStructHand.
netInputSize;
409 const auto handExtractorNet = std::make_shared<HandExtractorCaffe>(
410 wrapperStructHand.
netInputSize, netOutputSize, modelFolder,
412 wrapperStructPose.heatMapTypes, wrapperStructPose.heatMapScale,
413 wrapperStructPose.enableGoogleLogging
415 handExtractorNets.emplace_back(handExtractorNet);
416 poseExtractorsWs.at(gpu).emplace_back(
421 poseExtractorsWs.at(gpu).emplace_back(
429 if (!poseGpuRenderers.empty())
432 for (
auto i = 0u; i < poseExtractorsWs.size(); i++)
434 poseGpuRenderers.at(i)
447 const auto faceRenderer = std::make_shared<FaceCpuRenderer>(wrapperStructFace.
renderThreshold,
456 for (
auto i = 0u; i < poseExtractorsWs.size(); i++)
459 const auto faceRenderer = std::make_shared<FaceGpuRenderer>(
464 if (!poseGpuRenderers.empty())
466 const bool isLastRenderer = !renderHandGpu;
468 poseGpuRenderers.at(i)
474 poseExtractorsWs.at(i).emplace_back(
479 error(
"Unknown RenderMode.", __LINE__, __FUNCTION__, __FILE__);
491 const auto handRenderer = std::make_shared<HandCpuRenderer>(wrapperStructHand.
renderThreshold,
500 for (
auto i = 0u; i < poseExtractorsWs.size(); i++)
503 const auto handRenderer = std::make_shared<HandGpuRenderer>(
508 if (!poseGpuRenderers.empty())
510 const bool isLastRenderer =
true;
512 poseGpuRenderers.at(i)
518 poseExtractorsWs.at(i).emplace_back(
523 error(
"Unknown RenderMode.", __LINE__, __FUNCTION__, __FILE__);
528 poseTriangulationsWs.clear();
533 poseTriangulationsWs.resize(
fastMax(1,
int(poseExtractorsWs.size() / 4)));
534 for (
auto i = 0u ; i < poseTriangulationsWs.size() ; i++)
536 const auto poseTriangulation = std::make_shared<PoseTriangulation>(
538 poseTriangulationsWs.at(i) = {std::make_shared<WPoseTriangulation<TDatumsSP>>(
544 postProcessingWs.clear();
557 postProcessingWs =
mergeVectors(postProcessingWs, cpuRenderers);
558 const auto opOutputToCvMat = std::make_shared<OpOutputToCvMat>();
567 (finalOutputSize == producerSize || finalOutputSize.x <= 0 || finalOutputSize.y <= 0))
570 && producerSize == wrapperStructPose.netInputSize))
573 auto keypointScaler = std::make_shared<KeypointScaler>(wrapperStructPose.keypointScale);
583 jointAngleEstimationsWs.clear();
584 #ifdef USE_3D_ADAM_MODEL
588 jointAngleEstimationsWs.resize(wrapperStructExtra.
ikThreads);
590 for (
auto i = 0u; i < jointAngleEstimationsWs.size(); i++)
592 const auto jointAngleEstimation = std::make_shared<JointAngleEstimation>(displayAdam);
593 jointAngleEstimationsWs.at(i) = {std::make_shared<WJointAngleEstimation<TDatumsSP>>(
594 jointAngleEstimation)};
601 std::vector<TWorker> outputWs;
603 if (wrapperStructOutput.
verbose > 0.)
606 const auto verbosePrinter = std::make_shared<VerbosePrinter>(
607 wrapperStructOutput.
verbose, producerSharedPtr->get(CV_CAP_PROP_FRAME_COUNT));
613 #ifdef USE_3D_ADAM_MODEL
614 if (!wrapperStructOutput.
udpHost.empty() && !wrapperStructOutput.
udpPort.empty())
617 const auto udpSender = std::make_shared<UdpSender>(wrapperStructOutput.
udpHost,
624 if (!writeKeypointCleaned.empty())
627 const auto keypointSaver = std::make_shared<KeypointSaver>(writeKeypointCleaned,
630 if (wrapperStructFace.
enable)
632 if (wrapperStructHand.
enable)
638 if (!writeJsonCleaned.empty())
641 const auto peopleJsonSaver = std::make_shared<PeopleJsonSaver>(writeJsonCleaned);
650 const auto humanFormat =
true;
651 const auto cocoJsonSaver = std::make_shared<CocoJsonSaver>(
652 wrapperStructOutput.
writeCocoJson, wrapperStructPose.poseModel, humanFormat,
664 const auto humanFormat =
true;
665 const auto cocoJsonSaver = std::make_shared<CocoJsonSaver>(
672 if (!writeImagesCleaned.empty())
675 const auto imageSaver = std::make_shared<ImageSaver>(writeImagesCleaned,
680 auto originalVideoFps = 0.;
682 || !wrapperStructOutput.
writeBvh.empty())
686 && (!oPProducer || producerSharedPtr->get(CV_CAP_PROP_FPS) <= 0))
687 error(
"The frame rate of the frames producer is unknown. Set `--write_video_fps` to your desired"
688 " FPS if you wanna record video (`--write_video`). E.g., if it is a folder of images, you"
689 " will have to know or guess the frame rate; if it is a webcam, you should use the OpenPose"
690 " displayed FPS as desired value. If you do not care, simply add `--write_video_fps 30`.",
691 __LINE__, __FUNCTION__, __FILE__);
694 wrapperStructOutput.
writeVideoFps : producerSharedPtr->get(CV_CAP_PROP_FPS));
702 error(
"Video file can only be recorded inside `wrapper/wrapper.hpp` if the producer"
703 " is one of the default ones (e.g., video, webcam, ...).",
704 __LINE__, __FUNCTION__, __FILE__);
705 const auto videoSaver = std::make_shared<VideoSaver>(
706 wrapperStructOutput.
writeVideo, CV_FOURCC(
'M',
'J',
'P',
'G'), originalVideoFps);
711 #ifdef USE_3D_ADAM_MODEL
712 if (!wrapperStructOutput.
writeBvh.empty())
715 const auto bvhSaver = std::make_shared<BvhSaver>(
716 wrapperStructOutput.
writeBvh, JointAngleEstimation::getTotalModel(), originalVideoFps
718 outputWs.emplace_back(std::make_shared<WBvhSaver<TDatumsSP>>(bvhSaver));
723 if (!writeHeatMapsCleaned.empty())
726 const auto heatMapSaver = std::make_shared<HeatMapSaver>(
735 if (wrapperStructGui.
guiVerbose && (guiEnabled || !userOutputWs.empty()
740 const auto guiInfoAdder = std::make_shared<GuiInfoAdder>(numberThreads, guiEnabled);
746 TWorker videoSaver3DW;
751 std::vector<std::shared_ptr<Renderer>> renderers;
753 renderers.emplace_back(std::static_pointer_cast<Renderer>(poseCpuRenderer));
755 for (
const auto& poseGpuRenderer : poseGpuRenderers)
756 renderers.emplace_back(std::static_pointer_cast<Renderer>(poseGpuRenderer));
758 const auto numberViews = (producerSharedPtr !=
nullptr
760 auto finalOutputSizeGui = finalOutputSize;
761 if (numberViews > 1 && finalOutputSizeGui.x > 0)
762 finalOutputSizeGui.x *= numberViews;
766 #ifdef USE_3D_ADAM_MODEL
769 const auto gui = std::make_shared<GuiAdam>(
771 spVideoSeek, poseExtractorNets, faceExtractorNets, handExtractorNets, renderers,
772 wrapperStructGui.
displayMode, JointAngleEstimation::getTotalModel(),
776 guiW = {std::make_shared<WGuiAdam<TDatumsSP>>(gui)};
779 error(
"3D video can only be recorded if 3D render is enabled.",
780 __LINE__, __FUNCTION__, __FILE__);
789 const auto gui = std::make_shared<Gui3D>(
791 spVideoSeek, poseExtractorNets, faceExtractorNets, handExtractorNets, renderers,
792 wrapperStructPose.poseModel, wrapperStructGui.
displayMode,
796 guiW = {std::make_shared<WGui3D<TDatumsSP>>(gui)};
800 const auto videoSaver = std::make_shared<VideoSaver>(
801 wrapperStructOutput.
writeVideo3D, CV_FOURCC(
'M',
'J',
'P',
'G'), originalVideoFps);
802 videoSaver3DW = std::make_shared<WVideoSaver3D<TDatumsSP>>(videoSaver);
810 const auto gui = std::make_shared<Gui>(
812 spVideoSeek, poseExtractorNets, faceExtractorNets, handExtractorNets, renderers
815 guiW = {std::make_shared<WGui<TDatumsSP>>(gui)};
818 error(
"3D video can only be recorded if 3D render is enabled.",
819 __LINE__, __FUNCTION__, __FILE__);
822 error(
"Unknown DisplayMode.", __LINE__, __FUNCTION__, __FILE__);
827 if (wrapperStructPose.fpsMax > 0.)
828 wFpsMax = std::make_shared<WFpsMax<TDatumsSP>>(wrapperStructPose.fpsMax);
839 if ((datumProducerW ==
nullptr) == (userInputWs.empty())
843 const auto message =
"You need to have 1 and only 1 producer selected. You can introduce your own"
844 " producer by using setWorker(WorkerType::Input, ...) or use the OpenPose"
845 " default producer by configuring it in the configure function) or use the"
846 " ThreadManagerMode::Asynchronous(In) mode.";
847 error(message, __LINE__, __FUNCTION__, __FILE__);
849 if (outputWs.empty() && userOutputWs.empty() && guiW ==
nullptr
853 error(
"No output selected.", __LINE__, __FUNCTION__, __FILE__);
858 threadManager.
reset();
859 unsigned long long threadId = 0ull;
861 auto queueOut = 1ull;
864 const auto wIdGenerator = std::make_shared<WIdGenerator<TDatumsSP>>();
865 std::vector<TWorker> workersAux{wIdGenerator};
867 if (scaleAndSizeExtractorW !=
nullptr)
868 workersAux =
mergeVectors(workersAux, {scaleAndSizeExtractorW});
869 if (cvMatToOpInputW !=
nullptr)
870 workersAux =
mergeVectors(workersAux, {cvMatToOpInputW});
872 if (cvMatToOpOutputW !=
nullptr)
873 workersAux =
mergeVectors(workersAux, {cvMatToOpOutputW});
877 if (!userInputWs.empty() && userInputWsOnNewThread)
881 threadManager.
add(threadId, userInputWs, queueIn++, queueOut++);
885 else if (!userInputWs.empty())
888 else if (datumProducerW !=
nullptr)
889 workersAux =
mergeVectors({datumProducerW}, workersAux);
893 error(
"No input selected.", __LINE__, __FUNCTION__, __FILE__);
896 threadManager.
add(threadId, workersAux, queueIn++, queueOut++);
902 if (!poseExtractorsWs.empty())
904 if (multiThreadEnabled)
906 for (
auto& wPose : poseExtractorsWs)
909 threadManager.
add(threadId, wPose, queueIn, queueOut);
915 if (poseExtractorsWs.size() > 1u)
917 const auto wQueueOrderer = std::make_shared<WQueueOrderer<TDatumsSP>>();
919 threadManager.
add(threadId, wQueueOrderer, queueIn++, queueOut++);
925 if (poseExtractorsWs.size() > 1)
926 log(
"Multi-threading disabled, only 1 thread running. All GPUs have been disabled but the"
927 " first one, which is defined by gpuNumberStart (e.g., in the OpenPose demo, it is set"
930 threadManager.
add(threadId, poseExtractorsWs.at(0), queueIn++, queueOut++);
934 const auto wQueueAssembler = std::make_shared<WQueueAssembler<TDatumsSP, TDatums>>();
936 if (!poseTriangulationsWs.empty())
940 threadManager.
add(threadId, wQueueAssembler, queueIn++, queueOut++);
943 if (multiThreadEnabled)
945 for (
auto& wPoseTriangulations : poseTriangulationsWs)
948 threadManager.
add(threadId, wPoseTriangulations, queueIn, queueOut);
954 if (poseTriangulationsWs.size() > 1u)
956 const auto wQueueOrderer = std::make_shared<WQueueOrderer<TDatumsSP>>();
958 threadManager.
add(threadId, wQueueOrderer, queueIn++, queueOut++);
964 if (poseTriangulationsWs.size() > 1)
965 log(
"Multi-threading disabled, only 1 thread running for 3-D triangulation.",
968 threadManager.
add(threadId, poseTriangulationsWs.at(0), queueIn++, queueOut++);
972 postProcessingWs =
mergeVectors({wQueueAssembler}, postProcessingWs);
974 if (!jointAngleEstimationsWs.empty())
976 if (multiThreadEnabled)
978 for (
auto& wJointAngleEstimator : jointAngleEstimationsWs)
981 threadManager.
add(threadId, wJointAngleEstimator, queueIn, queueOut);
987 if (jointAngleEstimationsWs.size() > 1)
989 const auto wQueueOrderer = std::make_shared<WQueueOrderer<TDatumsSP>>();
991 threadManager.
add(threadId, wQueueOrderer, queueIn++, queueOut++);
997 if (jointAngleEstimationsWs.size() > 1)
998 log(
"Multi-threading disabled, only 1 thread running for joint angle estimation.",
1001 threadManager.
add(threadId, jointAngleEstimationsWs.at(0), queueIn++, queueOut++);
1005 if (!postProcessingWs.empty())
1015 if (!userPostProcessingWs.empty())
1018 if (userPostProcessingWsOnNewThread)
1021 threadManager.
add(threadId, userPostProcessingWs, queueIn++, queueOut++);
1027 outputWs =
mergeVectors(outputWs, userPostProcessingWs);
1030 if (!outputWs.empty())
1034 threadManager.
add(threadId, outputWs, queueIn++, queueOut++);
1039 if (!userOutputWs.empty())
1041 if (userOutputWsOnNewThread)
1044 threadManager.
add(threadId, userOutputWs, queueIn++, queueOut++);
1050 threadManager.
add(threadId-1, userOutputWs, queueIn++, queueOut++);
1054 if (guiW !=
nullptr)
1058 threadManager.
add(threadId, guiW, queueIn++, queueOut++);
1060 if (videoSaver3DW !=
nullptr)
1061 threadManager.
add(threadId, videoSaver3DW, queueIn++, queueOut++);
1066 if (wFpsMax !=
nullptr)
1069 threadManager.
add(threadId, wFpsMax, queueIn++, queueOut++);
1073 catch (
const std::exception& e)
1075 error(e.what(), __LINE__, __FUNCTION__, __FILE__);
1080 #endif // OPENPOSE_WRAPPER_WRAPPER_AUXILIARY_HPP
OP_API void threadIdPP(unsigned long long &threadId, const bool multiThreadEnabled)
int writeCocoJsonVariant
Definition: wrapperStructOutput.hpp:62
Definition: wHandDetectorTracking.hpp:11
Definition: wGuiInfoAdder.hpp:11
std::array< T, N > array
Definition: cl2.hpp:594
float alphaHeatMap
Definition: wrapperStructFace.hpp:46
std::string writeHeatMapsFormat
Definition: wrapperStructOutput.hpp:96
std::string writeVideo3D
Definition: wrapperStructOutput.hpp:112
Definition: wPoseSaver.hpp:12
Definition: wrapperStructPose.hpp:17
std::string writeKeypoint
Definition: wrapperStructOutput.hpp:28
float alphaKeypoint
Definition: wrapperStructFace.hpp:39
Definition: wFaceSaver.hpp:12
float alphaKeypoint
Definition: wrapperStructHand.hpp:61
OP_API void wrapperConfigureSanityChecks(WrapperStructPose &wrapperStructPose, const WrapperStructFace &wrapperStructFace, const WrapperStructHand &wrapperStructHand, const WrapperStructExtra &wrapperStructExtra, const WrapperStructInput &wrapperStructInput, const WrapperStructOutput &wrapperStructOutput, const WrapperStructGui &wrapperStructGui, const bool renderOutput, const bool userOutputWsEmpty, const std::shared_ptr< Producer > &producerSharedPtr, const ThreadManagerMode threadManagerMode)
Definition: wPeopleJsonSaver.hpp:11
Definition: wHandRenderer.hpp:11
double writeVideoFps
Definition: wrapperStructOutput.hpp:105
Definition: wImageSaver.hpp:11
std::string udpPort
Definition: wrapperStructOutput.hpp:136
std::string writeImages
Definition: wrapperStructOutput.hpp:68
std::shared_ptr< std::atomic< bool > > getIsRunningSharedPtr()
Definition: threadManager.hpp:40
T fastMax(const T a, const T b)
Definition: fastMath.hpp:70
float alphaHeatMap
Definition: wrapperStructHand.hpp:68
Definition: wKeypointScaler.hpp:11
std::string writeHeatMaps
Definition: wrapperStructOutput.hpp:90
std::string writeCocoJson
Definition: wrapperStructOutput.hpp:51
DisplayMode displayMode
Definition: wrapperStructGui.hpp:23
void add(const unsigned long long threadId, const std::vector< TWorker > &tWorkers, const unsigned long long queueInId, const unsigned long long queueOutId)
Definition: threadManager.hpp:125
Definition: wFaceDetector.hpp:11
void reset()
Definition: threadManager.hpp:157
Definition: wrapperStructFace.hpp:15
OP_API void error(const std::string &message, const int line=-1, const std::string &function="", const std::string &file="")
Definition: wVerbosePrinter.hpp:11
std::string udpHost
Definition: wrapperStructOutput.hpp:131
DataFormat writeKeypointFormat
Definition: wrapperStructOutput.hpp:35
std::string writeCocoFootJson
Definition: wrapperStructOutput.hpp:56
RenderMode renderMode
Definition: wrapperStructPose.hpp:81
float scaleRange
Definition: wrapperStructHand.hpp:41
OP_API GpuMode getGpuMode()
RenderMode renderMode
Definition: wrapperStructFace.hpp:33
bool tracking
Definition: wrapperStructHand.hpp:49
bool enable
Definition: wrapperStructFace.hpp:20
Definition: wFaceDetectorOpenCV.hpp:11
Definition: wVideoSaver.hpp:11
Definition: wUdpSender.hpp:11
Definition: wOpOutputToCvMat.hpp:11
OP_API std::string formatAsDirectory(const std::string &directoryPathString)
Definition: wHandDetectorUpdate.hpp:11
Definition: wrapperStructGui.hpp:12
Definition: wHandExtractorNet.hpp:11
std::string writeBvh
Definition: wrapperStructOutput.hpp:126
Definition: wFaceRenderer.hpp:11
Definition: wPoseRenderer.hpp:11
std::string writeJson
Definition: wrapperStructOutput.hpp:45
OP_API void log(const std::string &message, const Priority priority=Priority::Max, const int line=-1, const std::string &function="", const std::string &file="")
Definition: wCocoJsonSaver.hpp:11
double verbose
Definition: wrapperStructOutput.hpp:21
bool guiVerbose
Definition: wrapperStructGui.hpp:29
Definition: wrapperStructHand.hpp:15
float renderThreshold
Definition: wrapperStructHand.hpp:76
Definition: poseGpuRenderer.hpp:13
Definition: wHandDetector.hpp:11
std::string writeVideoAdam
Definition: wrapperStructOutput.hpp:119
std::vector< T > mergeVectors(const std::vector< T > &vectorA, const std::vector< T > &vectorB)
Definition: standard.hpp:40
Definition: wHandSaver.hpp:12
std::string writeVideo
Definition: wrapperStructOutput.hpp:83
Point< int > netInputSize
Definition: wrapperStructFace.hpp:27
void setSharedParametersAndIfLast(const std::tuple< std::shared_ptr< float * >, std::shared_ptr< bool >, std::shared_ptr< std::atomic< unsigned int >>, std::shared_ptr< std::atomic< unsigned long long >>, std::shared_ptr< const unsigned int >> &tuple, const bool isLast)
Definition: wHeatMapSaver.hpp:11
OP_API std::shared_ptr< Producer > createProducer(const ProducerType producerType=ProducerType::None, const std::string &producerString="", const Point< int > &cameraResolution=Point< int >{-1,-1}, const std::string &cameraParameterPath="models/cameraParameters/", const bool undistortImage=true, const int numberViews=-1)
bool enable
Definition: wrapperStructHand.hpp:20
ThreadManagerMode
Definition: enumClasses.hpp:9
int intRound(const T a)
Definition: fastMath.hpp:26
#define OP_API
Definition: macros.hpp:19
float renderThreshold
Definition: wrapperStructFace.hpp:54
std::string writeImagesFormat
Definition: wrapperStructOutput.hpp:76
Definition: wrapperStructOutput.hpp:13
OP_API int getGpuNumber()
Point< int > netInputSize
Definition: wrapperStructHand.hpp:27
void configureThreadManager(ThreadManager< TDatumsSP > &threadManager, const bool multiThreadEnabled, const ThreadManagerMode threadManagerMode, const WrapperStructPose &wrapperStructPose, const WrapperStructFace &wrapperStructFace, const WrapperStructHand &wrapperStructHand, const WrapperStructExtra &wrapperStructExtra, const WrapperStructInput &wrapperStructInput, const WrapperStructOutput &wrapperStructOutput, const WrapperStructGui &wrapperStructGui, const std::array< std::vector< TWorker >, int(WorkerType::Size)> &userWs, const std::array< bool, int(WorkerType::Size)> &userWsOnNewThread)
Definition: wrapperAuxiliary.hpp:85
int scalesNumber
Definition: wrapperStructHand.hpp:35
RenderMode renderMode
Definition: wrapperStructHand.hpp:55
bool fullScreen
Definition: wrapperStructGui.hpp:35