1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-31 08:13:04 +04:00

Merge pull request #16768 from TolyaTalamanov:at/add-warp-affine

G-API: Implement WarpAffine

* Add WarpAffine

* Ban BORDER_TRANSPARENT

* Fix doc
This commit is contained in:
Anatoliy Talamanov
2020-03-19 15:12:09 +03:00
committed by GitHub
parent 2160f9b20e
commit 8fe9674301
6 changed files with 87 additions and 0 deletions
@@ -141,6 +141,9 @@ struct BackendOutputAllocationTest : TestWithParamBase<>
// FIXME: move all tests from this fixture to the base class once all issues are resolved
struct BackendOutputAllocationLargeSizeWithCorrectSubmatrixTest : BackendOutputAllocationTest {};
GAPI_TEST_FIXTURE(ReInitOutTest, initNothing, <cv::Size>, 1, out_sz)
GAPI_TEST_FIXTURE(WarpAffineTest, initMatrixRandU, FIXTURE_API(CompareMats, double , double, int, int, cv::Scalar), 6,
cmpF, angle, scale, flags, border_mode, border_value)
} // opencv_test
#endif //OPENCV_GAPI_CORE_TESTS_HPP
@@ -1266,6 +1266,27 @@ TEST_P(SqrtTest, AccuracyTest)
}
}
TEST_P(WarpAffineTest, AccuracyTest)
{
cv::Point center{in_mat1.size() / 2};
cv::Mat warp_mat = cv::getRotationMatrix2D(center, angle, scale);
// G-API code //////////////////////////////////////////////////////////////
cv::GMat in;
auto out = cv::gapi::warpAffine(in, warp_mat, in_mat1.size(), flags, border_mode, border_value);
cv::GComputation c(in, out);
c.apply(in_mat1, out_mat_gapi, getCompileArgs());
// OpenCV code /////////////////////////////////////////////////////////////
cv::warpAffine(in_mat1, out_mat_ocv, warp_mat, in_mat1.size(), flags, border_mode, border_value);
// Comparison //////////////////////////////////////////////////////////////
{
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
}
}
TEST_P(NormalizeTest, Test)
{
initMatrixRandN(type, sz, CV_MAKETYPE(ddepth, CV_MAT_CN(type)));