From 84e8a73a347c46ee8bebd5d1b20c48f233f61766 Mon Sep 17 00:00:00 2001 From: Alexander Smorkalov Date: Fri, 28 Feb 2025 15:12:08 +0300 Subject: [PATCH 1/2] Fixed export for Optical Flow PyrLK extention for FastCV. --- .../include/opencv2/fastcv/tracking.hpp | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/modules/fastcv/include/opencv2/fastcv/tracking.hpp b/modules/fastcv/include/opencv2/fastcv/tracking.hpp index 9cca92c1239..c8901705cde 100644 --- a/modules/fastcv/include/opencv2/fastcv/tracking.hpp +++ b/modules/fastcv/include/opencv2/fastcv/tracking.hpp @@ -29,13 +29,12 @@ namespace fastcv { * @param winSize Size of window for optical flow searching. Width and height ust be odd numbers. Suggested values are 5, 7 or 9 * @param termCriteria Termination criteria containing max number of iterations, max epsilon and stop condition */ -void trackOpticalFlowLK(InputArray src, InputArray dst, - InputArrayOfArrays srcPyr, InputArrayOfArrays dstPyr, - InputArray ptsIn, OutputArray ptsOut, InputArray ptsEst, - OutputArray statusVec, cv::Size winSize = {7, 7}, - cv::TermCriteria termCriteria = {cv::TermCriteria::MAX_ITER | cv::TermCriteria::EPS, - /* maxIterations */ 7, - /* maxEpsilon */ 0.03f * 0.03f}); +CV_EXPORTS_W void trackOpticalFlowLK(InputArray src, InputArray dst, + InputArrayOfArrays srcPyr, InputArrayOfArrays dstPyr, + InputArray ptsIn, OutputArray ptsOut, InputArray ptsEst, + OutputArray statusVec, cv::Size winSize = cv::Size(7, 7), + cv::TermCriteria termCriteria = cv::TermCriteria(cv::TermCriteria::MAX_ITER | cv::TermCriteria::EPS, + /* maxIterations */ 7, /* maxEpsilon */ 0.03f * 0.03f)); /** * @brief Overload for v1 of the LK tracking function @@ -52,11 +51,11 @@ void trackOpticalFlowLK(InputArray src, InputArray dst, * @param winSize Size of window for optical flow searching. Width and height ust be odd numbers. Suggested values are 5, 7 or 9 * @param maxIterations Maximum number of iterations to try */ -void trackOpticalFlowLK(InputArray src, InputArray dst, - InputArrayOfArrays srcPyr, InputArrayOfArrays dstPyr, - InputArrayOfArrays srcDxPyr, InputArrayOfArrays srcDyPyr, - InputArray ptsIn, OutputArray ptsOut, - OutputArray statusVec, cv::Size winSize = {7, 7}, int maxIterations = 7); +CV_EXPORTS_W void trackOpticalFlowLK(InputArray src, InputArray dst, + InputArrayOfArrays srcPyr, InputArrayOfArrays dstPyr, + InputArrayOfArrays srcDxPyr, InputArrayOfArrays srcDyPyr, + InputArray ptsIn, OutputArray ptsOut, + OutputArray statusVec, cv::Size winSize = cv::Size(7, 7), int maxIterations = 7); //! @} From 62e97dad2a5cedaa80ea2024c6697725766a51f5 Mon Sep 17 00:00:00 2001 From: Alexander Smorkalov Date: Mon, 3 Mar 2025 09:22:59 +0300 Subject: [PATCH 2/2] Warning fixes for FastCV module. --- modules/fastcv/perf/perf_hough.cpp | 4 ++-- modules/fastcv/test/test_mser.cpp | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/fastcv/perf/perf_hough.cpp b/modules/fastcv/perf/perf_hough.cpp index 78424a696dc..a809de514eb 100644 --- a/modules/fastcv/perf/perf_hough.cpp +++ b/modules/fastcv/perf/perf_hough.cpp @@ -21,7 +21,7 @@ PERF_TEST_P(HoughLinesPerfTest, run, { auto p = GetParam(); std::string fname = std::get<0>(p); - double threshold = std::get<1>(p); + double thrld = std::get<1>(p); cv::Mat src = imread(cvtest::findDataFile(fname), cv::IMREAD_GRAYSCALE); // make it aligned by 8 @@ -34,7 +34,7 @@ PERF_TEST_P(HoughLinesPerfTest, run, { std::vector lines; startTimer(); - cv::fastcv::houghLines(src, lines, threshold); + cv::fastcv::houghLines(src, lines, thrld); stopTimer(); } diff --git a/modules/fastcv/test/test_mser.cpp b/modules/fastcv/test/test_mser.cpp index d3cb35bf47e..b334915c474 100644 --- a/modules/fastcv/test/test_mser.cpp +++ b/modules/fastcv/test/test_mser.cpp @@ -81,12 +81,12 @@ TEST_P(MSERTest, accuracy) // find pair of contours by similar moments typedef cv::Matx MomentVec; - auto calcEstimate = [](const std::vector>& contours, Size srcSize) -> std::vector> + auto calcEstimate = [](const std::vector>& ctrs, Size srcSize) -> std::vector> { std::vector> res; - for (size_t i = 0; i < contours.size(); i++) + for (size_t i = 0; i < ctrs.size(); i++) { - const std::vector& contour = contours[i]; + const std::vector& contour = ctrs[i]; Mat ptsMap(srcSize, CV_8U, Scalar(255)); for(size_t j = 0; j < contour.size(); ++j) {