diff --git a/include/openpose/core/keyPointScaler.hpp b/include/openpose/core/keyPointScaler.hpp index 27752d23..9ed2e139 100644 --- a/include/openpose/core/keyPointScaler.hpp +++ b/include/openpose/core/keyPointScaler.hpp @@ -12,9 +12,9 @@ namespace op public: explicit KeyPointScaler(const ScaleMode scaleMode); - void scale(Array& arrayToScale, const double scaleInputToOutput, const double scaleNetToOutput, const cv::Size& producerSize) const; + void scale(Array& arrayToScale, const float scaleInputToOutput, const float scaleNetToOutput, const cv::Size& producerSize) const; - void scale(std::vector>& arraysToScale, const double scaleInputToOutput, const double scaleNetToOutput, const cv::Size& producerSize) const; + void scale(std::vector>& arraysToScale, const float scaleInputToOutput, const float scaleNetToOutput, const cv::Size& producerSize) const; private: const ScaleMode mScaleMode; diff --git a/include/openpose/core/netCaffe.hpp b/include/openpose/core/netCaffe.hpp index f4a59af4..6f271f60 100644 --- a/include/openpose/core/netCaffe.hpp +++ b/include/openpose/core/netCaffe.hpp @@ -6,7 +6,7 @@ #include // std::shared_ptr #include #include -#include "../utilities/macros.hpp" +#include #include "net.hpp" namespace op @@ -17,6 +17,8 @@ namespace op NetCaffe(const std::array& netInputSize4D, const std::string& caffeProto, const std::string& caffeTrainedModel, const int gpuId = 0, const std::string& lastBlobName = "net_output"); + virtual ~NetCaffe(); + void initializationOnThread(); // Alternative a) getInputDataCpuPtr or getInputDataGpuPtr + forwardPass diff --git a/include/openpose/core/renderer.hpp b/include/openpose/core/renderer.hpp index c8adeaa0..f3867a5e 100644 --- a/include/openpose/core/renderer.hpp +++ b/include/openpose/core/renderer.hpp @@ -2,7 +2,7 @@ #define OPENPOSE__CORE__RENDERER_HPP #include // std::shared_ptr -#include "../utilities/macros.hpp" +#include namespace op { diff --git a/include/openpose/core/resizeAndMergeCaffe.hpp b/include/openpose/core/resizeAndMergeCaffe.hpp index 4d801bb8..371841cf 100644 --- a/include/openpose/core/resizeAndMergeCaffe.hpp +++ b/include/openpose/core/resizeAndMergeCaffe.hpp @@ -4,7 +4,7 @@ #include #include -#include "../utilities/macros.hpp" +#include namespace op { diff --git a/include/openpose/core/scaleKeyPoints.hpp b/include/openpose/core/scaleKeyPoints.hpp index 9e193b1e..91689c10 100644 --- a/include/openpose/core/scaleKeyPoints.hpp +++ b/include/openpose/core/scaleKeyPoints.hpp @@ -5,11 +5,11 @@ namespace op { - void scaleKeyPoints(Array& keyPoints, const double scale); + void scaleKeyPoints(Array& keyPoints, const float scale); - void scaleKeyPoints(Array& keyPoints, const double scaleX, const double scaleY); + void scaleKeyPoints(Array& keyPoints, const float scaleX, const float scaleY); - void scaleKeyPoints(Array& keyPoints, const double scaleX, const double scaleY, const double offsetX, const double offsetY); + void scaleKeyPoints(Array& keyPoints, const float scaleX, const float scaleY, const float offsetX, const float offsetY); } #endif // OPENPOSE__CORE__SCALE_KEY_POINTS_HPP diff --git a/include/openpose/core/wCvMatToOpInput.hpp b/include/openpose/core/wCvMatToOpInput.hpp index a815af60..917f6726 100644 --- a/include/openpose/core/wCvMatToOpInput.hpp +++ b/include/openpose/core/wCvMatToOpInput.hpp @@ -3,7 +3,7 @@ #include // std::shared_ptr #include -#include "../thread/worker.hpp" +#include #include "cvMatToOpInput.hpp" namespace op @@ -30,11 +30,11 @@ namespace op // Implementation -#include "../utilities/errorAndLog.hpp" -#include "../utilities/macros.hpp" -#include "../utilities/openCv.hpp" -#include "../utilities/pointerContainer.hpp" -#include "../utilities/profiler.hpp" +#include +#include +#include +#include +#include namespace op { template diff --git a/include/openpose/core/wCvMatToOpOutput.hpp b/include/openpose/core/wCvMatToOpOutput.hpp index 9aadbb96..1ff63fe0 100644 --- a/include/openpose/core/wCvMatToOpOutput.hpp +++ b/include/openpose/core/wCvMatToOpOutput.hpp @@ -3,7 +3,7 @@ #include // std::shared_ptr #include -#include "../thread/worker.hpp" +#include #include "cvMatToOpOutput.hpp" namespace op @@ -30,11 +30,11 @@ namespace op // Implementation -#include "../utilities/errorAndLog.hpp" -#include "../utilities/macros.hpp" -#include "../utilities/openCv.hpp" -#include "../utilities/pointerContainer.hpp" -#include "../utilities/profiler.hpp" +#include +#include +#include +#include +#include namespace op { template diff --git a/include/openpose/core/wKeyPointScaler.hpp b/include/openpose/core/wKeyPointScaler.hpp index f5afa7ab..831e2fdf 100644 --- a/include/openpose/core/wKeyPointScaler.hpp +++ b/include/openpose/core/wKeyPointScaler.hpp @@ -1,7 +1,7 @@ #ifndef OPENPOSE__CORE__W_KEY_POINT_SCALER_HPP #define OPENPOSE__CORE__W_KEY_POINT_SCALER_HPP -#include "../thread/worker.hpp" +#include #include "keyPointScaler.hpp" #include "scaleKeyPoints.hpp" @@ -27,10 +27,10 @@ namespace op // Implementation -#include "../utilities/errorAndLog.hpp" -#include "../utilities/macros.hpp" -#include "../utilities/pointerContainer.hpp" -#include "../utilities/profiler.hpp" +#include +#include +#include +#include namespace op { template @@ -59,7 +59,7 @@ namespace op for (auto& tDatum : *tDatums) { std::vector> arraysToScale{tDatum.poseKeyPoints, tDatum.handKeyPoints, tDatum.faceKeyPoints}; - spKeyPointScaler->scale(arraysToScale, tDatum.scaleInputToOutput, tDatum.scaleNetToOutput, tDatum.cvInputData.size()); + spKeyPointScaler->scale(arraysToScale, (float)tDatum.scaleInputToOutput, (float)tDatum.scaleNetToOutput, tDatum.cvInputData.size()); } // Profiling speed Profiler::timerEnd(profilerKey); diff --git a/include/openpose/core/wOpOutputToCvMat.hpp b/include/openpose/core/wOpOutputToCvMat.hpp index d91e20f0..513e8012 100644 --- a/include/openpose/core/wOpOutputToCvMat.hpp +++ b/include/openpose/core/wOpOutputToCvMat.hpp @@ -3,7 +3,7 @@ #include // std::shared_ptr #include -#include "../thread/worker.hpp" +#include #include "opOutputToCvMat.hpp" namespace op @@ -31,10 +31,10 @@ namespace op // Implementation #include -#include "../utilities/errorAndLog.hpp" -#include "../utilities/macros.hpp" -#include "../utilities/pointerContainer.hpp" -#include "../utilities/profiler.hpp" +#include +#include +#include +#include namespace op { template diff --git a/include/openpose/experimental/face/faceExtractor.hpp b/include/openpose/experimental/face/faceExtractor.hpp index b298313a..8c6a96ef 100644 --- a/include/openpose/experimental/face/faceExtractor.hpp +++ b/include/openpose/experimental/face/faceExtractor.hpp @@ -6,11 +6,11 @@ #include // std::shared_ptr #include #include -#include "../../core/array.hpp" -#include "../../core/net.hpp" -#include "../../core/nmsCaffe.hpp" -#include "../../core/resizeAndMergeCaffe.hpp" -#include "../../pose/enumClasses.hpp" +#include +#include +#include +#include +#include #include "enumClasses.hpp" namespace op @@ -37,12 +37,12 @@ namespace op private: const cv::Size mNetOutputSize; const cv::Size mOutputSize; - const unsigned char mNeck; - const unsigned char mNose; - const unsigned char mLEar; - const unsigned char mREar; - const unsigned char mLEye; - const unsigned char mREye; + const unsigned int mNeck; + const unsigned int mNose; + const unsigned int mLEar; + const unsigned int mREar; + const unsigned int mLEye; + const unsigned int mREye; std::array, (int)FaceProperty::Size> mProperties; std::shared_ptr spNet; std::shared_ptr> spResizeAndMergeCaffe; diff --git a/include/openpose/experimental/face/faceParameters.hpp b/include/openpose/experimental/face/faceParameters.hpp index 9c58b057..6f2ec346 100644 --- a/include/openpose/experimental/face/faceParameters.hpp +++ b/include/openpose/experimental/face/faceParameters.hpp @@ -2,7 +2,7 @@ #define OPENPOSE__FACE__FACE_PARAMETERS_HPP #include "enumClasses.hpp" -#include "../../pose/poseParameters.hpp" +#include namespace op { diff --git a/include/openpose/experimental/face/faceRenderer.hpp b/include/openpose/experimental/face/faceRenderer.hpp index d366b708..102af65c 100644 --- a/include/openpose/experimental/face/faceRenderer.hpp +++ b/include/openpose/experimental/face/faceRenderer.hpp @@ -2,9 +2,9 @@ #define OPENPOSE__FACE__FACE_RENDERER_HPP #include -#include "../../core/array.hpp" -#include "../../core/renderer.hpp" -#include "../../thread/worker.hpp" +#include +#include +#include namespace op { diff --git a/include/openpose/experimental/face/wFaceExtractor.hpp b/include/openpose/experimental/face/wFaceExtractor.hpp index dc3a8afc..06b6addc 100644 --- a/include/openpose/experimental/face/wFaceExtractor.hpp +++ b/include/openpose/experimental/face/wFaceExtractor.hpp @@ -2,7 +2,7 @@ #define OPENPOSE__FACE__W_FACE_EXTRACTOR_HPP #include // std::shared_ptr -#include "../../thread/worker.hpp" +#include #include "faceRenderer.hpp" namespace op @@ -32,10 +32,10 @@ namespace op // Implementation -#include "../../utilities/errorAndLog.hpp" -#include "../../utilities/macros.hpp" -#include "../../utilities/pointerContainer.hpp" -#include "../../utilities/profiler.hpp" +#include +#include +#include +#include namespace op { namespace experimental diff --git a/include/openpose/experimental/face/wFaceRenderer.hpp b/include/openpose/experimental/face/wFaceRenderer.hpp index a871843a..07eeb71d 100644 --- a/include/openpose/experimental/face/wFaceRenderer.hpp +++ b/include/openpose/experimental/face/wFaceRenderer.hpp @@ -2,7 +2,7 @@ #define OPENPOSE__FACE__W_FACE_RENDERER_HPP #include // std::shared_ptr -#include "../../thread/worker.hpp" +#include #include "faceRenderer.hpp" namespace op @@ -32,10 +32,10 @@ namespace op // Implementation -#include "../../utilities/errorAndLog.hpp" -#include "../../utilities/macros.hpp" -#include "../../utilities/pointerContainer.hpp" -#include "../../utilities/profiler.hpp" +#include +#include +#include +#include namespace op { namespace experimental diff --git a/include/openpose/experimental/filestream/wPoseJsonCocoSaver.hpp b/include/openpose/experimental/filestream/wPoseJsonCocoSaver.hpp index f1ecdc72..b3c1bf53 100644 --- a/include/openpose/experimental/filestream/wPoseJsonCocoSaver.hpp +++ b/include/openpose/experimental/filestream/wPoseJsonCocoSaver.hpp @@ -5,8 +5,8 @@ #define OPENPOSE__EXPERIMENTAL__FILESTREAM__W_POSE_JSON_COCO_SAVER_HPP #include // std::shared_ptr -#include "../../filestream/poseJsonCocoSaver.hpp" -#include "../../thread/workerConsumer.hpp" +#include +#include namespace op { @@ -35,10 +35,10 @@ namespace op // Implementation -#include "../../utilities/errorAndLog.hpp" -#include "../../utilities/macros.hpp" -#include "../../utilities/pointerContainer.hpp" -#include "../../utilities/profiler.hpp" +#include +#include +#include +#include namespace op { namespace experimental diff --git a/include/openpose/experimental/hand/enumClasses.hpp b/include/openpose/experimental/hand/enumClasses.hpp index 3f77c73e..4b81d924 100644 --- a/include/openpose/experimental/hand/enumClasses.hpp +++ b/include/openpose/experimental/hand/enumClasses.hpp @@ -11,4 +11,3 @@ namespace op } #endif // OPENPOSE__HAND__ENUM_CLASSES_HPP - diff --git a/include/openpose/experimental/hand/handExtractor.hpp b/include/openpose/experimental/hand/handExtractor.hpp index be5187af..4c8a4f74 100644 --- a/include/openpose/experimental/hand/handExtractor.hpp +++ b/include/openpose/experimental/hand/handExtractor.hpp @@ -6,11 +6,11 @@ #include // std::shared_ptr #include #include -#include "../../core/array.hpp" -#include "../../core/net.hpp" -#include "../../core/nmsCaffe.hpp" -#include "../../core/resizeAndMergeCaffe.hpp" -#include "../../pose/enumClasses.hpp" +#include +#include +#include +#include +#include #include "enumClasses.hpp" namespace op @@ -37,12 +37,12 @@ namespace op private: const cv::Size mNetOutputSize; const cv::Size mOutputSize; - const unsigned char mRWrist; - const unsigned char mRElbow; - const unsigned char mLWrist; - const unsigned char mLElbow; - const unsigned char mNeck; - const unsigned char mHeadNose; + const unsigned int mRWrist; + const unsigned int mRElbow; + const unsigned int mLWrist; + const unsigned int mLElbow; + const unsigned int mNeck; + const unsigned int mHeadNose; std::array, (int)HandsProperty::Size> mProperties; std::shared_ptr spNet; std::shared_ptr> spResizeAndMergeCaffe; diff --git a/include/openpose/experimental/hand/handParameters.hpp b/include/openpose/experimental/hand/handParameters.hpp index 9b6a2a98..f73c804b 100644 --- a/include/openpose/experimental/hand/handParameters.hpp +++ b/include/openpose/experimental/hand/handParameters.hpp @@ -2,7 +2,7 @@ #define OPENPOSE__HAND__HAND_PARAMETERS_HPP #include "enumClasses.hpp" -#include "../../pose/poseParameters.hpp" +#include namespace op { diff --git a/include/openpose/experimental/hand/handRenderer.hpp b/include/openpose/experimental/hand/handRenderer.hpp index 139513f8..fa689de2 100644 --- a/include/openpose/experimental/hand/handRenderer.hpp +++ b/include/openpose/experimental/hand/handRenderer.hpp @@ -2,9 +2,9 @@ #define OPENPOSE__HAND__HAND_RENDERER_HPP #include -#include "../../core/array.hpp" -#include "../../core/renderer.hpp" -#include "../../thread/worker.hpp" +#include +#include +#include namespace op { diff --git a/include/openpose/experimental/hand/wHandExtractor.hpp b/include/openpose/experimental/hand/wHandExtractor.hpp index 0dc07f93..56fa5f0b 100644 --- a/include/openpose/experimental/hand/wHandExtractor.hpp +++ b/include/openpose/experimental/hand/wHandExtractor.hpp @@ -2,7 +2,7 @@ #define OPENPOSE__HAND__W_HAND_EXTRACTOR_HPP #include // std::shared_ptr -#include "../../thread/worker.hpp" +#include #include "handRenderer.hpp" namespace op @@ -32,10 +32,10 @@ namespace op // Implementation -#include "../../utilities/errorAndLog.hpp" -#include "../../utilities/macros.hpp" -#include "../../utilities/pointerContainer.hpp" -#include "../../utilities/profiler.hpp" +#include +#include +#include +#include namespace op { namespace experimental diff --git a/include/openpose/experimental/hand/wHandRenderer.hpp b/include/openpose/experimental/hand/wHandRenderer.hpp index 7931dede..f520bbe8 100644 --- a/include/openpose/experimental/hand/wHandRenderer.hpp +++ b/include/openpose/experimental/hand/wHandRenderer.hpp @@ -2,7 +2,7 @@ #define OPENPOSE__HAND__W_HAND_RENDERER_HPP #include // std::shared_ptr -#include "../../thread/worker.hpp" +#include #include "handRenderer.hpp" namespace op @@ -32,10 +32,10 @@ namespace op // Implementation -#include "../../utilities/errorAndLog.hpp" -#include "../../utilities/macros.hpp" -#include "../../utilities/pointerContainer.hpp" -#include "../../utilities/profiler.hpp" +#include +#include +#include +#include namespace op { namespace experimental diff --git a/include/openpose/filestream/fileSaver.hpp b/include/openpose/filestream/fileSaver.hpp index 6ce106d3..999d06ad 100644 --- a/include/openpose/filestream/fileSaver.hpp +++ b/include/openpose/filestream/fileSaver.hpp @@ -2,7 +2,7 @@ #define OPENPOSE__FILESTREAM__DATA_SAVER_HPP #include -#include "../utilities/string.hpp" +#include namespace op { diff --git a/include/openpose/filestream/fileStream.hpp b/include/openpose/filestream/fileStream.hpp index e6a81f02..9b3aba31 100644 --- a/include/openpose/filestream/fileStream.hpp +++ b/include/openpose/filestream/fileStream.hpp @@ -5,7 +5,7 @@ #include #include // cv::Mat, cv::Size #include // CV_LOAD_IMAGE_ANYDEPTH, CV_IMWRITE_PNG_COMPRESSION -#include "../core/array.hpp" +#include #include "enumClasses.hpp" namespace op diff --git a/include/openpose/filestream/jsonOfstream.hpp b/include/openpose/filestream/jsonOfstream.hpp index 67b0d46c..128485bd 100644 --- a/include/openpose/filestream/jsonOfstream.hpp +++ b/include/openpose/filestream/jsonOfstream.hpp @@ -3,7 +3,7 @@ #include // std::ofstream #include -#include "../utilities/macros.hpp" +#include namespace op { diff --git a/include/openpose/filestream/poseJsonCocoSaver.hpp b/include/openpose/filestream/poseJsonCocoSaver.hpp index 48af8e50..ed7a1ec6 100644 --- a/include/openpose/filestream/poseJsonCocoSaver.hpp +++ b/include/openpose/filestream/poseJsonCocoSaver.hpp @@ -2,8 +2,8 @@ #define OPENPOSE__FILESTREAM__POSE_JSON_COCO_SAVER_HPP #include -#include "../core/array.hpp" -#include "../utilities/macros.hpp" +#include +#include #include "jsonOfstream.hpp" namespace op @@ -22,7 +22,7 @@ namespace op ~PoseJsonCocoSaver(); - void record(const Array& poseKeyPoints, const int imageId); + void record(const Array& poseKeyPoints, const unsigned long long imageId); private: JsonOfstream mJsonOfstream; diff --git a/include/openpose/filestream/poseJsonSaver.hpp b/include/openpose/filestream/poseJsonSaver.hpp index b09d12d2..802e18de 100644 --- a/include/openpose/filestream/poseJsonSaver.hpp +++ b/include/openpose/filestream/poseJsonSaver.hpp @@ -3,7 +3,7 @@ #include #include -#include "../core/array.hpp" +#include #include "fileSaver.hpp" namespace op diff --git a/include/openpose/filestream/poseSaver.hpp b/include/openpose/filestream/poseSaver.hpp index 28181721..73e8c5ba 100644 --- a/include/openpose/filestream/poseSaver.hpp +++ b/include/openpose/filestream/poseSaver.hpp @@ -1,7 +1,7 @@ #ifndef OPENPOSE__FILESTREAM__POSE_SAVER_HPP #define OPENPOSE__FILESTREAM__POSE_SAVER_HPP -#include "../core/array.hpp" +#include #include "enumClasses.hpp" #include "fileSaver.hpp" diff --git a/include/openpose/filestream/videoSaver.hpp b/include/openpose/filestream/videoSaver.hpp index 1e5d3192..50fea451 100644 --- a/include/openpose/filestream/videoSaver.hpp +++ b/include/openpose/filestream/videoSaver.hpp @@ -4,7 +4,7 @@ #include #include #include // cv::VideoWriter -#include "../utilities/macros.hpp" +#include namespace op { diff --git a/include/openpose/filestream/wHeatMapSaver.hpp b/include/openpose/filestream/wHeatMapSaver.hpp index 80f15272..a0fef902 100644 --- a/include/openpose/filestream/wHeatMapSaver.hpp +++ b/include/openpose/filestream/wHeatMapSaver.hpp @@ -3,7 +3,7 @@ #include // std::shared_ptr #include -#include "../thread/workerConsumer.hpp" +#include #include "heatMapSaver.hpp" namespace op @@ -32,10 +32,10 @@ namespace op // Implementation #include #include -#include "../utilities/errorAndLog.hpp" -#include "../utilities/macros.hpp" -#include "../utilities/pointerContainer.hpp" -#include "../utilities/profiler.hpp" +#include +#include +#include +#include namespace op { template diff --git a/include/openpose/filestream/wImageSaver.hpp b/include/openpose/filestream/wImageSaver.hpp index f4365659..ab183c1e 100644 --- a/include/openpose/filestream/wImageSaver.hpp +++ b/include/openpose/filestream/wImageSaver.hpp @@ -3,7 +3,7 @@ #include // std::shared_ptr #include -#include "../thread/workerConsumer.hpp" +#include #include "imageSaver.hpp" namespace op @@ -32,10 +32,10 @@ namespace op // Implementation #include #include -#include "../utilities/errorAndLog.hpp" -#include "../utilities/macros.hpp" -#include "../utilities/pointerContainer.hpp" -#include "../utilities/profiler.hpp" +#include +#include +#include +#include namespace op { template diff --git a/include/openpose/filestream/wPoseJsonSaver.hpp b/include/openpose/filestream/wPoseJsonSaver.hpp index c430d3e7..9a1b65eb 100644 --- a/include/openpose/filestream/wPoseJsonSaver.hpp +++ b/include/openpose/filestream/wPoseJsonSaver.hpp @@ -3,7 +3,7 @@ #include // std::shared_ptr #include -#include "../thread/workerConsumer.hpp" +#include #include "poseJsonSaver.hpp" namespace op @@ -30,10 +30,10 @@ namespace op // Implementation -#include "../utilities/errorAndLog.hpp" -#include "../utilities/macros.hpp" -#include "../utilities/pointerContainer.hpp" -#include "../utilities/profiler.hpp" +#include +#include +#include +#include namespace op { template diff --git a/include/openpose/filestream/wPoseSaver.hpp b/include/openpose/filestream/wPoseSaver.hpp index 6f445cd3..78352e17 100644 --- a/include/openpose/filestream/wPoseSaver.hpp +++ b/include/openpose/filestream/wPoseSaver.hpp @@ -3,7 +3,7 @@ #include // std::shared_ptr #include -#include "../thread/workerConsumer.hpp" +#include #include "enumClasses.hpp" #include "poseSaver.hpp" @@ -31,10 +31,10 @@ namespace op // Implementation -#include "../utilities/errorAndLog.hpp" -#include "../utilities/macros.hpp" -#include "../utilities/pointerContainer.hpp" -#include "../utilities/profiler.hpp" +#include +#include +#include +#include namespace op { template diff --git a/include/openpose/filestream/wVideoSaver.hpp b/include/openpose/filestream/wVideoSaver.hpp index 42689616..a330fbec 100644 --- a/include/openpose/filestream/wVideoSaver.hpp +++ b/include/openpose/filestream/wVideoSaver.hpp @@ -5,7 +5,7 @@ #include #include #include -#include "../thread/workerConsumer.hpp" +#include #include "videoSaver.hpp" namespace op @@ -32,10 +32,10 @@ namespace op // Implementation -#include "../utilities/errorAndLog.hpp" -#include "../utilities/macros.hpp" -#include "../utilities/pointerContainer.hpp" -#include "../utilities/profiler.hpp" +#include +#include +#include +#include namespace op { template diff --git a/include/openpose/gui/gui.hpp b/include/openpose/gui/gui.hpp index 77ef4570..98e5de5f 100644 --- a/include/openpose/gui/gui.hpp +++ b/include/openpose/gui/gui.hpp @@ -4,8 +4,8 @@ #include #include // std::shared_ptr #include -#include "../pose/poseExtractor.hpp" -#include "../pose/poseRenderer.hpp" +#include +#include #include "enumClasses.hpp" #include "frameDisplayer.hpp" diff --git a/include/openpose/gui/guiInfoAdder.hpp b/include/openpose/gui/guiInfoAdder.hpp index c9fe6d93..f6179ae8 100644 --- a/include/openpose/gui/guiInfoAdder.hpp +++ b/include/openpose/gui/guiInfoAdder.hpp @@ -3,7 +3,7 @@ #include #include -#include "../core/array.hpp" +#include namespace op { diff --git a/include/openpose/gui/wGui.hpp b/include/openpose/gui/wGui.hpp index f0357ad6..e57c2949 100644 --- a/include/openpose/gui/wGui.hpp +++ b/include/openpose/gui/wGui.hpp @@ -3,7 +3,7 @@ #include // std::shared_ptr #include -#include "../thread/workerConsumer.hpp" +#include #include "enumClasses.hpp" #include "gui.hpp" @@ -31,10 +31,10 @@ namespace op // Implementation -#include "../utilities/errorAndLog.hpp" -#include "../utilities/macros.hpp" -#include "../utilities/pointerContainer.hpp" -#include "../utilities/profiler.hpp" +#include +#include +#include +#include namespace op { template diff --git a/include/openpose/gui/wGuiInfoAdder.hpp b/include/openpose/gui/wGuiInfoAdder.hpp index 13f2a36c..05eee471 100644 --- a/include/openpose/gui/wGuiInfoAdder.hpp +++ b/include/openpose/gui/wGuiInfoAdder.hpp @@ -2,7 +2,7 @@ #define OPENPOSE__GUI__W_ADD_GUI_INFO_HPP #include "guiInfoAdder.hpp" -#include "../thread/worker.hpp" +#include namespace op { @@ -28,10 +28,10 @@ namespace op // Implementation -#include "../utilities/errorAndLog.hpp" -#include "../utilities/macros.hpp" -#include "../utilities/pointerContainer.hpp" -#include "../utilities/profiler.hpp" +#include +#include +#include +#include namespace op { template diff --git a/include/openpose/pose/bodyPartConnectorBase.hpp b/include/openpose/pose/bodyPartConnectorBase.hpp index 1296a54b..347ed677 100644 --- a/include/openpose/pose/bodyPartConnectorBase.hpp +++ b/include/openpose/pose/bodyPartConnectorBase.hpp @@ -1,7 +1,7 @@ #ifndef OPENPOSE__POSE__BODY_PARTS_CONNECTOR_HPP #define OPENPOSE__POSE__BODY_PARTS_CONNECTOR_HPP -#include "../core/array.hpp" +#include #include "enumClasses.hpp" namespace op diff --git a/include/openpose/pose/bodyPartConnectorCaffe.hpp b/include/openpose/pose/bodyPartConnectorCaffe.hpp index d5d0856b..5f483969 100644 --- a/include/openpose/pose/bodyPartConnectorCaffe.hpp +++ b/include/openpose/pose/bodyPartConnectorCaffe.hpp @@ -4,8 +4,8 @@ #include #include -#include "../core/array.hpp" -#include "../utilities/macros.hpp" +#include +#include #include "enumClasses.hpp" namespace op diff --git a/include/openpose/pose/poseExtractor.hpp b/include/openpose/pose/poseExtractor.hpp index 1830b907..7965dd7b 100644 --- a/include/openpose/pose/poseExtractor.hpp +++ b/include/openpose/pose/poseExtractor.hpp @@ -5,10 +5,10 @@ #include #include #include -#include "../core/array.hpp" -#include "../utilities/macros.hpp" +#include +#include +#include #include "poseParameters.hpp" -#include "../core/enumClasses.hpp" namespace op { @@ -18,6 +18,8 @@ namespace op PoseExtractor(const cv::Size& netOutputSize, const cv::Size& outputSize, const PoseModel poseModel, const std::vector& heatMapTypes = {}, const ScaleMode heatMapScaleMode = ScaleMode::ZeroToOne); + virtual ~PoseExtractor(); + void initializationOnThread(); virtual void forwardPass(const Array& inputNetData, const cv::Size& inputDataSize) = 0; @@ -45,7 +47,7 @@ namespace op const cv::Size mNetOutputSize; const cv::Size mOutputSize; Array mPoseKeyPoints; - double mScaleNetToOutput; + float mScaleNetToOutput; void checkThread() const; diff --git a/include/openpose/pose/poseExtractorCaffe.hpp b/include/openpose/pose/poseExtractorCaffe.hpp index a29457a8..34ba8bb9 100644 --- a/include/openpose/pose/poseExtractorCaffe.hpp +++ b/include/openpose/pose/poseExtractorCaffe.hpp @@ -5,11 +5,11 @@ #include // std::shared_ptr #include #include -#include "../core/array.hpp" -#include "../core/net.hpp" -#include "../core/nmsCaffe.hpp" -#include "../core/resizeAndMergeCaffe.hpp" -#include "../utilities/macros.hpp" +#include +#include +#include +#include +#include #include "bodyPartConnectorCaffe.hpp" #include "enumClasses.hpp" #include "poseExtractor.hpp" @@ -23,6 +23,8 @@ namespace op const float scaleGap, const PoseModel poseModel, const std::string& modelFolder, const int gpuId, const std::vector& heatMapTypes = {}, const ScaleMode heatMapScaleMode = ScaleMode::ZeroToOne); + virtual ~PoseExtractorCaffe(); + void netInitializationOnThread(); void forwardPass(const Array& inputNetData, const cv::Size& inputDataSize); diff --git a/include/openpose/pose/poseParameters.hpp b/include/openpose/pose/poseParameters.hpp index 33244cad..9ab656b1 100644 --- a/include/openpose/pose/poseParameters.hpp +++ b/include/openpose/pose/poseParameters.hpp @@ -10,7 +10,7 @@ namespace op { // Model-Dependent Parameters // #define when needed in CUDA code - const std::map POSE_COCO_BODY_PARTS { + const std::map POSE_COCO_BODY_PARTS { {0, "Nose"}, {1, "Neck"}, {2, "RShoulder"}, @@ -31,12 +31,12 @@ namespace op {17, "LEar"}, {18, "Background"} }; - const unsigned char POSE_COCO_NUMBER_PARTS = 18; // Equivalent to size of std::map POSE_COCO_BODY_PARTS - 1 (removing background) - const std::vector POSE_COCO_MAP_IDX {31,32, 39,40, 33,34, 35,36, 41,42, 43,44, 19,20, 21,22, 23,24, 25,26, 27,28, 29,30, 47,48, 49,50, 53,54, 51,52, 55,56, 37,38, 45,46}; - const std::vector POSE_COCO_PAIRS {1,2, 1,5, 2,3, 3,4, 5,6, 6,7, 1,8, 8,9, 9,10, 1,11, 11,12, 12,13, 1,0, 0,14, 14,16, 0,15, 15,17, 2,16, 5,17}; + const unsigned int POSE_COCO_NUMBER_PARTS = 18u; // Equivalent to size of std::map POSE_COCO_BODY_PARTS - 1 (removing background) + const std::vector POSE_COCO_MAP_IDX {31,32, 39,40, 33,34, 35,36, 41,42, 43,44, 19,20, 21,22, 23,24, 25,26, 27,28, 29,30, 47,48, 49,50, 53,54, 51,52, 55,56, 37,38, 45,46}; + const std::vector POSE_COCO_PAIRS {1,2, 1,5, 2,3, 3,4, 5,6, 6,7, 1,8, 8,9, 9,10, 1,11, 11,12, 12,13, 1,0, 0,14, 14,16, 0,15, 15,17, 2,16, 5,17}; #define POSE_COCO_PAIRS_TO_RENDER {1,2, 1,5, 2,3, 3,4, 5,6, 6,7, 1,8, 8,9, 9,10, 1,11, 11,12, 12,13, 1,0, 0,14, 14,16, 0,15, 15,17} - const std::map POSE_MPI_BODY_PARTS{ + const std::map POSE_MPI_BODY_PARTS{ {0, "Head"}, {1, "Neck"}, {2, "RShoulder"}, @@ -54,20 +54,20 @@ namespace op {14, "Chest"}, {15, "Background"} }; - const unsigned char POSE_MPI_NUMBER_PARTS = 15; // Equivalent to size of std::map POSE_MPI_NUMBER_PARTS - 1 (removing background) - const std::vector POSE_MPI_MAP_IDX {16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 38, 39, 40, 41, 42, 43, 32, 33, 34, 35, 36, 37}; - const std::vector POSE_MPI_PAIRS {0,1, 1,2, 2,3, 3,4, 1,5, 5,6, 6,7, 1,14, 14,11, 11,12, 12,13, 14,8, 8,9, 9,10}; + const unsigned int POSE_MPI_NUMBER_PARTS = 15; // Equivalent to size of std::map POSE_MPI_NUMBER_PARTS - 1 (removing background) + const std::vector POSE_MPI_MAP_IDX {16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 38, 39, 40, 41, 42, 43, 32, 33, 34, 35, 36, 37}; + const std::vector POSE_MPI_PAIRS {0,1, 1,2, 2,3, 3,4, 1,5, 5,6, 6,7, 1,14, 14,11, 11,12, 12,13, 14,8, 8,9, 9,10}; #define POSE_MPI_PAIRS_TO_RENDER {0,1, 2,3, 3,4, 5,6, 6,7, 11,12, 12,13, 8,9, 9,10} // Constant Global Parameters - const unsigned char POSE_MAX_PEOPLE = 96; + const unsigned int POSE_MAX_PEOPLE = 96u; // Constant Array Parameters const std::array POSE_CCN_DECREASE_FACTOR{ 8.f, 8.f, 8.f}; const std::array POSE_MAX_PEAKS{ POSE_MAX_PEOPLE, POSE_MAX_PEOPLE, POSE_MAX_PEOPLE}; - const std::array POSE_NUMBER_BODY_PARTS{ POSE_COCO_NUMBER_PARTS, POSE_MPI_NUMBER_PARTS, POSE_MPI_NUMBER_PARTS}; - const std::array, 3> POSE_BODY_PART_PAIRS{ POSE_COCO_PAIRS, POSE_MPI_PAIRS, POSE_MPI_PAIRS}; - const std::array, 3> POSE_MAP_IDX{ POSE_COCO_MAP_IDX, POSE_MPI_MAP_IDX, POSE_MPI_MAP_IDX}; + const std::array POSE_NUMBER_BODY_PARTS{ POSE_COCO_NUMBER_PARTS, POSE_MPI_NUMBER_PARTS, POSE_MPI_NUMBER_PARTS}; + const std::array, 3> POSE_BODY_PART_PAIRS{ POSE_COCO_PAIRS, POSE_MPI_PAIRS, POSE_MPI_PAIRS}; + const std::array, 3> POSE_MAP_IDX{ POSE_COCO_MAP_IDX, POSE_MPI_MAP_IDX, POSE_MPI_MAP_IDX}; const std::array POSE_PROTOTXT{ "pose/coco/pose_deploy_linevec.prototxt", "pose/mpi/pose_deploy_linevec.prototxt", "pose/mpi/pose_deploy_linevec_faster_4_stages.prototxt"}; @@ -76,15 +76,15 @@ namespace op "pose/mpi/pose_iter_160000.caffemodel"}; // POSE_BODY_PART_MAPPING crashes on Windows at dynamic initialization, to avoid this crash: // POSE_BODY_PART_MAPPING has been moved to poseParameters.cpp and getPoseBodyPartMapping() wraps it - //const std::array, 3> POSE_BODY_PART_MAPPING{ POSE_COCO_BODY_PARTS, POSE_MPI_BODY_PARTS, POSE_MPI_BODY_PARTS}; - const std::map& getPoseBodyPartMapping(const PoseModel poseModel); + //const std::array, 3> POSE_BODY_PART_MAPPING{ POSE_COCO_BODY_PARTS, POSE_MPI_BODY_PARTS, POSE_MPI_BODY_PARTS}; + const std::map& getPoseBodyPartMapping(const PoseModel poseModel); // Default Model Parameters // They might be modified on running time const std::array POSE_DEFAULT_NMS_THRESHOLD{ 0.05f, 0.6f, 0.3f}; - const std::array POSE_DEFAULT_CONNECT_INTER_MIN_ABOVE_THRESHOLD{ 9, 8, 8}; + const std::array POSE_DEFAULT_CONNECT_INTER_MIN_ABOVE_THRESHOLD{ 9, 8, 8}; const std::array POSE_DEFAULT_CONNECT_INTER_THRESHOLD{ 0.05f, 0.01f, 0.01f}; - const std::array POSE_DEFAULT_CONNECT_MIN_SUBSET_CNT{ 3, 3, 3}; + const std::array POSE_DEFAULT_CONNECT_MIN_SUBSET_CNT{ 3, 3, 3}; const std::array POSE_DEFAULT_CONNECT_MIN_SUBSET_SCORE{ 0.4f, 0.4f, 0.4f}; // Rendering default parameters @@ -92,8 +92,8 @@ namespace op const auto POSE_DEFAULT_ALPHA_HEATMAP = 0.7f; // Auxiliary functions - unsigned char poseBodyPartMapStringToKey(const PoseModel poseModel, const std::string& string); - unsigned char poseBodyPartMapStringToKey(const PoseModel poseModel, const std::vector& strings); + unsigned int poseBodyPartMapStringToKey(const PoseModel poseModel, const std::string& string); + unsigned int poseBodyPartMapStringToKey(const PoseModel poseModel, const std::vector& strings); } #endif // OPENPOSE__POSE__POSE_PARAMETERS_HPP diff --git a/include/openpose/pose/poseRenderGpu.hpp b/include/openpose/pose/poseRenderGpu.hpp index 2f55621e..34d776be 100644 --- a/include/openpose/pose/poseRenderGpu.hpp +++ b/include/openpose/pose/poseRenderGpu.hpp @@ -8,7 +8,7 @@ namespace op { void renderPoseGpu(float* framePtr, const PoseModel poseModel, const int numberPeople, const cv::Size& frameSize, const float* const posePtr, - const bool googlyEyes = false, const float blendOriginalFrame = true, const float alphaBlending = POSE_DEFAULT_ALPHA_POSE); + const bool googlyEyes = false, const bool blendOriginalFrame = true, const float alphaBlending = POSE_DEFAULT_ALPHA_POSE); void renderBodyPartGpu(float* frame, const PoseModel poseModel, const cv::Size& frameSize, const float* const heatmap, const cv::Size& heatmapSize, const float scaleToKeepRatio, const int part, const float alphaBlending = POSE_DEFAULT_ALPHA_HEATMAP); void renderBodyPartsGpu(float* frame, const PoseModel poseModel, const cv::Size& frameSize, const float* const heatmap, const cv::Size& heatmapSize, diff --git a/include/openpose/pose/poseRenderer.hpp b/include/openpose/pose/poseRenderer.hpp index 3783e8cf..2f1955df 100644 --- a/include/openpose/pose/poseRenderer.hpp +++ b/include/openpose/pose/poseRenderer.hpp @@ -3,9 +3,9 @@ #include // std::shared_ptr #include -#include "../core/array.hpp" -#include "../core/renderer.hpp" -#include "../utilities/macros.hpp" +#include +#include +#include #include "poseExtractor.hpp" #include "poseParameters.hpp" @@ -16,7 +16,7 @@ namespace op public: explicit PoseRenderer(const cv::Size& heatMapsSize, const cv::Size& outputSize, const PoseModel poseModel, const std::shared_ptr& poseExtractor, const bool blendOriginalFrame = true, const float alphaPose = POSE_DEFAULT_ALPHA_POSE, - const float alphaHeatMap = POSE_DEFAULT_ALPHA_HEATMAP, const int elementToRender = 0); + const float alphaHeatMap = POSE_DEFAULT_ALPHA_HEATMAP, const unsigned int elementToRender = 0u); ~PoseRenderer(); @@ -42,20 +42,20 @@ namespace op void setShowGooglyEyes(const bool showGooglyEyes); - std::pair renderPose(Array& outputData, const Array& poseKeyPoints, const double scaleNetToOutput = -1.); + std::pair renderPose(Array& outputData, const Array& poseKeyPoints, const float scaleNetToOutput = -1.f); private: const cv::Size mHeatMapsSize; const cv::Size mOutputSize; const PoseModel mPoseModel; - const std::map mPartIndexToName; + const std::map mPartIndexToName; const int mNumberElementsToRender; const std::shared_ptr spPoseExtractor; float mAlphaPose; float mAlphaHeatMap; std::atomic mBlendOriginalFrame; std::atomic mShowGooglyEyes; - std::atomic mElementToRender; + std::atomic mElementToRender; // Init with thread float* pGpuPose; // GPU aux memory diff --git a/include/openpose/pose/wPoseExtractor.hpp b/include/openpose/pose/wPoseExtractor.hpp index c1e0aad2..d173dd9e 100644 --- a/include/openpose/pose/wPoseExtractor.hpp +++ b/include/openpose/pose/wPoseExtractor.hpp @@ -2,7 +2,7 @@ #define OPENPOSE__POSE__W_POSE_EXTRACTOR_HPP #include // std::shared_ptr -#include "../thread/worker.hpp" +#include #include "poseExtractor.hpp" namespace op @@ -29,10 +29,10 @@ namespace op // Implementation -#include "../utilities/errorAndLog.hpp" -#include "../utilities/macros.hpp" -#include "../utilities/pointerContainer.hpp" -#include "../utilities/profiler.hpp" +#include +#include +#include +#include namespace op { template diff --git a/include/openpose/pose/wPoseRenderer.hpp b/include/openpose/pose/wPoseRenderer.hpp index 13aea92e..b02f5a2c 100644 --- a/include/openpose/pose/wPoseRenderer.hpp +++ b/include/openpose/pose/wPoseRenderer.hpp @@ -2,7 +2,7 @@ #define OPENPOSE__POSE__W_POSE_RENDERER_HPP #include // std::shared_ptr -#include "../thread/worker.hpp" +#include #include "poseRenderer.hpp" namespace op @@ -29,10 +29,10 @@ namespace op // Implementation -#include "../utilities/errorAndLog.hpp" -#include "../utilities/macros.hpp" -#include "../utilities/pointerContainer.hpp" -#include "../utilities/profiler.hpp" +#include +#include +#include +#include namespace op { template @@ -60,7 +60,7 @@ namespace op const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); // Render people pose for (auto& tDatum : *tDatums) - tDatum.elementRendered = spPoseRenderer->renderPose(tDatum.outputData, tDatum.poseKeyPoints, tDatum.scaleNetToOutput); + tDatum.elementRendered = spPoseRenderer->renderPose(tDatum.outputData, tDatum.poseKeyPoints, (float)tDatum.scaleNetToOutput); // Profiling speed Profiler::timerEnd(profilerKey); Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__, Profiler::DEFAULT_X); diff --git a/include/openpose/producer/datumProducer.hpp b/include/openpose/producer/datumProducer.hpp index d912fb45..3057342d 100644 --- a/include/openpose/producer/datumProducer.hpp +++ b/include/openpose/producer/datumProducer.hpp @@ -5,9 +5,9 @@ #include // std::numeric_limits #include // std::shared_ptr #include -#include "../core/datum.hpp" -#include "../producer/producer.hpp" -#include "../utilities/macros.hpp" +#include +#include +#include namespace op { @@ -55,7 +55,7 @@ namespace op try { if (spProducer->getType() != ProducerType::Webcam) - spProducer->set(CV_CAP_PROP_POS_FRAMES, frameFirst); + spProducer->set(CV_CAP_PROP_POS_FRAMES, (double)frameFirst); } catch (const std::exception& e) { diff --git a/include/openpose/producer/producer.hpp b/include/openpose/producer/producer.hpp index 490ab48d..bf9367a3 100644 --- a/include/openpose/producer/producer.hpp +++ b/include/openpose/producer/producer.hpp @@ -5,7 +5,7 @@ #include #include #include // capProperties of OpenCV -#include "../utilities/macros.hpp" +#include #include "enumClasses.hpp" namespace op diff --git a/include/openpose/producer/wDatumProducer.hpp b/include/openpose/producer/wDatumProducer.hpp index 43f34731..f54a19d6 100644 --- a/include/openpose/producer/wDatumProducer.hpp +++ b/include/openpose/producer/wDatumProducer.hpp @@ -3,7 +3,7 @@ #include // std::numeric_limits #include // std::shared_ptr -#include "../thread/workerProducer.hpp" +#include #include "datumProducer.hpp" namespace op @@ -31,10 +31,10 @@ namespace op // Implementation #include -#include "../utilities/errorAndLog.hpp" -#include "../utilities/macros.hpp" -#include "../utilities/profiler.hpp" -#include "../core/datum.hpp" +#include +#include +#include +#include namespace op { template diff --git a/include/openpose/thread/priorityQueue.hpp b/include/openpose/thread/priorityQueue.hpp index 3c2b7c24..a2b25380 100644 --- a/include/openpose/thread/priorityQueue.hpp +++ b/include/openpose/thread/priorityQueue.hpp @@ -2,7 +2,7 @@ #define OPENPOSE__THREAD__PRIORITY_QUEUE_HPP #include // std::priority_queue -#include "../utilities/macros.hpp" +#include #include "queueBase.hpp" namespace op @@ -28,8 +28,7 @@ namespace op // Implementation #include // std::is_same -#include "../utilities/errorAndLog.hpp" -#include "../utilities/macros.hpp" +#include namespace op { template diff --git a/include/openpose/thread/queue.hpp b/include/openpose/thread/queue.hpp index 7e9f9934..08a00d9f 100644 --- a/include/openpose/thread/queue.hpp +++ b/include/openpose/thread/queue.hpp @@ -2,7 +2,7 @@ #define OPENPOSE__THREAD__QUEUE_HPP #include // std::queue -#include "../utilities/macros.hpp" +#include #include "queueBase.hpp" namespace op @@ -29,8 +29,8 @@ namespace op // Implementation #include // std::is_same #include -#include "../utilities/errorAndLog.hpp" -#include "../utilities/macros.hpp" +#include +#include namespace op { template diff --git a/include/openpose/thread/queueBase.hpp b/include/openpose/thread/queueBase.hpp index e423e66a..2d7a47a8 100644 --- a/include/openpose/thread/queueBase.hpp +++ b/include/openpose/thread/queueBase.hpp @@ -4,7 +4,7 @@ #include // std::queue & std::priority_queue #include #include -#include "../utilities/macros.hpp" +#include namespace op { @@ -66,7 +66,7 @@ namespace op virtual bool pop(TDatums& tDatums) = 0; - long long getMaxSize() const; + unsigned long long getMaxSize() const; private: const long long mMaxSize; @@ -90,10 +90,10 @@ namespace op // Implementation #include // std::shared_ptr #include -#include "../core/datum.hpp" -#include "../utilities/errorAndLog.hpp" -#include "../utilities/fastMath.hpp" -#include "../utilities/macros.hpp" +#include +#include +#include +#include namespace op { template @@ -398,7 +398,7 @@ namespace op catch (const std::exception& e) { error(e.what(), __LINE__, __FUNCTION__, __FILE__); - return -1; + return 0; } } @@ -418,7 +418,7 @@ namespace op } template - long long QueueBase::getMaxSize() const + unsigned long long QueueBase::getMaxSize() const { try { diff --git a/include/openpose/thread/subThread.hpp b/include/openpose/thread/subThread.hpp index 9804c850..3e215672 100644 --- a/include/openpose/thread/subThread.hpp +++ b/include/openpose/thread/subThread.hpp @@ -2,7 +2,7 @@ #define OPENPOSE__THREAD__SUB_THREAD_HPP #include -#include "../utilities/macros.hpp" +#include #include "worker.hpp" namespace op @@ -21,7 +21,7 @@ namespace op virtual bool work() = 0; protected: - inline int getTWorkersSize() const + inline size_t getTWorkersSize() const { return mTWorkers.size(); } @@ -40,8 +40,8 @@ namespace op // Implementation -#include "../utilities/errorAndLog.hpp" -#include "../utilities/macros.hpp" +#include +#include namespace op { template diff --git a/include/openpose/thread/subThreadNoQueue.hpp b/include/openpose/thread/subThreadNoQueue.hpp index e3ec4d97..7a4e2251 100644 --- a/include/openpose/thread/subThreadNoQueue.hpp +++ b/include/openpose/thread/subThreadNoQueue.hpp @@ -24,8 +24,8 @@ namespace op // Implementation -#include "../utilities/errorAndLog.hpp" -#include "../utilities/macros.hpp" +#include +#include namespace op { template diff --git a/include/openpose/thread/subThreadQueueIn.hpp b/include/openpose/thread/subThreadQueueIn.hpp index 2603eb07..dbdafaf1 100644 --- a/include/openpose/thread/subThreadQueueIn.hpp +++ b/include/openpose/thread/subThreadQueueIn.hpp @@ -29,8 +29,8 @@ namespace op // Implementation -#include "../utilities/errorAndLog.hpp" -#include "../utilities/macros.hpp" +#include +#include namespace op { template diff --git a/include/openpose/thread/subThreadQueueInOut.hpp b/include/openpose/thread/subThreadQueueInOut.hpp index bf22b1fe..0f5bc5bd 100644 --- a/include/openpose/thread/subThreadQueueInOut.hpp +++ b/include/openpose/thread/subThreadQueueInOut.hpp @@ -30,8 +30,8 @@ namespace op // Implementation -#include "../utilities/errorAndLog.hpp" -#include "../utilities/macros.hpp" +#include +#include namespace op { template diff --git a/include/openpose/thread/subThreadQueueOut.hpp b/include/openpose/thread/subThreadQueueOut.hpp index 3f191c51..8066c03f 100644 --- a/include/openpose/thread/subThreadQueueOut.hpp +++ b/include/openpose/thread/subThreadQueueOut.hpp @@ -29,8 +29,8 @@ namespace op // Implementation -#include "../utilities/errorAndLog.hpp" -#include "../utilities/macros.hpp" +#include +#include namespace op { template diff --git a/include/openpose/thread/thread.hpp b/include/openpose/thread/thread.hpp index 77cdd88b..2f2096de 100644 --- a/include/openpose/thread/thread.hpp +++ b/include/openpose/thread/thread.hpp @@ -5,7 +5,7 @@ #include // std::shared_ptr #include #include -#include "../utilities/macros.hpp" +#include #include "subThread.hpp" #include "worker.hpp" @@ -63,7 +63,7 @@ namespace op // Implementation -#include "../utilities/errorAndLog.hpp" +#include namespace op { template diff --git a/include/openpose/thread/threadManager.hpp b/include/openpose/thread/threadManager.hpp index fc316feb..ac3b845d 100644 --- a/include/openpose/thread/threadManager.hpp +++ b/include/openpose/thread/threadManager.hpp @@ -6,7 +6,7 @@ #include // std::multiset #include #include -#include "../utilities/macros.hpp" +#include #include "enumClasses.hpp" #include "queue.hpp" #include "thread.hpp" @@ -85,8 +85,8 @@ namespace op // Implementation #include // std::pair -#include "../utilities/errorAndLog.hpp" -#include "../utilities/fastMath.hpp" +#include +#include #include "subThread.hpp" #include "subThreadNoQueue.hpp" #include "subThreadQueueIn.hpp" @@ -464,7 +464,7 @@ namespace op maxQueueId = fastMax(maxQueueId, fastMax(std::get<2>(threadWorkerQueue), std::get<3>(threadWorkerQueue))); // Check each queue id has at least a worker that uses it as input and another one as output. Special cases: - std::vector> usedQueueIds(maxQueueId + 1, {false, false}); + std::vector> usedQueueIds(maxQueueId+1, {false, false}); for (const auto& threadWorkerQueue : mThreadWorkerQueues) { usedQueueIds.at(std::get<2>(threadWorkerQueue)).first = true; diff --git a/include/openpose/thread/wIdGenerator.hpp b/include/openpose/thread/wIdGenerator.hpp index ae83469c..9a26d5b0 100644 --- a/include/openpose/thread/wIdGenerator.hpp +++ b/include/openpose/thread/wIdGenerator.hpp @@ -28,9 +28,9 @@ namespace op // Implementation -#include "../utilities/errorAndLog.hpp" -#include "../utilities/macros.hpp" -#include "../utilities/pointerContainer.hpp" +#include +#include +#include namespace op { template diff --git a/include/openpose/thread/wQueueOrderer.hpp b/include/openpose/thread/wQueueOrderer.hpp index 317695e0..84c0b761 100644 --- a/include/openpose/thread/wQueueOrderer.hpp +++ b/include/openpose/thread/wQueueOrderer.hpp @@ -2,8 +2,8 @@ #define OPENPOSE__THREAD__W_QUEUE_ORDERER_HPP #include // std::priority_queue +#include #include "worker.hpp" -#include "../utilities/pointerContainer.hpp" namespace op { @@ -36,9 +36,9 @@ namespace op // Implementation #include #include -#include "../utilities/errorAndLog.hpp" -#include "../utilities/macros.hpp" -#include "../utilities/profiler.hpp" +#include +#include +#include namespace op { template diff --git a/include/openpose/thread/worker.hpp b/include/openpose/thread/worker.hpp index 31e69475..460eb53e 100644 --- a/include/openpose/thread/worker.hpp +++ b/include/openpose/thread/worker.hpp @@ -1,7 +1,7 @@ #ifndef OPENPOSE__THREAD__WORKER_HPP #define OPENPOSE__THREAD__WORKER_HPP -#include "../utilities/macros.hpp" +#include namespace op { @@ -48,7 +48,7 @@ namespace op // Implementation -#include "../utilities/macros.hpp" +#include namespace op { template diff --git a/include/openpose/thread/workerConsumer.hpp b/include/openpose/thread/workerConsumer.hpp index 43be62cc..3f3aa783 100644 --- a/include/openpose/thread/workerConsumer.hpp +++ b/include/openpose/thread/workerConsumer.hpp @@ -26,7 +26,7 @@ namespace op // Implementation -#include "../utilities/macros.hpp" +#include namespace op { template diff --git a/include/openpose/thread/workerProducer.hpp b/include/openpose/thread/workerProducer.hpp index 88aac47a..36118307 100644 --- a/include/openpose/thread/workerProducer.hpp +++ b/include/openpose/thread/workerProducer.hpp @@ -26,7 +26,7 @@ namespace op // Implementation -#include "../utilities/macros.hpp" +#include namespace op { template diff --git a/include/openpose/utilities/cuda.hpp b/include/openpose/utilities/cuda.hpp index 2e9dbd0e..6cdf79ce 100644 --- a/include/openpose/utilities/cuda.hpp +++ b/include/openpose/utilities/cuda.hpp @@ -18,12 +18,7 @@ namespace op return (totalRequired + numberCudaThreads - 1) / numberCudaThreads; } - inline dim3 getNumberCudaBlocks(const cv::Size& frameSize, const dim3 numberCudaThreads = dim3{CUDA_NUM_THREADS, CUDA_NUM_THREADS, 1}) - { - return dim3{getNumberCudaBlocks(frameSize.width, numberCudaThreads.x), - getNumberCudaBlocks(frameSize.height, numberCudaThreads.y), - numberCudaThreads.z}; - } + dim3 getNumberCudaBlocks(const cv::Size& frameSize, const dim3 numberCudaThreads = dim3{ CUDA_NUM_THREADS, CUDA_NUM_THREADS, 1 }); std::pair getNumberCudaThreadsAndBlocks(const cv::Size& frameSize); } diff --git a/include/openpose/utilities/macros.hpp b/include/openpose/utilities/macros.hpp index 7bd616ba..f6ebf4ca 100644 --- a/include/openpose/utilities/macros.hpp +++ b/include/openpose/utilities/macros.hpp @@ -3,7 +3,7 @@ #include // std::shared_ptr #include -#include "../core/datum.hpp" +#include #define DATUM_BASE_NO_PTR std::vector #define DATUM_BASE std::shared_ptr diff --git a/include/openpose/wrapper/wrapper.hpp b/include/openpose/wrapper/wrapper.hpp index a79119cc..6ce512d9 100644 --- a/include/openpose/wrapper/wrapper.hpp +++ b/include/openpose/wrapper/wrapper.hpp @@ -1,7 +1,7 @@ #ifndef OPENPOSE__WRAPPER__WRAPPER_HPP #define OPENPOSE__WRAPPER__WRAPPER_HPP -#include "../thread/headers.hpp" +#include #include "wrapperStructFace.hpp" #include "wrapperStructHand.hpp" #include "wrapperStructInput.hpp" @@ -263,14 +263,14 @@ namespace op // Implementation -#include "../core/headers.hpp" -#include "../experimental/headers.hpp" -#include "../filestream/headers.hpp" -#include "../gui/headers.hpp" -#include "../pose/headers.hpp" -#include "../producer/headers.hpp" -#include "../utilities/errorAndLog.hpp" -#include "../utilities/fileSystem.hpp" +#include +#include +#include +#include +#include +#include +#include +#include namespace op { template diff --git a/include/openpose/wrapper/wrapperStructInput.hpp b/include/openpose/wrapper/wrapperStructInput.hpp index bdfec5b3..8587a751 100644 --- a/include/openpose/wrapper/wrapperStructInput.hpp +++ b/include/openpose/wrapper/wrapperStructInput.hpp @@ -2,7 +2,7 @@ #define OPENPOSE__WRAPPER__WRAPPER_STRUCT_INPUT_HPP #include -#include "../producer/producer.hpp" +#include namespace op { diff --git a/include/openpose/wrapper/wrapperStructOutput.hpp b/include/openpose/wrapper/wrapperStructOutput.hpp index 0492430c..10f88de6 100644 --- a/include/openpose/wrapper/wrapperStructOutput.hpp +++ b/include/openpose/wrapper/wrapperStructOutput.hpp @@ -2,7 +2,7 @@ #define OPENPOSE__WRAPPER__WRAPPER_STRUCT_OUTPUT_HPP #include -#include "../filestream/enumClasses.hpp" +#include namespace op { diff --git a/include/openpose/wrapper/wrapperStructPose.hpp b/include/openpose/wrapper/wrapperStructPose.hpp index 9dd7d505..a3889668 100644 --- a/include/openpose/wrapper/wrapperStructPose.hpp +++ b/include/openpose/wrapper/wrapperStructPose.hpp @@ -2,9 +2,9 @@ #define OPENPOSE__WRAPPER__WRAPPER_STRUCT_POSE_HPP #include -#include "../core/enumClasses.hpp" -#include "../pose/enumClasses.hpp" -#include "../pose/poseParameters.hpp" +#include +#include +#include namespace op { diff --git a/src/openpose/core/array.cpp b/src/openpose/core/array.cpp index ac289916..6d79bf6f 100644 --- a/src/openpose/core/array.cpp +++ b/src/openpose/core/array.cpp @@ -1,7 +1,7 @@ #include // typeid #include // std::accumulate -#include "openpose/utilities/errorAndLog.hpp" -#include "openpose/core/array.hpp" +#include +#include namespace op { @@ -248,7 +248,7 @@ namespace op { // OpenCV is efficient on copying (AVX, SSE, etc.) if (mCvMatData.first) - mCvMatData.second.setTo(value); + mCvMatData.second.setTo((double)value); else for (auto i = 0 ; i < mVolume ; i++) operator[](i) = value; diff --git a/src/openpose/core/cvMatToOpInput.cpp b/src/openpose/core/cvMatToOpInput.cpp index f48fcd28..440be2e2 100644 --- a/src/openpose/core/cvMatToOpInput.cpp +++ b/src/openpose/core/cvMatToOpInput.cpp @@ -1,7 +1,7 @@ -#include "openpose/utilities/errorAndLog.hpp" -#include "openpose/utilities/fastMath.hpp" -#include "openpose/utilities/openCv.hpp" -#include "openpose/core/cvMatToOpInput.hpp" +#include +#include +#include +#include namespace op { diff --git a/src/openpose/core/cvMatToOpOutput.cpp b/src/openpose/core/cvMatToOpOutput.cpp index 20009362..97412364 100644 --- a/src/openpose/core/cvMatToOpOutput.cpp +++ b/src/openpose/core/cvMatToOpOutput.cpp @@ -1,6 +1,6 @@ -#include "openpose/utilities/errorAndLog.hpp" -#include "openpose/utilities/openCv.hpp" -#include "openpose/core/cvMatToOpOutput.hpp" +#include +#include +#include namespace op { diff --git a/src/openpose/core/datum.cpp b/src/openpose/core/datum.cpp index 81e968d5..349730f1 100644 --- a/src/openpose/core/datum.cpp +++ b/src/openpose/core/datum.cpp @@ -1,5 +1,5 @@ -#include "openpose/utilities/errorAndLog.hpp" -#include "openpose/core/datum.hpp" +#include +#include namespace op { diff --git a/src/openpose/core/defineTemplates.cpp b/src/openpose/core/defineTemplates.cpp index d3decfa8..e0584a17 100644 --- a/src/openpose/core/defineTemplates.cpp +++ b/src/openpose/core/defineTemplates.cpp @@ -1,4 +1,4 @@ -#include "openpose/core/headers.hpp" +#include namespace op { diff --git a/src/openpose/core/keyPointScaler.cpp b/src/openpose/core/keyPointScaler.cpp index e5664aad..49b5f43f 100644 --- a/src/openpose/core/keyPointScaler.cpp +++ b/src/openpose/core/keyPointScaler.cpp @@ -1,6 +1,6 @@ -#include "openpose/core/scaleKeyPoints.hpp" -#include "openpose/utilities/errorAndLog.hpp" -#include "openpose/core/keyPointScaler.hpp" +#include +#include +#include namespace op { @@ -9,7 +9,7 @@ namespace op { } - void KeyPointScaler::scale(Array& arrayToScale, const double scaleInputToOutput, const double scaleNetToOutput, const cv::Size& producerSize) const + void KeyPointScaler::scale(Array& arrayToScale, const float scaleInputToOutput, const float scaleNetToOutput, const cv::Size& producerSize) const { try { @@ -22,7 +22,7 @@ namespace op } } - void KeyPointScaler::scale(std::vector>& arrayToScalesToScale, const double scaleInputToOutput, const double scaleNetToOutput, const cv::Size& producerSize) const + void KeyPointScaler::scale(std::vector>& arrayToScalesToScale, const float scaleInputToOutput, const float scaleNetToOutput, const cv::Size& producerSize) const { try { @@ -31,27 +31,27 @@ namespace op // InputResolution if (mScaleMode == ScaleMode::InputResolution) for (auto& arrayToScale : arrayToScalesToScale) - scaleKeyPoints(arrayToScale, 1./scaleInputToOutput); + scaleKeyPoints(arrayToScale, 1.f/scaleInputToOutput); // NetOutputResolution else if (mScaleMode == ScaleMode::NetOutputResolution) for (auto& arrayToScale : arrayToScalesToScale) - scaleKeyPoints(arrayToScale, 1./scaleNetToOutput); + scaleKeyPoints(arrayToScale, 1.f/scaleNetToOutput); // [0,1] else if (mScaleMode == ScaleMode::ZeroToOne) { - const auto scale = 1./scaleInputToOutput; - const auto scaleX = scale / ((double)producerSize.width - 1.); - const auto scaleY = scale / ((double)producerSize.height - 1.); + const auto scale = 1.f/scaleInputToOutput; + const auto scaleX = scale / ((float)producerSize.width - 1.f); + const auto scaleY = scale / ((float)producerSize.height - 1.f); for (auto& arrayToScale : arrayToScalesToScale) scaleKeyPoints(arrayToScale, scaleX, scaleY); } // [-1,1] else if (mScaleMode == ScaleMode::PlusMinusOne) { - const auto scale = 2./scaleInputToOutput; - const auto scaleX = (scale / ((double)producerSize.width - 1.)); - const auto scaleY = (scale / ((double)producerSize.height - 1.)); - const auto offset = -1.; + const auto scale = 2.f/scaleInputToOutput; + const auto scaleX = (scale / ((float)producerSize.width - 1.f)); + const auto scaleY = (scale / ((float)producerSize.height - 1.f)); + const auto offset = -1.f; for (auto& arrayToScale : arrayToScalesToScale) scaleKeyPoints(arrayToScale, scaleX, scaleY, offset, offset); } diff --git a/src/openpose/core/netCaffe.cpp b/src/openpose/core/netCaffe.cpp index 9e7a8c22..a99841e7 100644 --- a/src/openpose/core/netCaffe.cpp +++ b/src/openpose/core/netCaffe.cpp @@ -1,8 +1,8 @@ #ifdef USE_CAFFE #include // std::accumulate -#include "openpose/utilities/cuda.hpp" -#include "openpose/utilities/errorAndLog.hpp" -#include "openpose/core/netCaffe.hpp" +#include +#include +#include namespace op { @@ -17,6 +17,10 @@ namespace op { } + NetCaffe::~NetCaffe() + { + } + void NetCaffe::initializationOnThread() { try diff --git a/src/openpose/core/nmsBase.cpp b/src/openpose/core/nmsBase.cpp index ad8e724b..28139d81 100644 --- a/src/openpose/core/nmsBase.cpp +++ b/src/openpose/core/nmsBase.cpp @@ -1,6 +1,6 @@ -#include "openpose/utilities/errorAndLog.hpp" -#include "openpose/utilities/macros.hpp" -#include "openpose/core/nmsBase.hpp" +#include +#include +#include namespace op { diff --git a/src/openpose/core/nmsBase.cu b/src/openpose/core/nmsBase.cu index fc5c9450..2e8eb121 100644 --- a/src/openpose/core/nmsBase.cu +++ b/src/openpose/core/nmsBase.cu @@ -1,9 +1,9 @@ #include #include -#include "openpose/utilities/cuda.hpp" -#include "openpose/utilities/errorAndLog.hpp" -#include "openpose/utilities/cuda.hpp" -#include "openpose/core/nmsBase.hpp" +#include +#include +#include +#include namespace op { diff --git a/src/openpose/core/nmsCaffe.cpp b/src/openpose/core/nmsCaffe.cpp index f63288ba..06d01bf8 100644 --- a/src/openpose/core/nmsCaffe.cpp +++ b/src/openpose/core/nmsCaffe.cpp @@ -1,8 +1,8 @@ #ifdef USE_CAFFE -#include "openpose/core/nmsBase.hpp" -#include "openpose/utilities/errorAndLog.hpp" -#include "openpose/utilities/macros.hpp" -#include "openpose/core/nmsCaffe.hpp" +#include +#include +#include +#include namespace op { diff --git a/src/openpose/core/opOutputToCvMat.cpp b/src/openpose/core/opOutputToCvMat.cpp index 7cbde569..8141b1dd 100644 --- a/src/openpose/core/opOutputToCvMat.cpp +++ b/src/openpose/core/opOutputToCvMat.cpp @@ -1,6 +1,6 @@ -#include "openpose/utilities/errorAndLog.hpp" -#include "openpose/utilities/openCv.hpp" -#include "openpose/core/opOutputToCvMat.hpp" +#include +#include +#include namespace op { diff --git a/src/openpose/core/renderer.cpp b/src/openpose/core/renderer.cpp index d838450c..8e6eb374 100644 --- a/src/openpose/core/renderer.cpp +++ b/src/openpose/core/renderer.cpp @@ -1,7 +1,7 @@ #include #include -#include "openpose/utilities/errorAndLog.hpp" -#include "openpose/core/renderer.hpp" +#include +#include namespace op { diff --git a/src/openpose/core/resizeAndMergeBase.cpp b/src/openpose/core/resizeAndMergeBase.cpp index 4fd7d684..bfcf2ea7 100644 --- a/src/openpose/core/resizeAndMergeBase.cpp +++ b/src/openpose/core/resizeAndMergeBase.cpp @@ -1,7 +1,7 @@ // #include -#include "openpose/utilities/errorAndLog.hpp" -#include "openpose/utilities/macros.hpp" -#include "openpose/core/resizeAndMergeBase.hpp" +#include +#include +#include namespace op { diff --git a/src/openpose/core/resizeAndMergeBase.cu b/src/openpose/core/resizeAndMergeBase.cu index 231a2c43..98038462 100644 --- a/src/openpose/core/resizeAndMergeBase.cu +++ b/src/openpose/core/resizeAndMergeBase.cu @@ -1,7 +1,7 @@ -#include "openpose/utilities/cuda.hpp" -#include "openpose/utilities/cuda.hu" -#include "openpose/utilities/errorAndLog.hpp" -#include "openpose/core/resizeAndMergeBase.hpp" +#include +#include +#include +#include namespace op { diff --git a/src/openpose/core/resizeAndMergeCaffe.cpp b/src/openpose/core/resizeAndMergeCaffe.cpp index 40571b93..2f30afc8 100644 --- a/src/openpose/core/resizeAndMergeCaffe.cpp +++ b/src/openpose/core/resizeAndMergeCaffe.cpp @@ -1,9 +1,9 @@ #ifdef USE_CAFFE -#include "openpose/core/resizeAndMergeBase.hpp" -#include "openpose/utilities/errorAndLog.hpp" -#include "openpose/utilities/fastMath.hpp" -#include "openpose/utilities/macros.hpp" -#include "openpose/core/resizeAndMergeCaffe.hpp" +#include +#include +#include +#include +#include namespace op { diff --git a/src/openpose/core/scaleKeyPoints.cpp b/src/openpose/core/scaleKeyPoints.cpp index 03184bbc..1018e8c8 100644 --- a/src/openpose/core/scaleKeyPoints.cpp +++ b/src/openpose/core/scaleKeyPoints.cpp @@ -1,11 +1,11 @@ -#include "openpose/utilities/errorAndLog.hpp" -#include "openpose/core/scaleKeyPoints.hpp" +#include +#include namespace op { const std::string errorMessage = "This function is only for array of dimension: [sizeA x sizeB x 3]."; - void scaleKeyPoints(Array& keyPoints, const double scale) + void scaleKeyPoints(Array& keyPoints, const float scale) { try { @@ -17,7 +17,7 @@ namespace op } } - void scaleKeyPoints(Array& keyPoints, const double scaleX, const double scaleY) + void scaleKeyPoints(Array& keyPoints, const float scaleX, const float scaleY) { try { @@ -48,7 +48,7 @@ namespace op } } - void scaleKeyPoints(Array& keyPoints, const double scaleX, const double scaleY, const double offsetX, const double offsetY) + void scaleKeyPoints(Array& keyPoints, const float scaleX, const float scaleY, const float offsetX, const float offsetY) { try { diff --git a/src/openpose/experimental/face/defineTemplates.cpp b/src/openpose/experimental/face/defineTemplates.cpp index 7ef3096b..2a90f6f2 100644 --- a/src/openpose/experimental/face/defineTemplates.cpp +++ b/src/openpose/experimental/face/defineTemplates.cpp @@ -1,4 +1,4 @@ -#include "openpose/experimental/face/headers.hpp" +#include namespace op { diff --git a/src/openpose/experimental/face/faceExtractor.cpp b/src/openpose/experimental/face/faceExtractor.cpp index 9ab6cb07..7c416236 100644 --- a/src/openpose/experimental/face/faceExtractor.cpp +++ b/src/openpose/experimental/face/faceExtractor.cpp @@ -1,13 +1,13 @@ #include // CV_WARP_INVERSE_MAP, CV_INTER_LINEAR -#include "openpose/core/netCaffe.hpp" -#include "openpose/experimental/face/faceParameters.hpp" -#include "openpose/pose/poseParameters.hpp" -#include "openpose/utilities/cuda.hpp" -#include "openpose/utilities/errorAndLog.hpp" -#include "openpose/utilities/fastMath.hpp" -#include "openpose/utilities/openCv.hpp" -#include "openpose/experimental/face/faceExtractor.hpp" -#include "openpose/experimental/face/faceRenderGpu.hpp" // For commented debugging section +#include +#include +#include +#include +#include +#include +#include +#include +#include // For commented debugging section namespace op { diff --git a/src/openpose/experimental/face/faceRenderGpu.cu b/src/openpose/experimental/face/faceRenderGpu.cu index 2f59501f..bc14bf39 100644 --- a/src/openpose/experimental/face/faceRenderGpu.cu +++ b/src/openpose/experimental/face/faceRenderGpu.cu @@ -1,9 +1,9 @@ -#include "openpose/experimental/face/faceParameters.hpp" -#include "openpose/utilities/errorAndLog.hpp" -#include "openpose/utilities/cuda.hpp" -#include "openpose/utilities/cuda.hu" -#include "openpose/utilities/render.hu" -#include "openpose/experimental/face/faceRenderGpu.hpp" +#include +#include +#include +#include +#include +#include namespace op { diff --git a/src/openpose/experimental/face/faceRenderer.cpp b/src/openpose/experimental/face/faceRenderer.cpp index 71022038..44f6428b 100644 --- a/src/openpose/experimental/face/faceRenderer.cpp +++ b/src/openpose/experimental/face/faceRenderer.cpp @@ -1,10 +1,10 @@ #include #include -#include "openpose/experimental/face/faceParameters.hpp" -#include "openpose/experimental/face/faceRenderGpu.hpp" -#include "openpose/utilities/cuda.hpp" -#include "openpose/utilities/errorAndLog.hpp" -#include "openpose/experimental/face/faceRenderer.hpp" +#include +#include +#include +#include +#include namespace op { diff --git a/src/openpose/experimental/filestream/defineTemplates.cpp b/src/openpose/experimental/filestream/defineTemplates.cpp index 7ff09d90..c5913845 100644 --- a/src/openpose/experimental/filestream/defineTemplates.cpp +++ b/src/openpose/experimental/filestream/defineTemplates.cpp @@ -1,4 +1,4 @@ -#include "openpose/experimental/filestream/headers.hpp" +#include namespace op { diff --git a/src/openpose/experimental/hand/defineTemplates.cpp b/src/openpose/experimental/hand/defineTemplates.cpp index 23e155b7..01869e14 100644 --- a/src/openpose/experimental/hand/defineTemplates.cpp +++ b/src/openpose/experimental/hand/defineTemplates.cpp @@ -1,4 +1,4 @@ -#include "openpose/experimental/hand/headers.hpp" +#include namespace op { diff --git a/src/openpose/experimental/hand/handExtractor.cpp b/src/openpose/experimental/hand/handExtractor.cpp index ecd4128d..a91dda83 100644 --- a/src/openpose/experimental/hand/handExtractor.cpp +++ b/src/openpose/experimental/hand/handExtractor.cpp @@ -1,13 +1,13 @@ #include // CV_WARP_INVERSE_MAP, CV_INTER_LINEAR -#include "openpose/core/netCaffe.hpp" -#include "openpose/experimental/hand/handParameters.hpp" -#include "openpose/pose/poseParameters.hpp" -#include "openpose/utilities/cuda.hpp" -#include "openpose/utilities/errorAndLog.hpp" -#include "openpose/utilities/fastMath.hpp" -#include "openpose/utilities/openCv.hpp" -#include "openpose/experimental/hand/handExtractor.hpp" -// #include "openpose/experimental/hand/handRenderGpu.hpp" // For commented debugging section +#include +#include +#include +#include +#include +#include +#include +#include +// #include // For commented debugging section namespace op { diff --git a/src/openpose/experimental/hand/handRenderGpu.cu b/src/openpose/experimental/hand/handRenderGpu.cu index 908e3c55..16fddde0 100644 --- a/src/openpose/experimental/hand/handRenderGpu.cu +++ b/src/openpose/experimental/hand/handRenderGpu.cu @@ -1,9 +1,9 @@ -#include "openpose/experimental/hand/handParameters.hpp" -#include "openpose/utilities/errorAndLog.hpp" -#include "openpose/utilities/cuda.hpp" -#include "openpose/utilities/cuda.hu" -#include "openpose/utilities/render.hu" -#include "openpose/experimental/hand/handRenderGpu.hpp" +#include +#include +#include +#include +#include +#include namespace op { diff --git a/src/openpose/experimental/hand/handRenderer.cpp b/src/openpose/experimental/hand/handRenderer.cpp index 885375fd..07c5de1b 100644 --- a/src/openpose/experimental/hand/handRenderer.cpp +++ b/src/openpose/experimental/hand/handRenderer.cpp @@ -1,10 +1,10 @@ #include #include -#include "openpose/experimental/hand/handParameters.hpp" -#include "openpose/experimental/hand/handRenderGpu.hpp" -#include "openpose/utilities/cuda.hpp" -#include "openpose/utilities/errorAndLog.hpp" -#include "openpose/experimental/hand/handRenderer.hpp" +#include +#include +#include +#include +#include namespace op { diff --git a/src/openpose/filestream/defineTemplates.cpp b/src/openpose/filestream/defineTemplates.cpp index 93875d49..e3fb15ed 100644 --- a/src/openpose/filestream/defineTemplates.cpp +++ b/src/openpose/filestream/defineTemplates.cpp @@ -1,4 +1,4 @@ -#include "openpose/filestream/headers.hpp" +#include namespace op { diff --git a/src/openpose/filestream/fileSaver.cpp b/src/openpose/filestream/fileSaver.cpp index da737bb9..6ca1c4f5 100644 --- a/src/openpose/filestream/fileSaver.cpp +++ b/src/openpose/filestream/fileSaver.cpp @@ -1,6 +1,6 @@ -#include "openpose/utilities/errorAndLog.hpp" -#include "openpose/utilities/fileSystem.hpp" -#include "openpose/filestream/fileSaver.hpp" +#include +#include +#include namespace op { diff --git a/src/openpose/filestream/fileStream.cpp b/src/openpose/filestream/fileStream.cpp index 7d35ff89..9d6c2894 100644 --- a/src/openpose/filestream/fileStream.cpp +++ b/src/openpose/filestream/fileStream.cpp @@ -1,7 +1,7 @@ #include // cv::imread -#include "openpose/utilities/errorAndLog.hpp" -#include "openpose/filestream/jsonOfstream.hpp" -#include "openpose/filestream/fileStream.hpp" +#include +#include +#include namespace op { diff --git a/src/openpose/filestream/heatMapSaver.cpp b/src/openpose/filestream/heatMapSaver.cpp index 1b09623e..424326df 100644 --- a/src/openpose/filestream/heatMapSaver.cpp +++ b/src/openpose/filestream/heatMapSaver.cpp @@ -1,7 +1,7 @@ -#include "openpose/utilities/errorAndLog.hpp" -#include "openpose/utilities/openCv.hpp" -#include "openpose/filestream/fileStream.hpp" -#include "openpose/filestream/heatMapSaver.hpp" +#include +#include +#include +#include namespace op { diff --git a/src/openpose/filestream/imageSaver.cpp b/src/openpose/filestream/imageSaver.cpp index 80c56c85..3a4be721 100644 --- a/src/openpose/filestream/imageSaver.cpp +++ b/src/openpose/filestream/imageSaver.cpp @@ -1,6 +1,6 @@ -#include "openpose/utilities/errorAndLog.hpp" -#include "openpose/filestream/fileStream.hpp" -#include "openpose/filestream/imageSaver.hpp" +#include +#include +#include namespace op { diff --git a/src/openpose/filestream/jsonOfstream.cpp b/src/openpose/filestream/jsonOfstream.cpp index 77c5d5c7..ccb915f5 100644 --- a/src/openpose/filestream/jsonOfstream.cpp +++ b/src/openpose/filestream/jsonOfstream.cpp @@ -1,5 +1,5 @@ -#include "openpose/utilities/errorAndLog.hpp" -#include "openpose/filestream/jsonOfstream.hpp" +#include +#include namespace op { diff --git a/src/openpose/filestream/poseJsonCocoSaver.cpp b/src/openpose/filestream/poseJsonCocoSaver.cpp index 14290547..ea267e5e 100644 --- a/src/openpose/filestream/poseJsonCocoSaver.cpp +++ b/src/openpose/filestream/poseJsonCocoSaver.cpp @@ -1,5 +1,5 @@ -#include "openpose/utilities/errorAndLog.hpp" -#include "openpose/filestream/poseJsonCocoSaver.hpp" +#include +#include namespace op { @@ -28,7 +28,7 @@ namespace op } } - void PoseJsonCocoSaver::record(const Array& poseKeyPoints, const int imageId) + void PoseJsonCocoSaver::record(const Array& poseKeyPoints, const unsigned long long imageId) { try { diff --git a/src/openpose/filestream/poseJsonSaver.cpp b/src/openpose/filestream/poseJsonSaver.cpp index 20f022a3..bf58058e 100644 --- a/src/openpose/filestream/poseJsonSaver.cpp +++ b/src/openpose/filestream/poseJsonSaver.cpp @@ -1,6 +1,6 @@ -#include "openpose/utilities/errorAndLog.hpp" -#include "openpose/filestream/fileStream.hpp" -#include "openpose/filestream/poseJsonSaver.hpp" +#include +#include +#include namespace op { @@ -22,8 +22,8 @@ namespace op const bool humanReadable = true; for (auto i = 0; i < poseKeyPointsVector.size(); i++) { - const auto fileName = fileNameNoExtension + (i != 0 ? "_" + std::to_string(i) : "") + ".json"; - savePoseJson(poseKeyPointsVector[i], fileName, humanReadable); + const auto finalFileName = fileNameNoExtension + (i != 0 ? "_" + std::to_string(i) : "") + ".json"; + savePoseJson(poseKeyPointsVector[i], finalFileName, humanReadable); } } } diff --git a/src/openpose/filestream/poseSaver.cpp b/src/openpose/filestream/poseSaver.cpp index de8c959b..e9bb87f6 100644 --- a/src/openpose/filestream/poseSaver.cpp +++ b/src/openpose/filestream/poseSaver.cpp @@ -1,7 +1,7 @@ #include -#include "openpose/utilities/errorAndLog.hpp" -#include "openpose/filestream/fileStream.hpp" -#include "openpose/filestream/poseSaver.hpp" +#include +#include +#include namespace op { diff --git a/src/openpose/filestream/videoSaver.cpp b/src/openpose/filestream/videoSaver.cpp index 95a06c4e..9db10f38 100644 --- a/src/openpose/filestream/videoSaver.cpp +++ b/src/openpose/filestream/videoSaver.cpp @@ -1,5 +1,5 @@ -#include "openpose/utilities/errorAndLog.hpp" -#include "openpose/filestream/videoSaver.hpp" +#include +#include namespace op { diff --git a/src/openpose/gui/defineTemplates.cpp b/src/openpose/gui/defineTemplates.cpp index 6f8c79f7..83fd1638 100644 --- a/src/openpose/gui/defineTemplates.cpp +++ b/src/openpose/gui/defineTemplates.cpp @@ -1,4 +1,4 @@ -#include "openpose/gui/headers.hpp" +#include namespace op { diff --git a/src/openpose/gui/frameDisplayer.cpp b/src/openpose/gui/frameDisplayer.cpp index d3cc4a89..bac91669 100644 --- a/src/openpose/gui/frameDisplayer.cpp +++ b/src/openpose/gui/frameDisplayer.cpp @@ -1,6 +1,6 @@ #include // cv::imshow, cv::waitKey, cv::namedWindow, cv::setWindowProperty -#include "openpose/utilities/errorAndLog.hpp" -#include "openpose/gui/frameDisplayer.hpp" +#include +#include namespace op { diff --git a/src/openpose/gui/gui.cpp b/src/openpose/gui/gui.cpp index 66282875..400945e7 100644 --- a/src/openpose/gui/gui.cpp +++ b/src/openpose/gui/gui.cpp @@ -1,10 +1,10 @@ #include #include #include // cv::waitKey -#include "openpose/filestream/fileStream.hpp" -#include "openpose/utilities/check.hpp" -#include "openpose/utilities/errorAndLog.hpp" -#include "openpose/gui/gui.hpp" +#include +#include +#include +#include namespace op { @@ -37,7 +37,7 @@ namespace op if (key != -1) { // Some OpenCV versions has a problem and key must be casted to char - const auto castedKey = std::tolower((char)key); + const auto castedKey = (char)std::tolower((char)key); // ------------------------- General Commands ------------------------- // // Exit program if (castedKey==27) @@ -118,7 +118,7 @@ namespace op const auto newElementToRender = key2part.find(castedKey); if (newElementToRender != std::string::npos) for (auto& poseRenderer : mPoseRenderers) - poseRenderer->setElementToRender(newElementToRender); + poseRenderer->setElementToRender((int)newElementToRender); } } } diff --git a/src/openpose/gui/guiInfoAdder.cpp b/src/openpose/gui/guiInfoAdder.cpp index 5a71449f..eec686f1 100644 --- a/src/openpose/gui/guiInfoAdder.cpp +++ b/src/openpose/gui/guiInfoAdder.cpp @@ -1,10 +1,10 @@ #include #include // std::snprintf #include // std::numeric_limits -#include "openpose/utilities/errorAndLog.hpp" -#include "openpose/utilities/fastMath.hpp" -#include "openpose/utilities/openCv.hpp" -#include "openpose/gui/guiInfoAdder.hpp" +#include +#include +#include +#include namespace op { diff --git a/src/openpose/pose/bodyPartConnectorBase.cpp b/src/openpose/pose/bodyPartConnectorBase.cpp index 968ea682..f8f2326a 100644 --- a/src/openpose/pose/bodyPartConnectorBase.cpp +++ b/src/openpose/pose/bodyPartConnectorBase.cpp @@ -1,8 +1,8 @@ -#include "openpose/utilities/check.hpp" -#include "openpose/utilities/errorAndLog.hpp" -#include "openpose/utilities/fastMath.hpp" -#include "openpose/pose/poseParameters.hpp" -#include "openpose/pose/bodyPartConnectorBase.hpp" +#include +#include +#include +#include +#include namespace op { @@ -48,7 +48,7 @@ namespace op const auto indexB = bodyPartB; for (auto j = 0; j < subset.size(); j++) { - const auto off = bodyPartB*peaksOffset + i*3 + 2; + const auto off = (int)bodyPartB*peaksOffset + i*3 + 2; if (subset[j].first[indexB] == off) { num = true; @@ -89,7 +89,7 @@ namespace op const auto indexA = bodyPartA; for (auto j = 0; j < subset.size(); j++) { - const auto off = bodyPartA*peaksOffset + i*3 + 2; + const auto off = (int)bodyPartA*peaksOffset + i*3 + 2; if (subset[j].first[indexA] == off) { num = true; @@ -292,13 +292,13 @@ namespace op // Fill and return poseKeyPoints if (numberPeople > 0) - poseKeyPoints.reset({numberPeople, numberBodyParts, 3}); + poseKeyPoints.reset({numberPeople, (int)numberBodyParts, 3}); else poseKeyPoints.reset(); for (auto person = 0 ; person < validSubsetIndexes.size() ; person++) { const auto& subsetI = subset[validSubsetIndexes[person]].first; - for (auto bodyPart = 0; bodyPart < numberBodyParts; bodyPart++) + for (auto bodyPart = 0u; bodyPart < numberBodyParts; bodyPart++) { const auto baseOffset = (person*numberBodyParts + bodyPart) * 3; const auto bodyPartIndex = subsetI[bodyPart]; diff --git a/src/openpose/pose/bodyPartConnectorBase.cu b/src/openpose/pose/bodyPartConnectorBase.cu index d3610693..4d70c658 100644 --- a/src/openpose/pose/bodyPartConnectorBase.cu +++ b/src/openpose/pose/bodyPartConnectorBase.cu @@ -1,6 +1,6 @@ -#include "openpose/utilities/cuda.hpp" -#include "openpose/utilities/errorAndLog.hpp" -#include "openpose/pose/bodyPartConnectorBase.hpp" +#include +#include +#include namespace op { diff --git a/src/openpose/pose/bodyPartConnectorCaffe.cpp b/src/openpose/pose/bodyPartConnectorCaffe.cpp index f420a1a3..ecd2ce89 100644 --- a/src/openpose/pose/bodyPartConnectorCaffe.cpp +++ b/src/openpose/pose/bodyPartConnectorCaffe.cpp @@ -1,8 +1,8 @@ #ifdef USE_CAFFE -#include "openpose/pose/bodyPartConnectorBase.hpp" -#include "openpose/utilities/errorAndLog.hpp" -#include "openpose/utilities/macros.hpp" -#include "openpose/pose/bodyPartConnectorCaffe.hpp" +#include +#include +#include +#include namespace op { diff --git a/src/openpose/pose/defineTemplates.cpp b/src/openpose/pose/defineTemplates.cpp index 7be769e9..147a1edf 100644 --- a/src/openpose/pose/defineTemplates.cpp +++ b/src/openpose/pose/defineTemplates.cpp @@ -1,4 +1,4 @@ -#include "openpose/pose/headers.hpp" +#include namespace op { diff --git a/src/openpose/pose/poseExtractor.cpp b/src/openpose/pose/poseExtractor.cpp index 6765abb6..da4114c6 100644 --- a/src/openpose/pose/poseExtractor.cpp +++ b/src/openpose/pose/poseExtractor.cpp @@ -1,9 +1,9 @@ #include // std::shared_ptr #include -#include "openpose/core/enumClasses.hpp" -#include "openpose/utilities/errorAndLog.hpp" -#include "openpose/utilities/fastMath.hpp" -#include "openpose/pose/poseExtractor.hpp" +#include +#include +#include +#include namespace op { @@ -33,7 +33,7 @@ namespace op if (heatMapTypesHas(heatMapTypes, HeatMapType::Background)) numberHeatMapChannels += 1; if (heatMapTypesHas(heatMapTypes, HeatMapType::PAFs)) - numberHeatMapChannels += POSE_BODY_PART_PAIRS[(int)poseModel].size(); + numberHeatMapChannels += (int)POSE_BODY_PART_PAIRS[(int)poseModel].size(); return numberHeatMapChannels; } catch (const std::exception& e) @@ -72,6 +72,10 @@ namespace op } } + PoseExtractor::~PoseExtractor() + { + } + void PoseExtractor::initializationOnThread() { // Get thread id @@ -103,17 +107,17 @@ namespace op cudaMemcpy(poseHeatMaps.getPtr(), getHeatMapGpuConstPtr(), volumeBodyParts * sizeof(float), cudaMemcpyDeviceToHost); // Change from [0,1] to [-1,1] if (mHeatMapScaleMode == ScaleMode::PlusMinusOne) - for (auto i = 0 ; i < volumeBodyParts ; i++) + for (auto i = 0u ; i < volumeBodyParts ; i++) poseHeatMaps[i] = fastTruncate(poseHeatMaps[i]) * 2.f - 1.f; // [0, 255] else if (mHeatMapScaleMode == ScaleMode::UnsignedChar) - for (auto i = 0 ; i < volumeBodyParts ; i++) - poseHeatMaps[i] = intRound(fastTruncate(poseHeatMaps[i]) * 255.f); + for (auto i = 0u ; i < volumeBodyParts ; i++) + poseHeatMaps[i] = (float)intRound(fastTruncate(poseHeatMaps[i]) * 255.f); // Avoid values outside original range else - for (auto i = 0 ; i < volumeBodyParts ; i++) + for (auto i = 0u ; i < volumeBodyParts ; i++) poseHeatMaps[i] = fastTruncate(poseHeatMaps[i]); - totalOffset += volumeBodyParts; + totalOffset += (unsigned int)volumeBodyParts; } if (heatMapTypesHas(mHeatMapTypes, HeatMapType::Background)) { @@ -121,17 +125,17 @@ namespace op // Change from [0,1] to [-1,1] auto* poseHeatMapsPtr = poseHeatMaps.getPtr() + totalOffset; if (mHeatMapScaleMode == ScaleMode::PlusMinusOne) - for (auto i = 0 ; i < channelOffset ; i++) + for (auto i = 0u ; i < channelOffset ; i++) poseHeatMapsPtr[i] = fastTruncate(poseHeatMapsPtr[i]) * 2.f - 1.f; // [0, 255] else if (mHeatMapScaleMode == ScaleMode::UnsignedChar) - for (auto i = 0 ; i < channelOffset ; i++) - poseHeatMapsPtr[i] = intRound(fastTruncate(poseHeatMapsPtr[i]) * 255.f); + for (auto i = 0u ; i < channelOffset ; i++) + poseHeatMapsPtr[i] = (float)intRound(fastTruncate(poseHeatMapsPtr[i]) * 255.f); // Avoid values outside original range else - for (auto i = 0 ; i < channelOffset ; i++) + for (auto i = 0u ; i < channelOffset ; i++) poseHeatMapsPtr[i] = fastTruncate(poseHeatMapsPtr[i]); - totalOffset += channelOffset; + totalOffset += (unsigned int)channelOffset; } if (heatMapTypesHas(mHeatMapTypes, HeatMapType::PAFs)) { @@ -139,17 +143,17 @@ namespace op // Change from [-1,1] to [0,1]. Note that PAFs are in [-1,1] auto* poseHeatMapsPtr = poseHeatMaps.getPtr() + totalOffset; if (mHeatMapScaleMode == ScaleMode::ZeroToOne) - for (auto i = 0 ; i < volumePAFs ; i++) + for (auto i = 0u ; i < volumePAFs ; i++) poseHeatMapsPtr[i] = fastTruncate(poseHeatMapsPtr[i], -1.f) * 0.5f + 0.5f; // [0, 255] else if (mHeatMapScaleMode == ScaleMode::UnsignedChar) - for (auto i = 0 ; i < volumePAFs ; i++) - poseHeatMapsPtr[i] = intRound(fastTruncate(poseHeatMapsPtr[i], -1.f) * 128.5f + 128.5f); + for (auto i = 0u ; i < volumePAFs ; i++) + poseHeatMapsPtr[i] = (float)intRound(fastTruncate(poseHeatMapsPtr[i], -1.f) * 128.5f + 128.5f); // Avoid values outside original range else - for (auto i = 0 ; i < volumePAFs ; i++) + for (auto i = 0u ; i < volumePAFs ; i++) poseHeatMapsPtr[i] = fastTruncate(poseHeatMapsPtr[i], -1.f); - totalOffset += volumePAFs; + totalOffset += (unsigned int)volumePAFs; } // Copy all at once // cudaMemcpy(poseHeatMaps.getPtr(), getHeatMapGpuConstPtr(), poseHeatMaps.getVolume() * sizeof(float), cudaMemcpyDeviceToHost); diff --git a/src/openpose/pose/poseExtractorCaffe.cpp b/src/openpose/pose/poseExtractorCaffe.cpp index a9bf9b46..ea9c9cdf 100644 --- a/src/openpose/pose/poseExtractorCaffe.cpp +++ b/src/openpose/pose/poseExtractorCaffe.cpp @@ -1,12 +1,12 @@ #ifdef USE_CAFFE -#include "openpose/core/netCaffe.hpp" -#include "openpose/pose/poseParameters.hpp" -#include "openpose/utilities/check.hpp" -#include "openpose/utilities/cuda.hpp" -#include "openpose/utilities/errorAndLog.hpp" -#include "openpose/utilities/fastMath.hpp" -#include "openpose/utilities/openCv.hpp" -#include "openpose/pose/poseExtractorCaffe.hpp" +#include +#include +#include +#include +#include +#include +#include +#include namespace op { @@ -31,6 +31,10 @@ namespace op } } + PoseExtractorCaffe::~PoseExtractorCaffe() + { + } + void PoseExtractorCaffe::netInitializationOnThread() { try @@ -86,7 +90,7 @@ namespace op #endif // 3. Get peaks by Non-Maximum Suppression - spNmsCaffe->setThreshold(get(PoseProperty::NMSThreshold)); + spNmsCaffe->setThreshold((float)get(PoseProperty::NMSThreshold)); #ifndef CPU_ONLY spNmsCaffe->Forward_gpu({spHeatMapsBlob.get()}, {spPeaksBlob.get()}); // ~2ms cudaCheck(__LINE__, __FUNCTION__, __FILE__); @@ -97,7 +101,7 @@ namespace op // Get scale net to output const auto scaleProducerToNetInput = resizeGetScaleFactor(inputDataSize, mNetOutputSize); const cv::Size netSize{intRound(scaleProducerToNetInput*inputDataSize.width), intRound(scaleProducerToNetInput*inputDataSize.height)}; - mScaleNetToOutput = {resizeGetScaleFactor(netSize, mOutputSize)}; + mScaleNetToOutput = {(float)resizeGetScaleFactor(netSize, mOutputSize)}; // 4. Connecting body parts spBodyPartConnectorCaffe->setScaleNetToOutput(mScaleNetToOutput); diff --git a/src/openpose/pose/poseParameters.cpp b/src/openpose/pose/poseParameters.cpp index 754bd86e..65255adf 100644 --- a/src/openpose/pose/poseParameters.cpp +++ b/src/openpose/pose/poseParameters.cpp @@ -1,11 +1,11 @@ -#include "openpose/utilities/errorAndLog.hpp" -#include "openpose/pose/poseParameters.hpp" +#include +#include namespace op { - const std::array, 3> POSE_BODY_PART_MAPPING{ POSE_COCO_BODY_PARTS, POSE_MPI_BODY_PARTS, POSE_MPI_BODY_PARTS }; + const std::array, 3> POSE_BODY_PART_MAPPING{ POSE_COCO_BODY_PARTS, POSE_MPI_BODY_PARTS, POSE_MPI_BODY_PARTS }; - unsigned char poseBodyPartMapStringToKey(const PoseModel poseModel, const std::vector& strings) + unsigned int poseBodyPartMapStringToKey(const PoseModel poseModel, const std::vector& strings) { try { @@ -24,29 +24,29 @@ namespace op } } - unsigned char poseBodyPartMapStringToKey(const PoseModel poseModel, const std::string& string) - { - try - { - return poseBodyPartMapStringToKey(poseModel, std::vector{string}); - } - catch (const std::exception& e) - { - error(e.what(), __LINE__, __FUNCTION__, __FILE__); - return 0; - } - } + unsigned int poseBodyPartMapStringToKey(const PoseModel poseModel, const std::string& string) + { + try + { + return poseBodyPartMapStringToKey(poseModel, std::vector{string}); + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + return 0; + } + } - const std::map& getPoseBodyPartMapping(const PoseModel poseModel) - { - try - { - return POSE_BODY_PART_MAPPING.at((int)poseModel); - } - catch (const std::exception& e) - { - error(e.what(), __LINE__, __FUNCTION__, __FILE__); - return POSE_BODY_PART_MAPPING[(int)poseModel]; - } - } + const std::map& getPoseBodyPartMapping(const PoseModel poseModel) + { + try + { + return POSE_BODY_PART_MAPPING.at((int)poseModel); + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + return POSE_BODY_PART_MAPPING[(int)poseModel]; + } + } } diff --git a/src/openpose/pose/poseRenderGpu.cu b/src/openpose/pose/poseRenderGpu.cu index 2820a134..2bc5123c 100644 --- a/src/openpose/pose/poseRenderGpu.cu +++ b/src/openpose/pose/poseRenderGpu.cu @@ -1,10 +1,10 @@ #include // std::pair -#include "openpose/pose/poseParameters.hpp" -#include "openpose/utilities/errorAndLog.hpp" -#include "openpose/utilities/cuda.hpp" -#include "openpose/utilities/cuda.hu" -#include "openpose/utilities/render.hu" -#include "openpose/pose/poseRenderGpu.hpp" +#include +#include +#include +#include +#include +#include namespace op { @@ -413,7 +413,7 @@ namespace op } void renderPoseGpu(float* framePtr, const PoseModel poseModel, const int numberPeople, const cv::Size& frameSize, const float* const posePtr, - const bool googlyEyes, const float blendOriginalFrame, const float alphaBlending) + const bool googlyEyes, const bool blendOriginalFrame, const float alphaBlending) { try { @@ -513,9 +513,9 @@ namespace op { try { - const auto numberBodyPartPairs = POSE_BODY_PART_PAIRS[(int)poseModel].size()/2; + const auto numberBodyPartPairs = (int)POSE_BODY_PART_PAIRS[(int)poseModel].size()/2; renderKeyPointsPartAffinityAux(framePtr, poseModel, frameSize, heatMapPtr, heatMapSize, scaleToKeepRatio, POSE_NUMBER_BODY_PARTS[(int)poseModel]+1, - numberBodyPartPairs, alphaBlending); + numberBodyPartPairs, alphaBlending); } catch (const std::exception& e) { diff --git a/src/openpose/pose/poseRenderer.cpp b/src/openpose/pose/poseRenderer.cpp index cbe8b475..2adcd7e6 100644 --- a/src/openpose/pose/poseRenderer.cpp +++ b/src/openpose/pose/poseRenderer.cpp @@ -1,14 +1,14 @@ #include #include -#include "openpose/pose/poseParameters.hpp" -#include "openpose/pose/poseRenderGpu.hpp" -#include "openpose/utilities/cuda.hpp" -#include "openpose/utilities/errorAndLog.hpp" -#include "openpose/pose/poseRenderer.hpp" +#include +#include +#include +#include +#include namespace op { - std::map createPartToName(const PoseModel poseModel) + std::map createPartToName(const PoseModel poseModel) { try { @@ -38,7 +38,7 @@ namespace op } PoseRenderer::PoseRenderer(const cv::Size& heatMapsSize, const cv::Size& outputSize, const PoseModel poseModel, const std::shared_ptr& poseExtractor, - const bool blendOriginalFrame, const float alphaPose, const float alphaHeatMap, const int elementToRender) : + const bool blendOriginalFrame, const float alphaPose, const float alphaHeatMap, const unsigned int elementToRender) : Renderer{(unsigned long long)(outputSize.area() * 3)}, mHeatMapsSize{heatMapsSize}, mOutputSize{outputSize}, @@ -91,10 +91,12 @@ namespace op { try { - mElementToRender = (mElementToRender + increment) % mNumberElementsToRender; + auto elementToRender = (((int)mElementToRender + increment) % mNumberElementsToRender); // Handling negative increments - while (mElementToRender < 0) - mElementToRender += mNumberElementsToRender; + while (elementToRender < 0) + elementToRender += mNumberElementsToRender; + // Update final value + mElementToRender = elementToRender; } catch (const std::exception& e) { @@ -214,7 +216,7 @@ namespace op } } - std::pair PoseRenderer::renderPose(Array& outputData, const Array& poseKeyPoints, const double scaleNetToOutput) + std::pair PoseRenderer::renderPose(Array& outputData, const Array& poseKeyPoints, const float scaleNetToOutput) { try { @@ -242,7 +244,7 @@ namespace op } else { - if (scaleNetToOutput == -1.) + if (scaleNetToOutput == -1.f) error("Non valid scaleNetToOutput.", __LINE__, __FUNCTION__, __FILE__); // Draw specific body part or bkg if (elementRendered <= numberBodyPartsPlusBkg) diff --git a/src/openpose/producer/defineTemplates.cpp b/src/openpose/producer/defineTemplates.cpp index d51b5bd5..aa8bf912 100644 --- a/src/openpose/producer/defineTemplates.cpp +++ b/src/openpose/producer/defineTemplates.cpp @@ -1,4 +1,4 @@ -#include "openpose/producer/headers.hpp" +#include namespace op { diff --git a/src/openpose/producer/imageDirectoryReader.cpp b/src/openpose/producer/imageDirectoryReader.cpp index f940767f..fc3dc377 100644 --- a/src/openpose/producer/imageDirectoryReader.cpp +++ b/src/openpose/producer/imageDirectoryReader.cpp @@ -1,8 +1,8 @@ -#include "openpose/filestream/fileStream.hpp" -#include "openpose/utilities/errorAndLog.hpp" -#include "openpose/utilities/fastMath.hpp" -#include "openpose/utilities/fileSystem.hpp" -#include "openpose/producer/imageDirectoryReader.hpp" +#include +#include +#include +#include +#include namespace op { @@ -78,9 +78,9 @@ namespace op return mResolution.width; } else if (capProperty == CV_CAP_PROP_POS_FRAMES) - return mFrameNameCounter; + return (double)mFrameNameCounter; else if (capProperty == CV_CAP_PROP_FRAME_COUNT) - return mFilePaths.size(); + return (double)mFilePaths.size(); else if (capProperty == CV_CAP_PROP_FPS) return -1.; else diff --git a/src/openpose/producer/producer.cpp b/src/openpose/producer/producer.cpp index 0efdde15..a63bb460 100644 --- a/src/openpose/producer/producer.cpp +++ b/src/openpose/producer/producer.cpp @@ -1,8 +1,8 @@ #include -#include "openpose/utilities/check.hpp" -#include "openpose/utilities/errorAndLog.hpp" -#include "openpose/utilities/fastMath.hpp" -#include "openpose/producer/producer.hpp" +#include +#include +#include +#include namespace op { @@ -107,7 +107,7 @@ namespace op // Individual checks if (property == ProducerProperty::AutoRepeat) { - check(!(bool)value || (mType == ProducerType::ImageDirectory || mType == ProducerType::Video), + check(value != 1. || (mType == ProducerType::ImageDirectory || mType == ProducerType::Video), "ProducerProperty::AutoRepeat only implemented for ProducerType::ImageDirectory and Video.", __LINE__, __FUNCTION__, __FILE__); } else if (property == ProducerProperty::Rotation) @@ -161,7 +161,7 @@ namespace op { // Rotate it if desired const auto rotationAngle = mProperties[(unsigned char)ProducerProperty::Rotation]; - const auto flipFrame = (bool)mProperties[(unsigned char)ProducerProperty::Flip]; + const auto flipFrame = (mProperties[(unsigned char)ProducerProperty::Flip] == 1.); if (rotationAngle == 0.) { if (flipFrame) diff --git a/src/openpose/producer/videoCaptureReader.cpp b/src/openpose/producer/videoCaptureReader.cpp index 2f671d8b..829e1ede 100644 --- a/src/openpose/producer/videoCaptureReader.cpp +++ b/src/openpose/producer/videoCaptureReader.cpp @@ -1,8 +1,8 @@ #include -#include "openpose/utilities/errorAndLog.hpp" -#include "openpose/utilities/fastMath.hpp" -#include "openpose/utilities/string.hpp" -#include "openpose/producer/videoCaptureReader.hpp" +#include +#include +#include +#include namespace op { diff --git a/src/openpose/producer/videoReader.cpp b/src/openpose/producer/videoReader.cpp index fb2a4ab4..f643dd79 100644 --- a/src/openpose/producer/videoReader.cpp +++ b/src/openpose/producer/videoReader.cpp @@ -1,6 +1,6 @@ -#include "openpose/utilities/errorAndLog.hpp" -#include "openpose/utilities/fileSystem.hpp" -#include "openpose/producer/videoReader.hpp" +#include +#include +#include namespace op { diff --git a/src/openpose/producer/webcamReader.cpp b/src/openpose/producer/webcamReader.cpp index d4068542..d6be9de3 100644 --- a/src/openpose/producer/webcamReader.cpp +++ b/src/openpose/producer/webcamReader.cpp @@ -1,8 +1,8 @@ #include #include -#include "openpose/utilities/errorAndLog.hpp" -#include "openpose/utilities/fastMath.hpp" -#include "openpose/producer/webcamReader.hpp" +#include +#include +#include namespace op { @@ -67,7 +67,7 @@ namespace op try { if (capProperty == CV_CAP_PROP_POS_FRAMES) - return mFrameNameCounter; + return (double)mFrameNameCounter; else return VideoCaptureReader::get(capProperty); } diff --git a/src/openpose/thread/defineTemplates.cpp b/src/openpose/thread/defineTemplates.cpp index 262931e4..13aa1116 100644 --- a/src/openpose/thread/defineTemplates.cpp +++ b/src/openpose/thread/defineTemplates.cpp @@ -1,4 +1,4 @@ -#include "openpose/thread/headers.hpp" +#include namespace op { diff --git a/src/openpose/utilities/cuda.cpp b/src/openpose/utilities/cuda.cpp index a0de64cf..63987fb3 100644 --- a/src/openpose/utilities/cuda.cpp +++ b/src/openpose/utilities/cuda.cpp @@ -1,8 +1,8 @@ #include #include -#include "openpose/utilities/errorAndLog.hpp" -#include "openpose/utilities/fastMath.hpp" -#include "openpose/utilities/cuda.hpp" +#include +#include +#include namespace op { @@ -17,6 +17,21 @@ namespace op error("Cuda check failed (" + std::to_string(errorCode) + " vs. " + std::to_string(cudaSuccess) + "): " + cudaGetErrorString(errorCode), line, function, file); } + dim3 getNumberCudaBlocks(const cv::Size& frameSize, const dim3 numberCudaThreads) + { + try + { + return dim3{getNumberCudaBlocks((unsigned int)frameSize.width, numberCudaThreads.x), + getNumberCudaBlocks((unsigned int)frameSize.height, numberCudaThreads.y), + numberCudaThreads.z}; + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + return dim3{}; + } + } + std::pair getNumberCudaThreadsAndBlocks(const cv::Size& frameSize) { try diff --git a/src/openpose/utilities/errorAndLog.cpp b/src/openpose/utilities/errorAndLog.cpp index 5c7de2ed..a787ddf1 100644 --- a/src/openpose/utilities/errorAndLog.cpp +++ b/src/openpose/utilities/errorAndLog.cpp @@ -2,7 +2,7 @@ #include // std::ifstream, std::ofstream #include // std::cout, std::endl #include // std::runtime_error -#include "openpose/utilities/errorAndLog.hpp" +#include namespace op { diff --git a/src/openpose/utilities/fileSystem.cpp b/src/openpose/utilities/fileSystem.cpp index 9ddc0877..498fc0de 100644 --- a/src/openpose/utilities/fileSystem.cpp +++ b/src/openpose/utilities/fileSystem.cpp @@ -1,7 +1,7 @@ #include #include -#include "openpose/utilities/errorAndLog.hpp" -#include "openpose/utilities/fileSystem.hpp" +#include +#include namespace op { diff --git a/src/openpose/utilities/openCv.cpp b/src/openpose/utilities/openCv.cpp index 971e4cb4..075a2342 100644 --- a/src/openpose/utilities/openCv.cpp +++ b/src/openpose/utilities/openCv.cpp @@ -1,6 +1,6 @@ -#include "openpose/utilities/errorAndLog.hpp" -#include "openpose/utilities/fastMath.hpp" -#include "openpose/utilities/openCv.hpp" +#include +#include +#include namespace op { diff --git a/src/openpose/utilities/profiler.cpp b/src/openpose/utilities/profiler.cpp index c7677f08..ade765e0 100644 --- a/src/openpose/utilities/profiler.cpp +++ b/src/openpose/utilities/profiler.cpp @@ -2,9 +2,9 @@ #include #include #include -#include "openpose/utilities/errorAndLog.hpp" -#include "openpose/utilities/macros.hpp" -#include "openpose/utilities/profiler.hpp" +#include +#include +#include // First, I apologize for the ugliness of the code of this function. Nevertheless, it has been made // in this way so that it has no computational impact at all if PROFILER_ENABLED is not defined. diff --git a/src/openpose/utilities/string.cpp b/src/openpose/utilities/string.cpp index fc3c55ca..d5c6aee4 100644 --- a/src/openpose/utilities/string.cpp +++ b/src/openpose/utilities/string.cpp @@ -1,5 +1,5 @@ -#include "openpose/utilities/errorAndLog.hpp" -#include "openpose/utilities/string.hpp" +#include +#include namespace op { diff --git a/src/openpose/wrapper/defineTemplates.cpp b/src/openpose/wrapper/defineTemplates.cpp index 9c1a6b3f..f4453c68 100644 --- a/src/openpose/wrapper/defineTemplates.cpp +++ b/src/openpose/wrapper/defineTemplates.cpp @@ -1,4 +1,4 @@ -#include "openpose/wrapper/headers.hpp" +#include namespace op { diff --git a/src/openpose/wrapper/wrapperStructFace.cpp b/src/openpose/wrapper/wrapperStructFace.cpp index a5b5e7e8..d65dd7d4 100644 --- a/src/openpose/wrapper/wrapperStructFace.cpp +++ b/src/openpose/wrapper/wrapperStructFace.cpp @@ -1,4 +1,4 @@ -#include "openpose/wrapper/wrapperStructFace.hpp" +#include namespace op { diff --git a/src/openpose/wrapper/wrapperStructHand.cpp b/src/openpose/wrapper/wrapperStructHand.cpp index e2f2dc46..5fdc4b92 100644 --- a/src/openpose/wrapper/wrapperStructHand.cpp +++ b/src/openpose/wrapper/wrapperStructHand.cpp @@ -1,4 +1,4 @@ -#include "openpose/wrapper/wrapperStructHand.hpp" +#include namespace op { diff --git a/src/openpose/wrapper/wrapperStructInput.cpp b/src/openpose/wrapper/wrapperStructInput.cpp index e31139a3..f812b94f 100644 --- a/src/openpose/wrapper/wrapperStructInput.cpp +++ b/src/openpose/wrapper/wrapperStructInput.cpp @@ -1,4 +1,4 @@ -#include "openpose/wrapper/wrapperStructInput.hpp" +#include namespace op { diff --git a/src/openpose/wrapper/wrapperStructOutput.cpp b/src/openpose/wrapper/wrapperStructOutput.cpp index 4e1e60db..463e9fa1 100644 --- a/src/openpose/wrapper/wrapperStructOutput.cpp +++ b/src/openpose/wrapper/wrapperStructOutput.cpp @@ -1,4 +1,4 @@ -#include "openpose/wrapper/wrapperStructOutput.hpp" +#include namespace op { diff --git a/src/openpose/wrapper/wrapperStructPose.cpp b/src/openpose/wrapper/wrapperStructPose.cpp index a5d9b974..9f07be4a 100644 --- a/src/openpose/wrapper/wrapperStructPose.cpp +++ b/src/openpose/wrapper/wrapperStructPose.cpp @@ -1,4 +1,4 @@ -#include "openpose/wrapper/wrapperStructPose.hpp" +#include namespace op {