Commit af230ec1 authored by Orest Chura's avatar Orest Chura Committed by Alexander Alekhin

Merge pull request #15888 from OrestChura:facebeautification_gapi_sample

Introducing the sample of Face Beautification algorithm implemented via Graph-API

* Introducing the sample of Face Beautification algorithm implemented via Graph-API
- 'gapi/samples/face_beautification.cpp' added
- FIXME added in 'gcpukernel.hpp'

* INF_ENGINE fix
- preprocessing clauses added not to run the sample without Inference Engine

* INF_ENGINE fix 2
- warnings removed

* Fixes
- checking IE version cut as there is no dependency
- some alignments fixed
- the comment about preprocessing commands fixed

* ie::backend() issue fix (according to dmatveev)
- as the sample needs the cv::gapi::ie::backend() to be defined regardless of having IE or not, there is its throw-error definition in `giebackend.cpp` now (by dmatveev)
- for the same reason, #includes in `giebackend.hpp` are fixed
- HAVE_INF_ENGINE check is removed from the sample
parent fc41c18c
...@@ -145,6 +145,12 @@ template<typename U> struct get_in<cv::GArray<U> > ...@@ -145,6 +145,12 @@ template<typename U> struct get_in<cv::GArray<U> >
{ {
static const std::vector<U>& get(GCPUContext &ctx, int idx) { return ctx.inArg<VectorRef>(idx).rref<U>(); } static const std::vector<U>& get(GCPUContext &ctx, int idx) { return ctx.inArg<VectorRef>(idx).rref<U>(); }
}; };
//FIXME(dm): GArray<Mat>/GArray<GMat> conversion should be done more gracefully in the system
template<> struct get_in<cv::GArray<cv::GMat> >: public get_in<cv::GArray<cv::Mat> >
{
};
template<class T> struct get_in template<class T> struct get_in
{ {
static T get(GCPUContext &ctx, int idx) { return ctx.inArg<T>(idx); } static T get(GCPUContext &ctx, int idx) { return ctx.inArg<T>(idx); }
...@@ -240,7 +246,6 @@ struct OCVCallHelper<Impl, std::tuple<Ins...>, std::tuple<Outs...> > ...@@ -240,7 +246,6 @@ struct OCVCallHelper<Impl, std::tuple<Ins...>, std::tuple<Outs...> >
//not using a std::forward on outs is deliberate in order to //not using a std::forward on outs is deliberate in order to
//cause compilation error, by trying to bind rvalue references to lvalue references //cause compilation error, by trying to bind rvalue references to lvalue references
Impl::run(std::forward<Inputs>(ins)..., outs...); Impl::run(std::forward<Inputs>(ins)..., outs...);
postprocess(outs...); postprocess(outs...);
} }
}; };
......
This diff is collapsed.
...@@ -6,6 +6,10 @@ ...@@ -6,6 +6,10 @@
#include "precomp.hpp" #include "precomp.hpp"
// needs to be included regardless if IE is present or not
// (cv::gapi::ie::backend() is still there and is defined always)
#include "backends/ie/giebackend.hpp"
#ifdef HAVE_INF_ENGINE #ifdef HAVE_INF_ENGINE
#if INF_ENGINE_RELEASE <= 2018050000 #if INF_ENGINE_RELEASE <= 2018050000
...@@ -32,7 +36,6 @@ ...@@ -32,7 +36,6 @@
#include "compiler/gobjref.hpp" #include "compiler/gobjref.hpp"
#include "compiler/gmodel.hpp" #include "compiler/gmodel.hpp"
#include "backends/ie/giebackend.hpp"
#include "backends/ie/util.hpp" #include "backends/ie/util.hpp"
#include "api/gbackend_priv.hpp" // FIXME: Make it part of Backend SDK! #include "api/gbackend_priv.hpp" // FIXME: Make it part of Backend SDK!
...@@ -601,4 +604,9 @@ InferenceEngine::Blob::Ptr cv::gapi::ie::util::to_ie(cv::Mat &blob) { ...@@ -601,4 +604,9 @@ InferenceEngine::Blob::Ptr cv::gapi::ie::util::to_ie(cv::Mat &blob) {
return wrapIE(blob); return wrapIE(blob);
} }
#else
cv::gapi::GBackend cv::gapi::ie::backend() {
// Still provide this symbol to avoid linking issues
util::throw_error(std::runtime_error("G-API has been compiled without OpenVINO IE support"));
}
#endif // HAVE_INF_ENGINE #endif // HAVE_INF_ENGINE
...@@ -7,6 +7,9 @@ ...@@ -7,6 +7,9 @@
#ifndef OPENCV_GAPI_GIEBACKEND_HPP #ifndef OPENCV_GAPI_GIEBACKEND_HPP
#define OPENCV_GAPI_GIEBACKEND_HPP #define OPENCV_GAPI_GIEBACKEND_HPP
// Include anyway - cv::gapi::ie::backend() still needs to be defined
#include "opencv2/gapi/infer/ie.hpp"
#ifdef HAVE_INF_ENGINE #ifdef HAVE_INF_ENGINE
#include <ade/util/algorithm.hpp> // type_list_index #include <ade/util/algorithm.hpp> // type_list_index
...@@ -35,7 +38,6 @@ ...@@ -35,7 +38,6 @@
#include <opencv2/gapi/garg.hpp> #include <opencv2/gapi/garg.hpp>
#include <opencv2/gapi/gproto.hpp> #include <opencv2/gapi/gproto.hpp>
#include <opencv2/gapi/infer/ie.hpp>
#include "api/gorigin.hpp" #include "api/gorigin.hpp"
#include "backends/common/gbackend.hpp" #include "backends/common/gbackend.hpp"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment