mirror of
https://github.com/opencv/opencv.git
synced 2025-06-07 01:13:28 +08:00
Merge remote-tracking branch 'origin/3.4' into merge-3.4
This commit is contained in:
commit
d4861bfd1f
@ -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 )
|
||||
|
@ -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
|
||||
|
@ -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" : {
|
||||
|
@ -2059,4 +2059,12 @@ public class CoreTest extends OpenCVTestCase {
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -243,7 +243,7 @@ private:
|
||||
else
|
||||
mask0 = mask;
|
||||
pose = Matx23f(1,0,0,
|
||||
0,1,0);
|
||||
0,1,0);
|
||||
|
||||
if( phi == 0 )
|
||||
image.copyTo(rotImage);
|
||||
@ -276,6 +276,8 @@ private:
|
||||
}
|
||||
if( phi != 0 || tilt != 1 )
|
||||
warpAffine(mask0, warpedMask, pose, warpedImage.size(), INTER_NEAREST);
|
||||
else
|
||||
warpedMask = mask0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -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<AffineFeature> 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<KeyPoint> 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
|
||||
|
@ -76,7 +76,7 @@ struct Set<i0, -1, -1>
|
||||
|
||||
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;
|
||||
|
@ -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<CV_8U> > h(_src, _dst, dcn);
|
||||
CvtHelper< Set<2>, Set<3, 4>, Set<CV_8U>, 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);
|
||||
|
@ -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
|
||||
|
@ -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<uint8_t>(cvRound(localization_points[i].y))[index + 1];
|
||||
next_pixel = bin_barcode.ptr<uint8_t>(index_r)[index_c + 1];
|
||||
if (next_pixel == future_pixel)
|
||||
{
|
||||
future_pixel = static_cast<uint8_t>(~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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user