From a494c75bfebc869c48be9f91eb2150c056ecdc5a Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Thu, 15 Dec 2022 21:57:41 +0000 Subject: [PATCH 1/3] pre: OpenCV 3.4.19 (version++) --- .../cross_referencing/tutorial_cross_referencing.markdown | 4 ++-- modules/core/include/opencv2/core/version.hpp | 4 ++-- modules/dnn/include/opencv2/dnn/dnn.hpp | 4 ++-- modules/python/package/setup.py | 2 +- platforms/android/build_sdk.py | 2 +- platforms/android/service/readme.txt | 2 +- platforms/maven/opencv-it/pom.xml | 2 +- platforms/maven/opencv/pom.xml | 2 +- platforms/maven/pom.xml | 2 +- 9 files changed, 12 insertions(+), 12 deletions(-) diff --git a/doc/tutorials/introduction/cross_referencing/tutorial_cross_referencing.markdown b/doc/tutorials/introduction/cross_referencing/tutorial_cross_referencing.markdown index 740f455c2b..daa7c396cd 100644 --- a/doc/tutorials/introduction/cross_referencing/tutorial_cross_referencing.markdown +++ b/doc/tutorials/introduction/cross_referencing/tutorial_cross_referencing.markdown @@ -39,14 +39,14 @@ Open your Doxyfile using your favorite text editor and search for the key `TAGFILES`. Change it as follows: @code -TAGFILES = ./docs/doxygen-tags/opencv.tag=http://docs.opencv.org/3.4.18 +TAGFILES = ./docs/doxygen-tags/opencv.tag=http://docs.opencv.org/3.4.19 @endcode If you had other definitions already, you can append the line using a `\`: @code TAGFILES = ./docs/doxygen-tags/libstdc++.tag=https://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen \ - ./docs/doxygen-tags/opencv.tag=http://docs.opencv.org/3.4.18 + ./docs/doxygen-tags/opencv.tag=http://docs.opencv.org/3.4.19 @endcode Doxygen can now use the information from the tag file to link to the OpenCV diff --git a/modules/core/include/opencv2/core/version.hpp b/modules/core/include/opencv2/core/version.hpp index 9bfa15e538..aa1e8f6a83 100644 --- a/modules/core/include/opencv2/core/version.hpp +++ b/modules/core/include/opencv2/core/version.hpp @@ -7,8 +7,8 @@ #define CV_VERSION_MAJOR 3 #define CV_VERSION_MINOR 4 -#define CV_VERSION_REVISION 18 -#define CV_VERSION_STATUS "-dev" +#define CV_VERSION_REVISION 19 +#define CV_VERSION_STATUS "-pre" #define CVAUX_STR_EXP(__A) #__A #define CVAUX_STR(__A) CVAUX_STR_EXP(__A) diff --git a/modules/dnn/include/opencv2/dnn/dnn.hpp b/modules/dnn/include/opencv2/dnn/dnn.hpp index 2368313c64..f118a0f428 100644 --- a/modules/dnn/include/opencv2/dnn/dnn.hpp +++ b/modules/dnn/include/opencv2/dnn/dnn.hpp @@ -47,9 +47,9 @@ #include "opencv2/core/async.hpp" #if !defined CV_DOXYGEN && !defined CV_STATIC_ANALYSIS && !defined CV_DNN_DONT_ADD_EXPERIMENTAL_NS -#define CV__DNN_EXPERIMENTAL_NS_BEGIN namespace experimental_dnn_34_v25 { +#define CV__DNN_EXPERIMENTAL_NS_BEGIN namespace experimental_dnn_34_v26 { #define CV__DNN_EXPERIMENTAL_NS_END } -namespace cv { namespace dnn { namespace experimental_dnn_34_v25 { } using namespace experimental_dnn_34_v25; }} +namespace cv { namespace dnn { namespace experimental_dnn_34_v26 { } using namespace experimental_dnn_34_v26; }} #else #define CV__DNN_EXPERIMENTAL_NS_BEGIN #define CV__DNN_EXPERIMENTAL_NS_END diff --git a/modules/python/package/setup.py b/modules/python/package/setup.py index ca8fe9138f..1356931720 100644 --- a/modules/python/package/setup.py +++ b/modules/python/package/setup.py @@ -9,7 +9,7 @@ def main(): os.chdir(SCRIPT_DIR) package_name = 'opencv' - package_version = os.environ.get('OPENCV_VERSION', '3.4.18') # TODO + package_version = os.environ.get('OPENCV_VERSION', '3.4.19') # TODO long_description = 'Open Source Computer Vision Library Python bindings' # TODO diff --git a/platforms/android/build_sdk.py b/platforms/android/build_sdk.py index 7974909f05..3a9618b835 100755 --- a/platforms/android/build_sdk.py +++ b/platforms/android/build_sdk.py @@ -269,7 +269,7 @@ class Builder: # Add extra data apkxmldest = check_dir(os.path.join(apkdest, "res", "xml"), create=True) apklibdest = check_dir(os.path.join(apkdest, "libs", abi.name), create=True) - for ver, d in self.extra_packs + [("3.4.18", os.path.join(self.libdest, "lib"))]: + for ver, d in self.extra_packs + [("3.4.19", os.path.join(self.libdest, "lib"))]: r = ET.Element("library", attrib={"version": ver}) log.info("Adding libraries from %s", d) diff --git a/platforms/android/service/readme.txt b/platforms/android/service/readme.txt index 7be50dd205..11e9f0bae8 100644 --- a/platforms/android/service/readme.txt +++ b/platforms/android/service/readme.txt @@ -12,7 +12,7 @@ manually using adb tool: adb install /apk/OpenCV__Manager__.apk -Example: OpenCV_3.4.18-dev_Manager_3.49_armeabi-v7a.apk +Example: OpenCV_3.4.19-dev_Manager_3.49_armeabi-v7a.apk Use the list of platforms below to determine proper OpenCV Manager package for your device: diff --git a/platforms/maven/opencv-it/pom.xml b/platforms/maven/opencv-it/pom.xml index a344b91e90..befb75fed5 100644 --- a/platforms/maven/opencv-it/pom.xml +++ b/platforms/maven/opencv-it/pom.xml @@ -4,7 +4,7 @@ org.opencv opencv-parent - 3.4.18 + 3.4.19 org.opencv opencv-it diff --git a/platforms/maven/opencv/pom.xml b/platforms/maven/opencv/pom.xml index feb3e97aaa..0ff0c6fe2f 100644 --- a/platforms/maven/opencv/pom.xml +++ b/platforms/maven/opencv/pom.xml @@ -4,7 +4,7 @@ org.opencv opencv-parent - 3.4.18 + 3.4.19 org.opencv opencv diff --git a/platforms/maven/pom.xml b/platforms/maven/pom.xml index e5bf9264d3..19ba7d07b3 100644 --- a/platforms/maven/pom.xml +++ b/platforms/maven/pom.xml @@ -3,7 +3,7 @@ 4.0.0 org.opencv opencv-parent - 3.4.18 + 3.4.19 pom OpenCV Parent POM From 93aa94e71ef29cad2622be394ecb4c0233ab57eb Mon Sep 17 00:00:00 2001 From: Rostislav Vasilikhin Date: Sat, 24 Dec 2022 04:08:43 +0100 Subject: [PATCH 2/3] backported changes no lambda whitespace fixing build Java tests --- .../calib3d/misc/java/test/Calib3dTest.java | 8 +- modules/calib3d/src/fisheye.cpp | 4 +- modules/calib3d/test/test_fisheye.cpp | 74 ++++++++++++------- 3 files changed, 53 insertions(+), 33 deletions(-) diff --git a/modules/calib3d/misc/java/test/Calib3dTest.java b/modules/calib3d/misc/java/test/Calib3dTest.java index ae5377efc5..7d89cc9bd1 100644 --- a/modules/calib3d/misc/java/test/Calib3dTest.java +++ b/modules/calib3d/misc/java/test/Calib3dTest.java @@ -699,10 +699,10 @@ public class Calib3dTest extends OpenCVTestCase { D.put(2,0,-0.021509225493198905); D.put(3,0,0.0043378096628297145); - K_new_truth.put(0,0, 387.4809086880343); - K_new_truth.put(0,2, 1036.669802754649); - K_new_truth.put(1,1, 373.6375700303157); - K_new_truth.put(1,2, 538.8373261247601); + K_new_truth.put(0,0, 387.5118215642316); + K_new_truth.put(0,2, 1033.936556777084); + K_new_truth.put(1,1, 373.6673784974842); + K_new_truth.put(1,2, 538.794152656429); Calib3d.fisheye_estimateNewCameraMatrixForUndistortRectify(K,D,new Size(1920,1080), new Mat().eye(3, 3, CvType.CV_64F), K_new, 0.0, new Size(1920,1080)); diff --git a/modules/calib3d/src/fisheye.cpp b/modules/calib3d/src/fisheye.cpp index 56fd82114d..a562bd2bb2 100644 --- a/modules/calib3d/src/fisheye.cpp +++ b/modules/calib3d/src/fisheye.cpp @@ -388,7 +388,7 @@ void cv::fisheye::undistortPoints( InputArray distorted, OutputArray undistorted if (theta_d > 1e-8) { - // compensate distortion iteratively + // compensate distortion iteratively using Newton method double theta = theta_d; const double EPS = 1e-8; // or std::numeric_limits::epsilon(); @@ -572,7 +572,7 @@ void cv::fisheye::estimateNewCameraMatrixForUndistortRectify(InputArray K, Input : K.getMat().at(0,0)/K.getMat().at(1,1); // convert to identity ratio - cn[0] *= aspect_ratio; + cn[1] *= aspect_ratio; for(size_t i = 0; i < points.total(); ++i) pptr[i][1] *= aspect_ratio; diff --git a/modules/calib3d/test/test_fisheye.cpp b/modules/calib3d/test/test_fisheye.cpp index 58a79dcc88..2e12cd8985 100644 --- a/modules/calib3d/test/test_fisheye.cpp +++ b/modules/calib3d/test/test_fisheye.cpp @@ -101,6 +101,15 @@ TEST_F(fisheyeTest, projectPoints) EXPECT_MAT_NEAR(distorted0, distorted2, 1e-10); } +// we use it to reduce patch size for images in testdata +static void throwAwayHalf(Mat img) +{ + int whalf = img.cols / 2, hhalf = img.rows / 2; + Rect tl(0, 0, whalf, hhalf), br(whalf, hhalf, whalf, hhalf); + img(tl) = 0; + img(br) = 0; +}; + TEST_F(fisheyeTest, undistortImage) { cv::Matx33d theK = this->K; @@ -112,32 +121,41 @@ TEST_F(fisheyeTest, undistortImage) newK(0, 0) = 100; newK(1, 1) = 100; cv::fisheye::undistortImage(distorted, undistorted, theK, theD, newK); - cv::Mat correct = cv::imread(combine(datasets_repository_path, "new_f_100.png")); - if (correct.empty()) - CV_Assert(cv::imwrite(combine(datasets_repository_path, "new_f_100.png"), undistorted)); - else - EXPECT_MAT_NEAR(correct, undistorted, 1e-10); + std::string imageFilename = combine(datasets_repository_path, "new_f_100.png"); + cv::Mat correct = cv::imread(imageFilename); + ASSERT_FALSE(correct.empty()) << "Correct image " << imageFilename.c_str() << " can not be read" << std::endl; + + throwAwayHalf(correct); + throwAwayHalf(undistorted); + + EXPECT_MAT_NEAR(correct, undistorted, 1e-10); } { double balance = 1.0; cv::fisheye::estimateNewCameraMatrixForUndistortRectify(theK, theD, distorted.size(), cv::noArray(), newK, balance); cv::fisheye::undistortImage(distorted, undistorted, theK, theD, newK); - cv::Mat correct = cv::imread(combine(datasets_repository_path, "balance_1.0.png")); - if (correct.empty()) - CV_Assert(cv::imwrite(combine(datasets_repository_path, "balance_1.0.png"), undistorted)); - else - EXPECT_MAT_NEAR(correct, undistorted, 1e-10); + std::string imageFilename = combine(datasets_repository_path, "balance_1.0.png"); + cv::Mat correct = cv::imread(imageFilename); + ASSERT_FALSE(correct.empty()) << "Correct image " << imageFilename.c_str() << " can not be read" << std::endl; + + throwAwayHalf(correct); + throwAwayHalf(undistorted); + + EXPECT_MAT_NEAR(correct, undistorted, 1e-10); } { double balance = 0.0; cv::fisheye::estimateNewCameraMatrixForUndistortRectify(theK, theD, distorted.size(), cv::noArray(), newK, balance); cv::fisheye::undistortImage(distorted, undistorted, theK, theD, newK); - cv::Mat correct = cv::imread(combine(datasets_repository_path, "balance_0.0.png")); - if (correct.empty()) - CV_Assert(cv::imwrite(combine(datasets_repository_path, "balance_0.0.png"), undistorted)); - else - EXPECT_MAT_NEAR(correct, undistorted, 1e-10); + std::string imageFilename = combine(datasets_repository_path, "balance_0.0.png"); + cv::Mat correct = cv::imread(imageFilename); + ASSERT_FALSE(correct.empty()) << "Correct image " << imageFilename.c_str() << " can not be read" << std::endl; + + throwAwayHalf(correct); + throwAwayHalf(undistorted); + + EXPECT_MAT_NEAR(correct, undistorted, 1e-10); } } @@ -422,19 +440,19 @@ TEST_F(fisheyeTest, stereoRectify) 0.002076471801477729, 0.006463478587068991, 0.9999769555891836 ); cv::Matx34d P1_ref( - 420.8551870450913, 0, 586.501617798451, 0, - 0, 420.8551870450913, 374.7667511986098, 0, + 420.9684016542647, 0, 586.3059567784627, 0, + 0, 420.9684016542647, 374.8571836462291, 0, 0, 0, 1, 0 ); cv::Matx34d P2_ref( - 420.8551870450913, 0, 586.501617798451, -41.77758076597302, - 0, 420.8551870450913, 374.7667511986098, 0, + 420.9684016542647, 0, 586.3059567784627, -41.78881938824554, + 0, 420.9684016542647, 374.8571836462291, 0, 0, 0, 1, 0 ); cv::Matx44d Q_ref( - 1, 0, 0, -586.501617798451, - 0, 1, 0, -374.7667511986098, - 0, 0, 0, 420.8551870450913, + 1, 0, 0, -586.3059567784627, + 0, 1, 0, -374.8571836462291, + 0, 0, 0, 420.9684016542647, 0, 0, 10.07370889670733, -0 ); @@ -489,7 +507,9 @@ TEST_F(fisheyeTest, stereoRectify) cv::Mat rectification; merge4(l, r, lundist, rundist, rectification); - cv::imwrite(cv::format("fisheye_rectification_AB_%03d.png", i), rectification); + // Add the "--test_debug" to arguments for file output + if (cvtest::debugLevel > 0) + cv::imwrite(cv::format("fisheye_rectification_AB_%03d.png", i), rectification); } } @@ -683,13 +703,13 @@ TEST_F(fisheyeTest, estimateNewCameraMatrixForUndistortRectify) cv::Mat K_new_truth(3, 3, cv::DataType::type); - K_new_truth.at(0, 0) = 387.4809086880343; + K_new_truth.at(0, 0) = 387.5118215642316; K_new_truth.at(0, 1) = 0.0; - K_new_truth.at(0, 2) = 1036.669802754649; + K_new_truth.at(0, 2) = 1033.936556777084; K_new_truth.at(1, 0) = 0.0; - K_new_truth.at(1, 1) = 373.6375700303157; - K_new_truth.at(1, 2) = 538.8373261247601; + K_new_truth.at(1, 1) = 373.6673784974842; + K_new_truth.at(1, 2) = 538.794152656429; K_new_truth.at(2, 0) = 0.0; K_new_truth.at(2, 1) = 0.0; From 83391ac59d270f2148fc99a62ae279b04d37f5d0 Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Tue, 27 Dec 2022 03:50:12 +0000 Subject: [PATCH 3/3] release: OpenCV 3.4.19 --- modules/core/include/opencv2/core/version.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/core/include/opencv2/core/version.hpp b/modules/core/include/opencv2/core/version.hpp index aa1e8f6a83..5d75d42c61 100644 --- a/modules/core/include/opencv2/core/version.hpp +++ b/modules/core/include/opencv2/core/version.hpp @@ -8,7 +8,7 @@ #define CV_VERSION_MAJOR 3 #define CV_VERSION_MINOR 4 #define CV_VERSION_REVISION 19 -#define CV_VERSION_STATUS "-pre" +#define CV_VERSION_STATUS "" #define CVAUX_STR_EXP(__A) #__A #define CVAUX_STR(__A) CVAUX_STR_EXP(__A)