diff --git a/modules/calib3d/src/fisheye.cpp b/modules/calib3d/src/fisheye.cpp index 55cf1a887c69..1be7cb44c257 100644 --- a/modules/calib3d/src/fisheye.cpp +++ b/modules/calib3d/src/fisheye.cpp @@ -460,7 +460,7 @@ void cv::fisheye::undistortPoints( InputArray distorted, OutputArray undistorted } ////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/// cv::fisheye::undistortPoints +/// cv::fisheye::initUndistortRectifyMap void cv::fisheye::initUndistortRectifyMap( InputArray K, InputArray D, InputArray R, InputArray P, const cv::Size& size, int m1type, OutputArray map1, OutputArray map2 ) diff --git a/modules/core/include/opencv2/core/eigen.hpp b/modules/core/include/opencv2/core/eigen.hpp index 51f41474bd16..f176409cc3b5 100644 --- a/modules/core/include/opencv2/core/eigen.hpp +++ b/modules/core/include/opencv2/core/eigen.hpp @@ -52,7 +52,9 @@ #include "opencv2/core.hpp" #if defined _MSC_VER && _MSC_VER >= 1200 +#ifndef NOMINMAX #define NOMINMAX // fix https://github.com/opencv/opencv/issues/17548 +#endif #pragma warning( disable: 4714 ) //__forceinline is not inlined #pragma warning( disable: 4127 ) //conditional expression is constant #pragma warning( disable: 4244 ) //conversion from '__int64' to 'int', possible loss of data diff --git a/modules/core/misc/java/gen_dict.json b/modules/core/misc/java/gen_dict.json index 36b2c58e584c..d1267408dabd 100644 --- a/modules/core/misc/java/gen_dict.json +++ b/modules/core/misc/java/gen_dict.json @@ -122,10 +122,7 @@ "}", "\n" ] - }, - "checkHardwareSupport" : {"j_code" : [""], "jn_code" : [""], "cpp_code" : [""] }, - "setUseOptimized" : {"j_code" : [""], "jn_code" : [""], "cpp_code" : [""] }, - "useOptimized" : {"j_code" : [""], "jn_code" : [""], "cpp_code" : [""] } + } } }, "func_arg_fix" : { diff --git a/modules/core/misc/java/test/CoreTest.java b/modules/core/misc/java/test/CoreTest.java index 42c343b2ba77..c63cb23fab91 100644 --- a/modules/core/misc/java/test/CoreTest.java +++ b/modules/core/misc/java/test/CoreTest.java @@ -2059,4 +2059,12 @@ public void testVersion() { assertEquals(Core.VERSION, Core.getVersionString()); } + public void testHardwareOptions() { + Core.checkHardwareSupport(0); + boolean original_status = Core.useOptimized(); + Core.setUseOptimized(!original_status); + assertEquals(!original_status, Core.useOptimized()); + Core.setUseOptimized(original_status); + assertEquals(original_status, Core.useOptimized()); + } } diff --git a/modules/core/src/ocl.cpp b/modules/core/src/ocl.cpp index fa92e7f6f17b..bf562c309252 100644 --- a/modules/core/src/ocl.cpp +++ b/modules/core/src/ocl.cpp @@ -1611,7 +1611,7 @@ struct Device::Impl if (vendorName_ == "Advanced Micro Devices, Inc." || vendorName_ == "AMD") vendorID_ = VENDOR_AMD; - else if (vendorName_ == "Intel(R) Corporation" || vendorName_ == "Intel" || strstr(name_.c_str(), "Iris") != 0) + else if (vendorName_ == "Intel(R) Corporation" || vendorName_ == "Intel" || vendorName_ == "Intel Inc." || strstr(name_.c_str(), "Iris") != 0) vendorID_ = VENDOR_INTEL; else if (vendorName_ == "NVIDIA Corporation") vendorID_ = VENDOR_NVIDIA; diff --git a/modules/features2d/src/affine_feature.cpp b/modules/features2d/src/affine_feature.cpp index 40e03e92ba15..5d19d6c6c3b1 100644 --- a/modules/features2d/src/affine_feature.cpp +++ b/modules/features2d/src/affine_feature.cpp @@ -243,7 +243,7 @@ class skewedDetectAndCompute : public ParallelLoopBody else mask0 = mask; pose = Matx23f(1,0,0, - 0,1,0); + 0,1,0); if( phi == 0 ) image.copyTo(rotImage); @@ -276,6 +276,8 @@ class skewedDetectAndCompute : public ParallelLoopBody } if( phi != 0 || tilt != 1 ) warpAffine(mask0, warpedMask, pose, warpedImage.size(), INTER_NEAREST); + else + warpedMask = mask0; } diff --git a/modules/features2d/test/test_affine_feature.cpp b/modules/features2d/test/test_affine_feature.cpp index f40f21ed8d03..75885bd751a8 100644 --- a/modules/features2d/test/test_affine_feature.cpp +++ b/modules/features2d/test/test_affine_feature.cpp @@ -182,4 +182,26 @@ TEST(Features2d_AFFINE_FEATURE, regression) #endif } +TEST(Features2d_AFFINE_FEATURE, mask) +{ + Mat gray = imread(cvtest::findDataFile("features2d/tsukuba.png"), IMREAD_GRAYSCALE); + ASSERT_FALSE(gray.empty()) << "features2d/tsukuba.png image was not found in test data!"; + + // small tilt range to limit internal mask warping + Ptr ext = AffineFeature::create(SIFT::create(), 1, 0); + Mat mask = Mat::zeros(gray.size(), CV_8UC1); + mask(Rect(50, 50, mask.cols-100, mask.rows-100)).setTo(255); + + // calc and compare keypoints + vector calcKeypoints; + ext->detectAndCompute(gray, mask, calcKeypoints, noArray(), false); + + // added expanded test range to cover sub-pixel coordinates for features on mask border + for( size_t i = 0; i < calcKeypoints.size(); i++ ) + { + ASSERT_TRUE((calcKeypoints[i].pt.x >= 50-1) && (calcKeypoints[i].pt.x <= mask.cols-50+1)); + ASSERT_TRUE((calcKeypoints[i].pt.y >= 50-1) && (calcKeypoints[i].pt.y <= mask.rows-50+1)); + } +} + }} // namespace diff --git a/modules/imgproc/src/color.simd_helpers.hpp b/modules/imgproc/src/color.simd_helpers.hpp index 47f00fda20e4..6642ff69c4bd 100644 --- a/modules/imgproc/src/color.simd_helpers.hpp +++ b/modules/imgproc/src/color.simd_helpers.hpp @@ -76,7 +76,7 @@ struct Set enum SizePolicy { - TO_YUV, FROM_YUV, NONE + TO_YUV, FROM_YUV, FROM_UYVY, NONE }; template< typename VScn, typename VDcn, typename VDepth, SizePolicy sizePolicy = NONE > @@ -108,6 +108,10 @@ struct CvtHelper CV_Assert( sz.width % 2 == 0 && sz.height % 3 == 0); dstSz = Size(sz.width, sz.height * 2 / 3); break; + case FROM_UYVY: + CV_Assert( sz.width % 2 == 0); + dstSz = sz; + break; case NONE: default: dstSz = sz; diff --git a/modules/imgproc/src/color_yuv.dispatch.cpp b/modules/imgproc/src/color_yuv.dispatch.cpp index cac4fa1b4133..559005e07f70 100644 --- a/modules/imgproc/src/color_yuv.dispatch.cpp +++ b/modules/imgproc/src/color_yuv.dispatch.cpp @@ -354,7 +354,7 @@ void cvtColorYUV2BGR(InputArray _src, OutputArray _dst, int dcn, bool swapb, boo void cvtColorOnePlaneYUV2BGR( InputArray _src, OutputArray _dst, int dcn, bool swapb, int uidx, int ycn) { - CvtHelper< Set<2>, Set<3, 4>, Set > h(_src, _dst, dcn); + CvtHelper< Set<2>, Set<3, 4>, Set, FROM_UYVY > h(_src, _dst, dcn); hal::cvtOnePlaneYUVtoBGR(h.src.data, h.src.step, h.dst.data, h.dst.step, h.src.cols, h.src.rows, dcn, swapb, uidx, ycn); diff --git a/modules/imgproc/test/test_cvtyuv.cpp b/modules/imgproc/test/test_cvtyuv.cpp index 2a2f72ffe220..cb49baab0a46 100644 --- a/modules/imgproc/test/test_cvtyuv.cpp +++ b/modules/imgproc/test/test_cvtyuv.cpp @@ -724,4 +724,13 @@ INSTANTIATE_TEST_CASE_P(cvt422, Imgproc_ColorYUV, (int)COLOR_YUV2RGBA_YUY2, (int)COLOR_YUV2BGRA_YUY2, (int)COLOR_YUV2RGBA_YVYU, (int)COLOR_YUV2BGRA_YVYU, (int)COLOR_YUV2GRAY_UYVY, (int)COLOR_YUV2GRAY_YUY2)); -}} // namespace +} + +TEST(cvtColorUYVY, size_issue_21035) +{ + Mat input = Mat::zeros(1, 1, CV_8UC2); + Mat output; + EXPECT_THROW(cv::cvtColor(input, output, cv::COLOR_YUV2BGR_UYVY), cv::Exception); +} + +} // namespace diff --git a/modules/objdetect/src/qrcode.cpp b/modules/objdetect/src/qrcode.cpp index 93fffeaf5c41..db619fb441ec 100644 --- a/modules/objdetect/src/qrcode.cpp +++ b/modules/objdetect/src/qrcode.cpp @@ -571,10 +571,11 @@ bool QRDetect::computeTransformationPoints() { Mat mask = Mat::zeros(bin_barcode.rows + 2, bin_barcode.cols + 2, CV_8UC1); uint8_t next_pixel, future_pixel = 255; - int count_test_lines = 0, index = cvRound(localization_points[i].x); - for (; index < bin_barcode.cols - 1; index++) + int count_test_lines = 0, index_c = max(0, min(cvRound(localization_points[i].x), bin_barcode.cols - 1)); + const int index_r = max(0, min(cvRound(localization_points[i].y), bin_barcode.rows - 1)); + for (; index_c < bin_barcode.cols - 1; index_c++) { - next_pixel = bin_barcode.ptr(cvRound(localization_points[i].y))[index + 1]; + next_pixel = bin_barcode.ptr(index_r)[index_c + 1]; if (next_pixel == future_pixel) { future_pixel = static_cast(~future_pixel); @@ -582,7 +583,7 @@ bool QRDetect::computeTransformationPoints() if (count_test_lines == 2) { floodFill(bin_barcode, mask, - Point(index + 1, cvRound(localization_points[i].y)), 255, + Point(index_c + 1, index_r), 255, 0, Scalar(), Scalar(), FLOODFILL_MASK_ONLY); break; }