Skip to content

Commit d414c81

Browse files
Added #185 fix
1 parent 4412720 commit d414c81

26 files changed

+144
-86
lines changed

.github/issue_template.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,6 @@ You might select multiple topics, delete the rest:
3838
**cuDNN version**:
3939
**GPU model** (`nvidia-smi` in Ubuntu):
4040
**Caffe version**: Default from OpenPose or custom version.
41-
**OpenCV version**: installed with `apt-get install libopencv-dev` (Ubuntu) or default from OpenPose (Windows) or OpenCV 2.X or OpenCV 3.X.
41+
**OpenCV version**: installed with `apt-get install libopencv-dev` (Ubuntu) or default from OpenPose (Windows) or OpenCV 2.X or OpenCV 3.X. Especify **full version** (e.g. 3.3.1)
4242
Generation mode (only for Ubuntu): Makefile + Makefile.config (default, Ubuntu) or CMake (Ubuntu, Windows) or Visual Studio (Windows).
4343
Compiler (`gcc --version` in Ubuntu):

examples_beta/openpose3d/src/pointGrey.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ cv::Mat pointGreyToCvMat(const Spinnaker::ImagePtr &imagePtr)
1818
const auto colsize = imagePtr->GetHeight();
1919

2020
// image data contains padding. When allocating cv::Mat container size, you need to account for the X,Y image data padding.
21-
return cv::Mat{(int)(colsize + YPadding), (int)(rowsize + XPadding), CV_8UC3, imagePtr->GetData(), imagePtr->GetStride()};
21+
return cv::Mat((int)(colsize + YPadding), (int)(rowsize + XPadding), CV_8UC3, imagePtr->GetData(), imagePtr->GetStride());
2222
}
2323
catch (const std::exception& e)
2424
{
2525
op::error(e.what(), __LINE__, __FUNCTION__, __FILE__);
26-
return cv::Mat{};
26+
return cv::Mat();
2727
}
2828
}
2929

examples_beta/openpose3d/src/reconstruction3D.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ void reconstructArray(op::Array<float>& keypoints3D, const std::vector<op::Array
108108
// 3D points to pose
109109
// OpenCV alternative:
110110
// // http://docs.opencv.org/2.4/modules/calib3d/doc/camera_calibration_and_3d_reconstruction.html#triangulatepoints
111-
// cv::Mat reconstructedcv::Points{4, firstcv::Points.size(), CV_64F};
111+
// cv::Mat reconstructedPoints{4, firstcv::Points.size(), CV_64F};
112112
// cv::triangulatecv::Points(cv::Mat::eye(3,4, CV_64F), M_3_1, firstcv::Points, secondcv::Points, reconstructedcv::Points);
113113
keypoints3D = op::Array<float>{ { 1, numberBodyParts, 4 }, 0 };
114114
for (auto index = 0u; index < indexesUsed.size(); index++)

examples_beta/openpose3d/src/renderer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ WRender3D::WRender3D(const op::PoseModel poseModel)
341341
// Update sPoseModel
342342
sPoseModel = poseModel;
343343
// Init display
344-
cv::imshow(GUI_NAME, cv::Mat{ 500, 500, CV_8UC3, cv::Scalar{ 0,0,0 } });
344+
cv::imshow(GUI_NAME, cv::Mat( 500, 500, CV_8UC3, cv::Scalar{ 0,0,0 } ));
345345
//Run OpenGL
346346
mRenderThread = std::thread{ &WRender3D::visualizationThread, this };
347347
}

include/openpose/core/opOutputToCvMat.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ namespace op
1414
cv::Mat formatToCvMat(const Array<float>& outputData) const;
1515

1616
private:
17-
const Point<int> mOutputResolution;
17+
const std::array<int, 3> mOutputResolution;
1818
};
1919
}
2020

include/openpose/gui/gui.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ namespace op
2020

2121
void initializationOnThread();
2222

23-
void update(const cv::Mat& cvOutputData = cv::Mat{});
23+
void update(const cv::Mat& cvOutputData = cv::Mat());
2424

2525
private:
2626
// Frames display

include/openpose/gui/wGui.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ namespace op
6969
// T* to T
7070
auto& tDatumsNoPtr = *tDatums;
7171
// Refresh GUI
72-
const auto cvOutputData = (!tDatumsNoPtr.empty() ? tDatumsNoPtr[0].cvOutputData : cv::Mat{});
72+
const auto cvOutputData = (!tDatumsNoPtr.empty() ? tDatumsNoPtr[0].cvOutputData : cv::Mat());
7373
spGui->update(cvOutputData);
7474
// Profiling speed
7575
if (!tDatumsNoPtr.empty())

