Merge pull request #16604 from Volskig:mp/ocv-gapi-zero-height-mat
G-API: Zero-height mat is cause of crash * Added check for zero-height Mat case * Refactoring, added validate_input_arg func * No bool function now
This commit is contained in:
committed by
GitHub
parent
27b71d6368
commit
3befdb4ae8
@@ -197,6 +197,42 @@ bool cv::can_describe(const GMetaArgs &metas, const GRunArgs &args)
|
||||
});
|
||||
}
|
||||
|
||||
void cv::validate_input_arg(const GRunArg& arg)
|
||||
{
|
||||
// FIXME: It checks only Mat argument
|
||||
switch (arg.index())
|
||||
{
|
||||
#if !defined(GAPI_STANDALONE)
|
||||
case GRunArg::index_of<cv::Mat>():
|
||||
{
|
||||
const auto desc = descr_of(util::get<cv::Mat>(arg));
|
||||
GAPI_Assert(desc.size.height != 0 && desc.size.width != 0 && "incorrect dimensions of cv::Mat!"); break;
|
||||
}
|
||||
case GRunArg::index_of<cv::UMat>():
|
||||
{
|
||||
const auto desc = descr_of(util::get<cv::UMat>(arg));
|
||||
GAPI_Assert(desc.size.height != 0 && desc.size.width != 0 && "incorrect dimensions of cv::UMat!"); break;
|
||||
}
|
||||
#endif // !defined(GAPI_STANDALONE)
|
||||
case GRunArg::index_of<cv::gapi::own::Mat>():
|
||||
{
|
||||
const auto desc = descr_of(util::get<cv::gapi::own::Mat>(arg));
|
||||
GAPI_Assert(desc.size.height != 0 && desc.size.width != 0 && "incorrect dimensions of own::Mat!"); break;
|
||||
}
|
||||
default:
|
||||
// No extra handling
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void cv::validate_input_args(const GRunArgs& args)
|
||||
{
|
||||
for (const auto& arg : args)
|
||||
{
|
||||
validate_input_arg(arg);
|
||||
}
|
||||
}
|
||||
|
||||
namespace cv {
|
||||
std::ostream& operator<<(std::ostream& os, const cv::GMetaArg &arg)
|
||||
{
|
||||
|
||||
@@ -56,6 +56,7 @@ void cv::GCompiled::Priv::checkArgs(const cv::gimpl::GRuntimeArgs &args) const
|
||||
"for different metadata!"));
|
||||
// FIXME: Add details on what is actually wrong
|
||||
}
|
||||
validate_input_args(args.inObjs);
|
||||
}
|
||||
|
||||
bool cv::GCompiled::Priv::canReshape() const
|
||||
|
||||
Reference in New Issue
Block a user