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

Added planar flag to GMatDesc, intergated into framework, added tests

This commit is contained in:
Ruslan Garnov
2019-04-22 17:36:10 +03:00
parent 1f517b8a02
commit f81886d17c
14 changed files with 519 additions and 27 deletions
+5 -9
View File
@@ -99,8 +99,8 @@ void cv::gimpl::GExecutor::initResource(const ade::NodeHandle &orig_nh)
case GShape::GMAT:
{
const auto desc = util::get<cv::GMatDesc>(d.meta);
const auto type = CV_MAKETYPE(desc.depth, desc.chan);
m_res.slot<cv::gapi::own::Mat>()[d.rc].create(desc.size, type);
auto& mat = m_res.slot<cv::gapi::own::Mat>()[d.rc];
createMat(desc, mat);
}
break;
@@ -152,21 +152,17 @@ void cv::gimpl::GExecutor::run(cv::gimpl::GRuntimeArgs &&args)
{
using cv::util::get;
const auto desc = get<cv::GMatDesc>(d.meta);
const auto type = CV_MAKETYPE(desc.depth, desc.chan);
#if !defined(GAPI_STANDALONE)
// Building as part of OpenCV - follow OpenCV behavior
// if output buffer is not enough to hold the result, reallocate it
auto& out_mat = *get<cv::Mat*>(args.outObjs.at(index));
out_mat.create(cv::gapi::own::to_ocv(desc.size), type);
createMat(desc, out_mat);
#else
// Building standalone - output buffer should always exist,
// and _exact_ match our inferred metadata
auto& out_mat = *get<cv::gapi::own::Mat*>(args.outObjs.at(index));
GAPI_Assert( out_mat.type() == type
&& out_mat.data != nullptr
&& out_mat.rows == desc.size.height
&& out_mat.cols == desc.size.width)
GAPI_Assert(out_mat.data != nullptr &&
desc.canDescribe(out_mat))
#endif // !defined(GAPI_STANDALONE)
}
}