Skip to content

Commit 9f07a43

Browse files
committed
Fixed pybind build on windows
1 parent efd21fc commit 9f07a43

3 files changed

Lines changed: 14 additions & 11 deletions

File tree

setup.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,11 @@ def run(self):
5050
if hasattr(self.distribution, 'bin_dir'):
5151
bin_dir = self.distribution.bin_dir
5252
else:
53-
bin_dir = os.path.join(self.build_dir)
53+
bin_dir = os.path.join(self.build_dir, "Release")
54+
if not os.path.exists(bin_dir):
55+
bin_dir = "build/Release"
56+
self.build_dir = "build/Release"
57+
print("bin_dir:", bin_dir, "build_dir:", self.build_dir)
5458
# Depending on the files that are generated from your cmake
5559
# build chain, you may need to change the below code, such that
5660
# your files are moved to the appropriate location when the installation

src/Detector/MotionDetector.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
///
77
/// \brief The MotionDetector class
88
///
9-
class MotionDetector final : public BaseDetector
9+
class MotionDetector : public BaseDetector
1010
{
1111
public:
1212
MotionDetector(BackgroundSubtract::BGFG_ALGS algType, const cv::UMat& gray);

src/python_bind/mtracker.cpp

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,14 @@ struct type_caster<cv::Mat>{
4444
int nh = 1;
4545
int nw = 1;
4646
int nc = 1;
47-
int ndims = info.ndim;
47+
int ndims = static_cast<int>(info.ndim);
4848
if(ndims == 2){
49-
nh = info.shape[0];
50-
nw = info.shape[1];
49+
nh = static_cast<int>(info.shape[0]);
50+
nw = static_cast<int>(info.shape[1]);
5151
} else if(ndims == 3){
52-
nh = info.shape[0];
53-
nw = info.shape[1];
54-
nc = info.shape[2];
52+
nh = static_cast<int>(info.shape[0]);
53+
nw = static_cast<int>(info.shape[1]);
54+
nc = static_cast<int>(info.shape[2]);
5555
}else{
5656
char msg[64];
5757
std::sprintf(msg, "Unsupported dim %d, only support 2d, or 3-d", ndims);
@@ -133,7 +133,7 @@ struct type_caster<cv::Size_<T>>{
133133
return false;
134134
}
135135

136-
value = cv::Size(pt[0].cast<T>(), pt[1].cast<T>());
136+
value = cv::Size(static_cast<int>(pt[0].cast<T>()), static_cast<int>(pt[1].cast<T>()));
137137
return true;
138138
}
139139

@@ -409,7 +409,7 @@ PYBIND11_MODULE(pymtracking, m)
409409
base_detector.def("SetMinObjectSize", &BaseDetector::SetMinObjectSize);
410410
base_detector.def("GetDetects", &BaseDetector::GetDetects);
411411
base_detector.def("CalcMotionMap", &BaseDetector::CalcMotionMap);
412-
#if 1
412+
413413
py::class_<MotionDetector, PyMotionDetector> mdetector(m, "MotionDetector");
414414
mdetector.def(py::init<BackgroundSubtract::BGFG_ALGS, cv::Mat&>());
415415
mdetector.def("Init", &MotionDetector::Init);
@@ -429,7 +429,6 @@ PYBIND11_MODULE(pymtracking, m)
429429
.value("LOBSTER", BackgroundSubtract::BGFG_ALGS::ALG_LOBSTER)
430430
.value("MOG2", BackgroundSubtract::BGFG_ALGS::ALG_MOG2)
431431
.export_values();
432-
#endif
433432

434433
py::enum_<tracking::Detectors>(base_detector, "Detectors")
435434
.value("VIBE", tracking::Detectors::Motion_VIBE)

0 commit comments

Comments
 (0)