mirror of
https://github.com/opencv/opencv.git
synced 2026-07-31 08:13:04 +04:00
Merge branch 4.x
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
{
|
||||
"namespaces_dict": {
|
||||
"cv.fisheye": "fisheye"
|
||||
},
|
||||
"func_arg_fix" : {
|
||||
"Calib" : {
|
||||
"findCirclesGrid" : { "blobDetector" : {"defval" : "cv::SimpleBlobDetector::create()"} }
|
||||
|
||||
@@ -531,14 +531,14 @@ bool findChessboardCorners(InputArray image_, Size pattern_size,
|
||||
const int min_dilations = 0;
|
||||
const int max_dilations = is_plain ? 0 : 7;
|
||||
|
||||
// Try our standard "1" dilation, but if the pattern is not found, iterate the whole procedure with higher dilations.
|
||||
// This is necessary because some squares simply do not separate properly with a single dilation. However,
|
||||
// Try our standard "0" and "1" dilations, but if the pattern is not found, iterate the whole procedure with higher dilations.
|
||||
// This is necessary because some squares simply do not separate properly without and with a single dilations. However,
|
||||
// we want to use the minimum number of dilations possible since dilations cause the squares to become smaller,
|
||||
// making it difficult to detect smaller squares.
|
||||
for (int dilations = min_dilations; dilations <= max_dilations; dilations++)
|
||||
{
|
||||
//USE BINARY IMAGE COMPUTED USING icvBinarizationHistogramBased METHOD
|
||||
if(!is_plain)
|
||||
if(!is_plain && dilations > 0)
|
||||
dilate( thresh_img_new, thresh_img_new, Mat(), Point(-1, -1), 1 );
|
||||
|
||||
// So we can find rectangles that go to the edge, we draw a white line around the image edge.
|
||||
@@ -596,13 +596,13 @@ bool findChessboardCorners(InputArray image_, Size pattern_size,
|
||||
block_size = block_size | 1;
|
||||
// convert to binary
|
||||
adaptiveThreshold( img, thresh_img, 255, ADAPTIVE_THRESH_MEAN_C, THRESH_BINARY, block_size, (k/2)*5 );
|
||||
if (dilations > 0)
|
||||
dilate( thresh_img, thresh_img, Mat(), Point(-1, -1), dilations-1 );
|
||||
dilate( thresh_img, thresh_img, Mat(), Point(-1, -1), dilations );
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
dilate( thresh_img, thresh_img, Mat(), Point(-1, -1), 1 );
|
||||
if (dilations > 0)
|
||||
dilate( thresh_img, thresh_img, Mat(), Point(-1, -1), 1 );
|
||||
}
|
||||
SHOW("Old binarization", thresh_img);
|
||||
|
||||
|
||||
@@ -110,7 +110,7 @@ double cv::fisheye::calibrate(InputArrayOfArrays objectPoints, InputArrayOfArray
|
||||
}
|
||||
else
|
||||
{
|
||||
finalParam.Init(Vec2d(max(image_size.width, image_size.height) / CV_PI, max(image_size.width, image_size.height) / CV_PI),
|
||||
finalParam.Init(Vec2d(max(image_size.width, image_size.height) / 2., max(image_size.width, image_size.height) / 2.),
|
||||
Vec2d(image_size.width / 2.0 - 0.5, image_size.height / 2.0 - 0.5));
|
||||
}
|
||||
|
||||
|
||||
@@ -100,6 +100,11 @@ TEST_F(fisheyeTest, Calibration)
|
||||
{
|
||||
const int n_images = 34;
|
||||
|
||||
const cv::Matx33d goldK(558.4780870585967, 0, 620.4585053962692,
|
||||
0, 560.5067667343917, 381.9394122875291,
|
||||
0, 0, 1);
|
||||
const cv::Vec4d goldD(-0.00146136, -0.00329847, 0.00605742, -0.00374201);
|
||||
|
||||
std::vector<std::vector<cv::Point2d> > imagePoints(n_images);
|
||||
std::vector<std::vector<cv::Point3d> > objectPoints(n_images);
|
||||
|
||||
@@ -127,8 +132,8 @@ TEST_F(fisheyeTest, Calibration)
|
||||
cv::fisheye::calibrate(objectPoints, imagePoints, imageSize, theK, theD,
|
||||
cv::noArray(), cv::noArray(), flag, cv::TermCriteria(3, 20, 1e-6));
|
||||
|
||||
EXPECT_MAT_NEAR(theK, this->K, 1e-10);
|
||||
EXPECT_MAT_NEAR(theD, this->D, 1e-10);
|
||||
EXPECT_MAT_NEAR(theK, goldK, 1e-8);
|
||||
EXPECT_MAT_NEAR(theD, goldD, 1e-8);
|
||||
}
|
||||
|
||||
TEST_F(fisheyeTest, CalibrationWithFixedFocalLength)
|
||||
@@ -287,10 +292,10 @@ TEST_F(fisheyeTest, EstimateUncertainties)
|
||||
cv::internal::EstimateUncertainties(objectPoints, imagePoints, param, rvec, tvec,
|
||||
errors, err_std, thresh_cond, check_cond, rms);
|
||||
|
||||
EXPECT_MAT_NEAR(errors.f, cv::Vec2d(1.34250246865020720, 1.36037536429654530), 1e-10);
|
||||
EXPECT_MAT_NEAR(errors.c, cv::Vec2d(0.92070526160049848, 0.84383585812851514), 1e-10);
|
||||
EXPECT_MAT_NEAR(errors.k, cv::Vec4d(0.0053379581373996041, 0.017389792901700545, 0.022036256089491224, 0.0094714594258908952), 1e-10);
|
||||
EXPECT_MAT_NEAR(err_std, cv::Vec2d(0.187475975266883, 0.185678953263995), 1e-10);
|
||||
EXPECT_MAT_NEAR(errors.f, cv::Vec2d(1.34250246865020720, 1.36037536429654530), 1e-6);
|
||||
EXPECT_MAT_NEAR(errors.c, cv::Vec2d(0.92070526160049848, 0.84383585812851514), 1e-6);
|
||||
EXPECT_MAT_NEAR(errors.k, cv::Vec4d(0.0053379581373996041, 0.017389792901700545, 0.022036256089491224, 0.0094714594258908952), 1e-7);
|
||||
EXPECT_MAT_NEAR(err_std, cv::Vec2d(0.187475975266883, 0.185678953263995), 1e-7);
|
||||
CV_Assert(fabs(rms - 0.263782587133546) < 1e-10);
|
||||
CV_Assert(errors.alpha == 0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user