mirror of
https://github.com/opencv/opencv.git
synced 2026-12-04 22:17:18 -06:00
Merge pull request #25055 from dmatveev:dm/value_initialized_gmat
G-API: A quick value-initialization support GMat #25055 This PR enables `GMat` objects to be value-initialized in the same way as it was done for `GScalar`s (and, possibly, other types). - Added some helper methods in backends to distinguish if a certain G-type value initialization is supported or not; - Added tests, including negative. Where it is needed: - Further extension of the OVCV backend (#24379 - will be refreshed soon); - Further experiments with DNN module; - Further experiments with "G-API behind UMat" sort of aggregation. In the current form, PR can be reviewed & merged (@TolyaTalamanov please have a look) ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [x] The PR is proposed to the proper branch - [ ] There is a reference to the original bug report and related work - [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [x] The feature is well documented and sample code can be built with the project CMake
This commit is contained in:
@@ -191,8 +191,8 @@ void cv::GComputation::recompile(GMetaArgs&& in_metas, GCompileArgs &&args)
|
||||
if (m_priv->m_lastMetas != in_metas)
|
||||
{
|
||||
if (m_priv->m_lastCompiled &&
|
||||
m_priv->m_lastCompiled.canReshape() &&
|
||||
formats_are_same(m_priv->m_lastMetas, in_metas))
|
||||
m_priv->m_lastCompiled.canReshape() &&
|
||||
formats_are_same(m_priv->m_lastMetas, in_metas))
|
||||
{
|
||||
m_priv->m_lastCompiled.reshape(in_metas, args);
|
||||
}
|
||||
@@ -203,6 +203,11 @@ void cv::GComputation::recompile(GMetaArgs&& in_metas, GCompileArgs &&args)
|
||||
}
|
||||
m_priv->m_lastMetas = in_metas;
|
||||
}
|
||||
else if (in_metas.size() == 0) {
|
||||
// Happens when the graph is head-less (e.g. starts with const-vals only)
|
||||
// always compile ad-hoc
|
||||
m_priv->m_lastCompiled = compile(GMetaArgs(in_metas), std::move(args));
|
||||
}
|
||||
}
|
||||
|
||||
void cv::GComputation::apply(GRunArgs &&ins, GRunArgsP &&outs, GCompileArgs &&args)
|
||||
|
||||
Reference in New Issue
Block a user