Commit a1e96a7d authored by Suleyman TURKMEN's avatar Suleyman TURKMEN

Update seamless_cloning.cpp

parent 7df3141b
...@@ -78,6 +78,7 @@ void cv::seamlessClone(InputArray _src, InputArray _dst, InputArray _mask, Point ...@@ -78,6 +78,7 @@ void cv::seamlessClone(InputArray _src, InputArray _dst, InputArray _mask, Point
copyMakeBorder(mask_inner, mask, 1, 1, 1, 1, BORDER_ISOLATED | BORDER_CONSTANT, Scalar(0)); copyMakeBorder(mask_inner, mask, 1, 1, 1, 1, BORDER_ISOLATED | BORDER_CONSTANT, Scalar(0));
Rect roi_s = boundingRect(mask); Rect roi_s = boundingRect(mask);
if (roi_s.empty()) return;
Rect roi_d(p.x - roi_s.width / 2, p.y - roi_s.height / 2, roi_s.width, roi_s.height); Rect roi_d(p.x - roi_s.width / 2, p.y - roi_s.height / 2, roi_s.width, roi_s.height);
Mat destinationROI = dest(roi_d).clone(); Mat destinationROI = dest(roi_d).clone();
......
...@@ -86,6 +86,15 @@ TEST(Photo_SeamlessClone_normal, regression) ...@@ -86,6 +86,15 @@ TEST(Photo_SeamlessClone_normal, regression)
EXPECT_LE(errorINF, 1); EXPECT_LE(errorINF, 1);
double errorL1 = cvtest::norm(reference, result, NORM_L1); double errorL1 = cvtest::norm(reference, result, NORM_L1);
EXPECT_LE(errorL1, reference.total() * numerical_precision) << "size=" << reference.size(); EXPECT_LE(errorL1, reference.total() * numerical_precision) << "size=" << reference.size();
mask = Scalar(0, 0, 0);
seamlessClone(source, destination, mask, p, result, 1);
reference = destination;
errorINF = cvtest::norm(reference, result, NORM_INF);
EXPECT_LE(errorINF, 1);
errorL1 = cvtest::norm(reference, result, NORM_L1);
EXPECT_LE(errorL1, reference.total() * numerical_precision) << "size=" << reference.size();
} }
TEST(Photo_SeamlessClone_mixed, regression) TEST(Photo_SeamlessClone_mixed, regression)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment