mirror of
https://github.com/opencv/opencv.git
synced 2026-07-29 23:33:05 +04:00
Merge pull request #16745 from Volskig:mp/ocv-gapi-standalone-size
G-API: Unification of own:: structures with cv:: (Size, Point, Rect) * deowned Size Rect Point * Deownded Size Rect Point * With Scalar
This commit is contained in:
committed by
GitHub
parent
557ac3dbaf
commit
277f0d270f
@@ -22,7 +22,7 @@ namespace {
|
||||
cv::GFluidParallelOutputRois asGFluidParallelOutputRois(const std::vector<cv::Rect>& rois){
|
||||
cv::GFluidParallelOutputRois parallel_rois;
|
||||
for (auto const& roi : rois) {
|
||||
parallel_rois.parallel_rois.emplace_back(GFluidOutputRois{{to_own(roi)}});
|
||||
parallel_rois.parallel_rois.emplace_back(GFluidOutputRois{{roi}});
|
||||
}
|
||||
return parallel_rois;
|
||||
}
|
||||
|
||||
@@ -744,7 +744,7 @@ TEST_P(NV12PlusResizeTest, Test)
|
||||
auto pkg = cv::gapi::combine(fluidTestPackage, cv::gapi::core::fluid::kernels());
|
||||
|
||||
c.apply(cv::gin(y_mat, uv_mat), cv::gout(out_mat)
|
||||
,cv::compile_args(pkg, cv::GFluidOutputRois{{to_own(roi)}}));
|
||||
,cv::compile_args(pkg, cv::GFluidOutputRois{{roi}}));
|
||||
|
||||
cv::Mat rgb_mat;
|
||||
cv::cvtColor(in_mat, rgb_mat, cv::COLOR_YUV2RGB_NV12);
|
||||
@@ -823,7 +823,7 @@ TEST_P(Preproc4lpiTest, Test)
|
||||
fluidResizeTestPackage(interp, in_sz, out_sz, 4));
|
||||
|
||||
c.apply(cv::gin(y_mat, uv_mat), cv::gout(out_mat)
|
||||
,cv::compile_args(pkg, cv::GFluidOutputRois{{to_own(roi)}}));
|
||||
,cv::compile_args(pkg, cv::GFluidOutputRois{{roi}}));
|
||||
|
||||
cv::Mat rgb_mat;
|
||||
cv::cvtColor(in_mat, rgb_mat, cv::COLOR_YUV2RGB_NV12);
|
||||
|
||||
@@ -38,7 +38,7 @@ TEST_P(PartialComputation, Test)
|
||||
cv::Mat out_mat_ocv = cv::Mat::zeros(sz, CV_8UC1);
|
||||
|
||||
// Run G-API
|
||||
auto cc = c.compile(cv::descr_of(in_mat), cv::compile_args(fluidTestPackage, GFluidOutputRois{{to_own(roi)}}));
|
||||
auto cc = c.compile(cv::descr_of(in_mat), cv::compile_args(fluidTestPackage, GFluidOutputRois{{roi}}));
|
||||
cc(cv::gin(in_mat), cv::gout(out_mat_gapi));
|
||||
|
||||
// Check with OpenCV
|
||||
@@ -72,7 +72,7 @@ TEST_P(PartialComputationAddC, Test)
|
||||
cv::Mat out_mat_ocv = cv::Mat::zeros(sz, CV_8UC1);
|
||||
|
||||
// Run G-API
|
||||
auto cc = c.compile(cv::descr_of(in_mat), cv::compile_args(fluidTestPackage, GFluidOutputRois{{to_own(roi)}}));
|
||||
auto cc = c.compile(cv::descr_of(in_mat), cv::compile_args(fluidTestPackage, GFluidOutputRois{{roi}}));
|
||||
cc(cv::gin(in_mat), cv::gout(out_mat_gapi));
|
||||
|
||||
// Check with OpenCV
|
||||
@@ -110,7 +110,7 @@ TEST_P(SequenceOfBlursRoiTest, Test)
|
||||
Mat out_mat_gapi = Mat::zeros(sz_in, CV_8UC1);
|
||||
|
||||
GComputation c(GIn(in), GOut(out));
|
||||
auto cc = c.compile(descr_of(in_mat), cv::compile_args(fluidTestPackage, GFluidOutputRois{{to_own(roi)}}));
|
||||
auto cc = c.compile(descr_of(in_mat), cv::compile_args(fluidTestPackage, GFluidOutputRois{{roi}}));
|
||||
cc(gin(in_mat), gout(out_mat_gapi));
|
||||
|
||||
cv::Mat mid_mat_ocv = Mat::zeros(sz_in, CV_8UC1);
|
||||
|
||||
@@ -754,7 +754,7 @@ TEST_P(NV12RoiTest, Test)
|
||||
auto rgb = cv::gapi::NV12toRGB(y, uv);
|
||||
cv::GComputation c(cv::GIn(y, uv), cv::GOut(rgb));
|
||||
|
||||
c.apply(cv::gin(y_mat, uv_mat), cv::gout(out_mat), cv::compile_args(fluidTestPackage, cv::GFluidOutputRois{{to_own(roi)}}));
|
||||
c.apply(cv::gin(y_mat, uv_mat), cv::gout(out_mat), cv::compile_args(fluidTestPackage, cv::GFluidOutputRois{{roi}}));
|
||||
|
||||
cv::cvtColor(in_mat, out_mat_ocv, cv::COLOR_YUV2RGB_NV12);
|
||||
|
||||
@@ -835,7 +835,7 @@ TEST(Fluid, InvalidROIs)
|
||||
};
|
||||
|
||||
const auto compile_args = [] (cv::Rect roi) {
|
||||
return cv::compile_args(cv::gapi::core::fluid::kernels(), GFluidOutputRois{{to_own(roi)}});
|
||||
return cv::compile_args(cv::gapi::core::fluid::kernels(), GFluidOutputRois{{roi}});
|
||||
};
|
||||
|
||||
for (const auto& roi : invalid_rois)
|
||||
|
||||
@@ -61,7 +61,7 @@ TEST_F(GCompiledValidateMetaTyped, ValidMeta)
|
||||
|
||||
TEST_F(GCompiledValidateMetaTyped, InvalidMeta)
|
||||
{
|
||||
auto f = m_cc.compile(cv::GMatDesc{CV_8U,1,cv::gapi::own::Size(64,32)},
|
||||
auto f = m_cc.compile(cv::GMatDesc{CV_8U,1,cv::Size(64,32)},
|
||||
cv::empty_scalar_desc());
|
||||
|
||||
cv::Scalar sc(33);
|
||||
@@ -106,7 +106,7 @@ TEST_F(GCompiledValidateMetaUntyped, ValidMeta)
|
||||
|
||||
TEST_F(GCompiledValidateMetaUntyped, InvalidMetaValues)
|
||||
{
|
||||
auto f = m_ucc.compile(cv::GMatDesc{CV_8U,1,cv::gapi::own::Size(64,32)},
|
||||
auto f = m_ucc.compile(cv::GMatDesc{CV_8U,1,cv::Size(64,32)},
|
||||
cv::empty_scalar_desc());
|
||||
|
||||
cv::Scalar sc(33);
|
||||
@@ -131,7 +131,7 @@ TEST_F(GCompiledValidateMetaUntyped, InvalidMetaValues)
|
||||
|
||||
TEST_F(GCompiledValidateMetaUntyped, InvalidMetaShape)
|
||||
{
|
||||
auto f = m_ucc.compile(cv::GMatDesc{CV_8U,1,cv::gapi::own::Size(64,32)},
|
||||
auto f = m_ucc.compile(cv::GMatDesc{CV_8U,1,cv::Size(64,32)},
|
||||
cv::empty_scalar_desc());
|
||||
|
||||
cv::Mat in1 = cv::Mat::eye(cv::Size(64,32), CV_8UC1);
|
||||
|
||||
@@ -19,13 +19,13 @@ namespace opencv_test
|
||||
static cv::GMatDesc outMeta(cv::GMatDesc in, cv::Size sz, double fx, double fy, int) {
|
||||
if (sz.width != 0 && sz.height != 0)
|
||||
{
|
||||
return in.withSize(to_own(sz));
|
||||
return in.withSize(sz);
|
||||
}
|
||||
else
|
||||
{
|
||||
GAPI_Assert(fx != 0. && fy != 0.);
|
||||
return in.withSize
|
||||
(cv::gapi::own::Size(static_cast<int>(std::round(in.size.width * fx)),
|
||||
(cv::Size(static_cast<int>(std::round(in.size.width * fx)),
|
||||
static_cast<int>(std::round(in.size.height * fy))));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ TEST(IslandFusion, TwoOps_OneIsland)
|
||||
cv::GComputation cc(in, out);
|
||||
|
||||
// Prepare compilation parameters manually
|
||||
const auto in_meta = cv::GMetaArg(cv::GMatDesc{CV_8U,1,cv::gapi::own::Size(32,32)});
|
||||
const auto in_meta = cv::GMetaArg(cv::GMatDesc{CV_8U,1,cv::Size(32,32)});
|
||||
const auto pkg = cv::gapi::kernels<J::Foo>();
|
||||
|
||||
// Directly instantiate G-API graph compiler and run partial compilation
|
||||
@@ -77,7 +77,7 @@ TEST(IslandFusion, TwoOps_TwoIslands)
|
||||
cv::GComputation cc(in, out);
|
||||
|
||||
// Prepare compilation parameters manually
|
||||
const auto in_meta = cv::GMetaArg(cv::GMatDesc{CV_8U,1,cv::gapi::own::Size(32,32)});
|
||||
const auto in_meta = cv::GMetaArg(cv::GMatDesc{CV_8U,1,cv::Size(32,32)});
|
||||
const auto pkg = cv::gapi::kernels<J::Foo, S::Bar>();
|
||||
|
||||
// Directly instantiate G-API graph compiler and run partial compilation
|
||||
@@ -142,8 +142,8 @@ TEST(IslandFusion, ConsumerHasTwoInputs)
|
||||
cv::GComputation cc(cv::GIn(in[0], in[1]), cv::GOut(out));
|
||||
|
||||
// Prepare compilation parameters manually
|
||||
cv::GMetaArgs in_metas = {GMetaArg(cv::GMatDesc{CV_8U,1,cv::gapi::own::Size(32,32)}),
|
||||
GMetaArg(cv::GMatDesc{CV_8U,1,cv::gapi::own::Size(32,32)})};
|
||||
cv::GMetaArgs in_metas = {GMetaArg(cv::GMatDesc{CV_8U,1,cv::Size(32,32)}),
|
||||
GMetaArg(cv::GMatDesc{CV_8U,1,cv::Size(32,32)})};
|
||||
const auto pkg = cv::gapi::kernels<J::Foo, J::Bar>();
|
||||
|
||||
// Directly instantiate G-API graph compiler and run partial compilation
|
||||
@@ -211,7 +211,7 @@ TEST(IslandFusion, DataNodeUsedDifferentBackend)
|
||||
cv::GComputation cc(cv::GIn(in), cv::GOut(out0, out1));
|
||||
|
||||
// Prepare compilation parameters manually
|
||||
const auto in_meta = cv::GMetaArg(cv::GMatDesc{CV_8U,1,cv::gapi::own::Size(32,32)});
|
||||
const auto in_meta = cv::GMetaArg(cv::GMatDesc{CV_8U,1,cv::Size(32,32)});
|
||||
const auto pkg = cv::gapi::kernels<J::Foo, S::Baz>();
|
||||
|
||||
// Directly instantiate G-API graph compiler and run partial compilation
|
||||
@@ -272,7 +272,7 @@ TEST(IslandFusion, LoopBetweenDifferentBackends)
|
||||
cv::GComputation cc(cv::GIn(in), cv::GOut(out1, out0));
|
||||
|
||||
// Prepare compilation parameters manually
|
||||
const auto in_meta = cv::GMetaArg(cv::GMatDesc{CV_8U,1,cv::gapi::own::Size(32,32)});
|
||||
const auto in_meta = cv::GMetaArg(cv::GMatDesc{CV_8U,1,cv::Size(32,32)});
|
||||
const auto pkg = cv::gapi::kernels<J::Baz, J::Quux, S::Foo, S::Qux>();
|
||||
|
||||
// Directly instantiate G-API graph compiler and run partial compilation
|
||||
@@ -334,8 +334,8 @@ TEST(IslandsFusion, PartionOverlapUserIsland)
|
||||
cv::GComputation cc(cv::GIn(in[0], in[1]), cv::GOut(out));
|
||||
|
||||
// Prepare compilation parameters manually
|
||||
cv::GMetaArgs in_metas = {GMetaArg(cv::GMatDesc{CV_8U,1,cv::gapi::own::Size(32,32)}),
|
||||
GMetaArg(cv::GMatDesc{CV_8U,1,cv::gapi::own::Size(32,32)})};
|
||||
cv::GMetaArgs in_metas = {GMetaArg(cv::GMatDesc{CV_8U,1,cv::Size(32,32)}),
|
||||
GMetaArg(cv::GMatDesc{CV_8U,1,cv::Size(32,32)})};
|
||||
const auto pkg = cv::gapi::kernels<J::Foo, J::Bar>();
|
||||
|
||||
// Directly instantiate G-API graph compiler and run partial compilation
|
||||
@@ -391,8 +391,8 @@ TEST(IslandsFusion, DISABLED_IslandContainsDifferentBackends)
|
||||
cv::GComputation cc(cv::GIn(in[0], in[1]), cv::GOut(out));
|
||||
|
||||
// Prepare compilation parameters manually
|
||||
cv::GMetaArgs in_metas = {GMetaArg(cv::GMatDesc{CV_8U,1,cv::gapi::own::Size(32,32)}),
|
||||
GMetaArg(cv::GMatDesc{CV_8U,1,cv::gapi::own::Size(32,32)})};
|
||||
cv::GMetaArgs in_metas = {GMetaArg(cv::GMatDesc{CV_8U,1,cv::Size(32,32)}),
|
||||
GMetaArg(cv::GMatDesc{CV_8U,1,cv::Size(32,32)})};
|
||||
const auto pkg = cv::gapi::kernels<J::Foo, S::Bar>();
|
||||
|
||||
// Directly instantiate G-API graph compiler and run partial compilation
|
||||
@@ -424,7 +424,7 @@ TEST(IslandFusion, WithLoop)
|
||||
cv::GComputation cc(in, out);
|
||||
|
||||
// Prepare compilation parameters manually
|
||||
const auto in_meta = cv::GMetaArg(cv::GMatDesc{CV_8U,1,cv::gapi::own::Size(32,32)});
|
||||
const auto in_meta = cv::GMetaArg(cv::GMatDesc{CV_8U,1,cv::Size(32,32)});
|
||||
const auto pkg = cv::gapi::kernels<J::Foo, J::Baz, J::Qux>();
|
||||
|
||||
// Directly instantiate G-API graph compiler and run partial compilation
|
||||
|
||||
@@ -216,7 +216,7 @@ TEST(GComputationCompile, ReshapeRois)
|
||||
int roiH = szOut.height / niter;
|
||||
cv::Rect roi{x, y, roiW, roiH};
|
||||
|
||||
cc.apply(in_mat, out_mat, cv::compile_args(cv::GFluidOutputRois{{to_own(roi)}}));
|
||||
cc.apply(in_mat, out_mat, cv::compile_args(cv::GFluidOutputRois{{roi}}));
|
||||
auto comp = cc.priv().m_lastCompiled;
|
||||
|
||||
EXPECT_EQ(&first_comp.priv(), &comp.priv());
|
||||
|
||||
Reference in New Issue
Block a user