From 4f524db4345898d02668a05675b907803d2d6096 Mon Sep 17 00:00:00 2001 From: Moeed Date: Mon, 23 Sep 2019 21:21:31 +0530 Subject: [PATCH 1/2] Merge pull request #2269 from shaikmoeed:hotfix/samples-motempl-python-update * Fix bug: Invalid Syntax at line 14(draw_motion_comp method) * Fix bug: TypeError- integer argument expected, got float * Fix bug: clean up the camera by adding .release() --- modules/optflow/samples/motempl.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/modules/optflow/samples/motempl.py b/modules/optflow/samples/motempl.py index 7d0d8ea89..5ac816401 100755 --- a/modules/optflow/samples/motempl.py +++ b/modules/optflow/samples/motempl.py @@ -11,10 +11,11 @@ MIN_TIME_DELTA = 0.05 def nothing(dummy): pass -def draw_motion_comp(vis, (x, y, w, h), angle, color): +def draw_motion_comp(vis, rect, angle, color): + x, y, w, h = rect cv.rectangle(vis, (x, y), (x+w, y+h), (0, 255, 0)) - r = min(w/2, h/2) - cx, cy = x+w/2, y+h/2 + r = min(w//2, h//2) + cx, cy = x+w//2, y+h//2 angle = angle*np.pi/180 cv.circle(vis, (cx, cy), r, color, 3) cv.line(vis, (cx, cy), (int(cx+np.cos(angle)*r), int(cy+np.sin(angle)*r)), color, 3) @@ -91,4 +92,6 @@ if __name__ == '__main__': prev_frame = frame.copy() if 0xFF & cv.waitKey(5) == 27: break + # cleanup the camera and close any open windows + cam.release() cv.destroyAllWindows() From cdd19ebead23b7ca407e92cbce2a497c52aa1279 Mon Sep 17 00:00:00 2001 From: Maksim Shabunin Date: Mon, 28 Jan 2019 14:48:32 +0300 Subject: [PATCH 2/2] backport: Fixed warnings produced by clang-9.0.0 83fc27cb99db4435d07974090fbdc77d831931cd --- modules/cvv/src/impl/call.hpp | 3 --- modules/face/src/facemarkLBF.cpp | 8 ++++---- modules/face/src/mace.cpp | 2 +- modules/optflow/src/optical_flow_io.cpp | 8 ++++---- modules/ovis/src/ovis.cpp | 2 +- modules/sfm/src/numeric.cpp | 2 +- modules/ximgproc/test/test_sparse_match_interpolator.cpp | 8 ++++---- 7 files changed, 15 insertions(+), 18 deletions(-) diff --git a/modules/cvv/src/impl/call.hpp b/modules/cvv/src/impl/call.hpp index e7e924aa5..cde9f3894 100644 --- a/modules/cvv/src/impl/call.hpp +++ b/modules/cvv/src/impl/call.hpp @@ -101,9 +101,6 @@ class Call Call(const Call &) = default; Call(Call &&) = default; - Call &operator=(const Call &) = default; - Call &operator=(Call &&) = default; - impl::CallMetaData metaData_; size_t id; QString calltype; diff --git a/modules/face/src/facemarkLBF.cpp b/modules/face/src/facemarkLBF.cpp index 642452b2d..264ec0379 100644 --- a/modules/face/src/facemarkLBF.cpp +++ b/modules/face/src/facemarkLBF.cpp @@ -666,7 +666,7 @@ Mat FacemarkLBFImpl::BBox::project(const Mat &shape) const { res(i, 0) = (shape_(i, 0) - x_center) / x_scale; res(i, 1) = (shape_(i, 1) - y_center) / y_scale; } - return res; + return CV_CXX_MOVE(res); } // Project relative shape to absolute shape binding to this bbox @@ -677,7 +677,7 @@ Mat FacemarkLBFImpl::BBox::reproject(const Mat &shape) const { res(i, 0) = shape_(i, 0)*x_scale + x_center; res(i, 1) = shape_(i, 1)*y_scale + y_center; } - return res; + return CV_CXX_MOVE(res); } Mat FacemarkLBFImpl::getMeanShape(std::vector >_shapes, std::vector &bboxes) { @@ -1038,7 +1038,7 @@ Mat FacemarkLBFImpl::RandomForest::generateLBF(Mat &img, Mat ¤t_shape, BBo lbf_feat(i*trees_n + j) = (i*trees_n + j)*base + code; } } - return lbf_feat; + return CV_CXX_MOVE(lbf_feat); } void FacemarkLBFImpl::RandomForest::write(FileStorage fs, int k) { @@ -1380,7 +1380,7 @@ Mat FacemarkLBFImpl::Regressor::globalRegressionPredict(const Mat &lbf, int stag for (int j = 0; j < lbf.cols; j++) y += w_ptr[lbf_ptr[j]]; delta_shape(i, 1) = y; } - return delta_shape; + return CV_CXX_MOVE(delta_shape); } // Regressor::globalRegressionPredict Mat FacemarkLBFImpl::Regressor::predict(Mat &img, BBox &bbox) { diff --git a/modules/face/src/mace.cpp b/modules/face/src/mace.cpp index 14a3a5eb0..d40e6ab7a 100644 --- a/modules/face/src/mace.cpp +++ b/modules/face/src/mace.cpp @@ -106,7 +106,7 @@ struct MACEImpl CV_FINAL : MACE { complexInput.copyTo(dftImg(Rect(0,0,IMGSIZE,IMGSIZE))); dft(dftImg, dftImg); - return dftImg; + return CV_CXX_MOVE(dftImg); } diff --git a/modules/optflow/src/optical_flow_io.cpp b/modules/optflow/src/optical_flow_io.cpp index ad70b121f..6ed0960b8 100644 --- a/modules/optflow/src/optical_flow_io.cpp +++ b/modules/optflow/src/optical_flow_io.cpp @@ -55,12 +55,12 @@ CV_EXPORTS_W Mat readOpticalFlow( const String& path ) Mat_ flow; std::ifstream file(path.c_str(), std::ios_base::binary); if ( !file.good() ) - return flow; // no file - return empty matrix + return CV_CXX_MOVE(flow); // no file - return empty matrix float tag; file.read((char*) &tag, sizeof(float)); if ( tag != FLOW_TAG_FLOAT ) - return flow; + return CV_CXX_MOVE(flow); int width, height; @@ -79,14 +79,14 @@ CV_EXPORTS_W Mat readOpticalFlow( const String& path ) if ( !file.good() ) { flow.release(); - return flow; + return CV_CXX_MOVE(flow); } flow(i, j) = u; } } file.close(); - return flow; + return CV_CXX_MOVE(flow); } CV_EXPORTS_W bool writeOpticalFlow( const String& path, InputArray flow ) { diff --git a/modules/ovis/src/ovis.cpp b/modules/ovis/src/ovis.cpp index 0f6d5889f..718755c1a 100644 --- a/modules/ovis/src/ovis.cpp +++ b/modules/ovis/src/ovis.cpp @@ -604,7 +604,7 @@ public: node.setScale(value[0], value[1], value[2]); } - void getEntityProperty(const String& name, int prop, OutputArray value) + void getEntityProperty(const String& name, int prop, OutputArray value) CV_OVERRIDE { SceneNode& node = _getSceneNode(sceneMgr, name); switch(prop) diff --git a/modules/sfm/src/numeric.cpp b/modules/sfm/src/numeric.cpp index 221afcf95..3115e164f 100644 --- a/modules/sfm/src/numeric.cpp +++ b/modules/sfm/src/numeric.cpp @@ -140,7 +140,7 @@ skewMat( const Mat_ &x ) x(2), 0 , -x(0), -x(1), x(0), 0; - return skew; + return CV_CXX_MOVE(skew); } Mat diff --git a/modules/ximgproc/test/test_sparse_match_interpolator.cpp b/modules/ximgproc/test/test_sparse_match_interpolator.cpp index 67f70c85f..7fb7e8fc6 100644 --- a/modules/ximgproc/test/test_sparse_match_interpolator.cpp +++ b/modules/ximgproc/test/test_sparse_match_interpolator.cpp @@ -20,12 +20,12 @@ Mat readOpticalFlow( const String& path ) Mat_ flow; std::ifstream file(path.c_str(), std::ios_base::binary); if ( !file.good() ) - return flow; // no file - return empty matrix + return CV_CXX_MOVE(flow); // no file - return empty matrix float tag; file.read((char*) &tag, sizeof(float)); if ( tag != FLOW_TAG_FLOAT ) - return flow; + return CV_CXX_MOVE(flow); int width, height; @@ -44,14 +44,14 @@ Mat readOpticalFlow( const String& path ) if ( !file.good() ) { flow.release(); - return flow; + return CV_CXX_MOVE(flow); } flow(i, j) = u; } } file.close(); - return flow; + return CV_CXX_MOVE(flow); } CV_ENUM(GuideTypes, CV_8UC1, CV_8UC3)