include/openpose/pose/enumClasses.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ namespace op
1111
COCO_18 = 0, /**< COCO model, with 18+1 components (see poseParameters.hpp for details). */
1212
MPI_15 = 1, /**< MPI model, with 15+1 components (see poseParameters.hpp for details). */
1313
MPI_15_4 = 2, /**< Variation of the MPI model, reduced number of CNN stages to 4: faster but less accurate.*/
14-
BODY_22 = 3, /**< Experimental. Do not use. */
14+
BODY_18 = 3, /**< Experimental. Do not use. */
15+
BODY_22 = 4, /**< Experimental. Do not use. */
1516
Size,
1617
};
1718

include/openpose/pose/poseParameters.hpp

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,15 @@ namespace op
101101
0.f, 85.f, 255.f, \
102102
0.f, 0.f, 255.f
103103
const std::vector<float> POSE_MPI_COLORS_RENDER{POSE_MPI_COLORS_RENDER_GPU};
104+
// BODY_18
105+
const std::map<unsigned int, std::string> POSE_BODY_18_BODY_PARTS {POSE_COCO_BODY_PARTS};
106+
const unsigned int POSE_BODY_18_NUMBER_PARTS {POSE_COCO_NUMBER_PARTS};
107+
const std::vector<unsigned int> POSE_BODY_18_MAP_IDX {POSE_COCO_MAP_IDX};
108+
#define POSE_BODY_18_PAIRS_RENDER_GPU POSE_COCO_PAIRS_RENDER_GPU
109+
const std::vector<unsigned int> POSE_BODY_18_PAIRS_RENDER {POSE_BODY_18_PAIRS_RENDER_GPU};
110+
const std::vector<unsigned int> POSE_BODY_18_PAIRS {POSE_COCO_PAIRS};
111+
#define POSE_BODY_18_COLORS_RENDER_GPU POSE_COCO_COLORS_RENDER_GPU
112+
const std::vector<float> POSE_BODY_18_COLORS_RENDER {POSE_BODY_18_COLORS_RENDER_GPU};
104113
// BODY_22 (experimental, do not use)
105114
const std::map<unsigned int, std::string> POSE_BODY_22_BODY_PARTS {
106115
{0, "Nose"},
@@ -161,30 +170,32 @@ namespace op
161170
POSE_MAX_PEOPLE, POSE_MAX_PEOPLE, POSE_MAX_PEOPLE, POSE_MAX_PEOPLE
162171
};
163172
const std::array<unsigned int, (int)PoseModel::Size> POSE_NUMBER_BODY_PARTS{
164-
POSE_COCO_NUMBER_PARTS, POSE_MPI_NUMBER_PARTS, POSE_MPI_NUMBER_PARTS, POSE_BODY_22_NUMBER_PARTS
173+
POSE_COCO_NUMBER_PARTS, POSE_MPI_NUMBER_PARTS, POSE_MPI_NUMBER_PARTS, POSE_BODY_18_NUMBER_PARTS, POSE_BODY_22_NUMBER_PARTS
165174
};
166175
const std::array<std::vector<unsigned int>, (int)PoseModel::Size> POSE_BODY_PART_PAIRS{
167-
POSE_COCO_PAIRS, POSE_MPI_PAIRS, POSE_MPI_PAIRS, POSE_BODY_22_PAIRS
176+
POSE_COCO_PAIRS, POSE_MPI_PAIRS, POSE_MPI_PAIRS, POSE_BODY_18_PAIRS, POSE_BODY_22_PAIRS
168177
};
169178
const std::array<std::vector<unsigned int>, (int)PoseModel::Size> POSE_BODY_PART_PAIRS_RENDER{
170-
POSE_COCO_PAIRS_RENDER, POSE_MPI_PAIRS, POSE_MPI_PAIRS, POSE_BODY_22_PAIRS_RENDER
179+
POSE_COCO_PAIRS_RENDER, POSE_MPI_PAIRS, POSE_MPI_PAIRS, POSE_BODY_18_PAIRS_RENDER, POSE_BODY_22_PAIRS_RENDER
171180
};
172181
const std::array<std::vector<unsigned int>, (int)PoseModel::Size> POSE_MAP_IDX{
173-
POSE_COCO_MAP_IDX, POSE_MPI_MAP_IDX, POSE_MPI_MAP_IDX, POSE_BODY_22_MAP_IDX
182+
POSE_COCO_MAP_IDX, POSE_MPI_MAP_IDX, POSE_MPI_MAP_IDX, POSE_BODY_18_MAP_IDX, POSE_BODY_22_MAP_IDX
174183
};
175184
const std::array<std::vector<float>, (int)PoseModel::Size> POSE_COLORS{
176-
POSE_COCO_COLORS_RENDER,POSE_MPI_COLORS_RENDER, POSE_MPI_COLORS_RENDER, POSE_BODY_22_COLORS_RENDER
185+
POSE_COCO_COLORS_RENDER,POSE_MPI_COLORS_RENDER, POSE_MPI_COLORS_RENDER, POSE_BODY_18_COLORS_RENDER, POSE_BODY_22_COLORS_RENDER
177186
};
178187
const std::array<std::string, (int)PoseModel::Size> POSE_PROTOTXT{
179188
"pose/coco/pose_deploy_linevec.prototxt",
180189
"pose/mpi/pose_deploy_linevec.prototxt",
181190
"pose/mpi/pose_deploy_linevec_faster_4_stages.prototxt",
191+
"pose/body_18/pose_deploy.prototxt",
182192
"pose/body_22/pose_deploy.prototxt"
183193
};
184194
const std::array<std::string, (int)PoseModel::Size> POSE_TRAINED_MODEL{
185195
"pose/coco/pose_iter_440000.caffemodel",
186196
"pose/mpi/pose_iter_160000.caffemodel",
187197
"pose/mpi/pose_iter_160000.caffemodel",
198+
"pose/body_18/pose_iter_XXXXXX.caffemodel",
188199
"pose/body_22/pose_iter_40000.caffemodel"
189200
};
190201
// POSE_BODY_PART_MAPPING crashes on Windows at dynamic initialization, to avoid this crash:
@@ -197,19 +208,19 @@ namespace op
197208
// Default Model Parameters
198209
// They might be modified on running time
199210
const std::array<float, (int)PoseModel::Size> POSE_DEFAULT_NMS_THRESHOLD{
200-
0.05f, 0.6f, 0.3f, 0.05f
211+
0.05f, 0.6f, 0.3f, 0.05f, 0.05f
201212
};
202213
const std::array<unsigned int, (int)PoseModel::Size> POSE_DEFAULT_CONNECT_INTER_MIN_ABOVE_THRESHOLD{
203-
9, 8, 8, 9
214+
9, 8, 8, 9, 9
204215
};
205216
const std::array<float, (int)PoseModel::Size> POSE_DEFAULT_CONNECT_INTER_THRESHOLD{
206-
0.05f, 0.01f, 0.01f, 0.05f
217+
0.05f, 0.01f, 0.01f, 0.05f, 0.05f
207218
};
208219
const std::array<unsigned int, (int)PoseModel::Size> POSE_DEFAULT_CONNECT_MIN_SUBSET_CNT{
209-
3, 3, 3, 3
220+
3, 3, 3, 3, 3
210221
};
211222
const std::array<float, (int)PoseModel::Size> POSE_DEFAULT_CONNECT_MIN_SUBSET_SCORE{
212-
0.4f, 0.4f, 0.4f, 0.4f
223+
0.4f, 0.4f, 0.4f, 0.4f, 0.4f
213224
};
214225

215226
// Rendering parameters

include/openpose/utilities/openCv.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ namespace op
99
{
1010
OP_API void putTextOnCvMat(cv::Mat& cvMat, const std::string& textToDisplay, const Point<int>& position, const cv::Scalar& color, const bool normalizeWidth);
1111

12-
OP_API void floatPtrToUCharCvMat(cv::Mat& cvMat, const float* const floatImage, const Point<int>& resolutionSize, const int resolutionChannels);
12+
OP_API void floatPtrToUCharCvMat(cv::Mat& uCharCvMat, const float* const floatPtrImage, const std::array<int, 3> resolutionSize);
1313

1414
OP_API void unrollArrayToUCharCvMat(cv::Mat& cvMatResult, const Array<float>& array);
1515

16-
OP_API void uCharCvMatToFloatPtr(float* floatImage, const cv::Mat& cvImage, const bool normalize);
16+
OP_API void uCharCvMatToFloatPtr(float* floatPtrImage, const cv::Mat& cvImage, const bool normalize);
1717

1818
OP_API double resizeGetScaleFactor(const Point<int>& initialSize, const Point<int>& targetSize);
1919

0 commit comments

Comments
 (0)