{"action":"created","comment":{"url":"https://api.github.com/repos/opencv/opencv/pulls/comments/85370563","pull_request_review_id":6091619,"id":85370563,"diff_hunk":"@@ -0,0 +1,1611 @@\n+// This file is part of OpenCV project.\n+// It is subject to the license terms in the LICENSE file found in the top-level directory\n+// of this distribution and at http://opencv.org/license.html.\n+\n+// Copyright (C) 2016, Intel Corporation, all rights reserved.\n+// Third party copyrights are property of their respective owners.\n+\n+/*\n+C++ wrappers over OpenVX 1.x C API\n+Details: TBD\n+*/\n+\n+#pragma once\n+#ifndef IVX_HPP\n+#define IVX_HPP\n+\n+#ifndef __cplusplus\n+    #error This file has to be compiled with C++ compiler\n+#endif\n+\n+\n+#include <VX/vx.h>\n+\n+#ifndef IVX_USE_CXX98\n+    // checking compiler\n+    #if __cplusplus < 201103L && (!defined(_MSC_VER) || _MSC_VER < 1800)\n+        #define IVX_USE_CXX98\n+    #endif\n+#endif // IVX_USE_CXX98\n+\n+#if defined(IVX_USE_CXX98) && !defined(IVX_HIDE_INFO_WARNINGS)\n+    #ifdef _MSC_VER\n+        #pragma message (\"ivx.hpp: The ISO C++ 2011 standard is not enabled, switching to C++98 fallback implementation.\")\n+    #else\n+        #warning The ISO C++ 2011 standard is not enabled, switching to C++98 fallback implementation.\n+    #endif\n+#endif // IVX_USE_CXX98\n+\n+#ifndef IVX_USE_EXTERNAL_REFCOUNT\n+    // checking OpenVX version\n+    #ifndef VX_VERSION_1_1\n+        #define IVX_USE_EXTERNAL_REFCOUNT\n+    #endif\n+#endif // IVX_USE_CXX98\n+\n+#if defined(IVX_USE_EXTERNAL_REFCOUNT) && !defined(IVX_HIDE_INFO_WARNINGS)\n+    #ifdef _MSC_VER\n+        #pragma message (\"ivx.hpp: OpenVX version < 1.1, switching to external refcounter implementation.\")\n+    #else\n+        #warning OpenVX version < 1.1, switching to external refcounter implementation.\n+    #endif\n+#endif // IVX_USE_EXTERNAL_REFCOUNT\n+\n+#include <stdexcept>\n+#include <utility>\n+#include <string>\n+#include <vector>\n+\n+#ifndef IVX_USE_CXX98\n+    #include <type_traits>\n+#else\n+    namespace ivx\n+    {\n+    template<typename, typename> struct is_same { static const bool value = false; };\n+    template<typename T> struct is_same<T, T>   { static const bool value = true; };\n+    }\n+#endif\n+\n+#ifdef IVX_USE_OPENCV\n+    #include \"opencv2/core.hpp\"\n+#endif\n+\n+namespace ivx\n+{\n+\n+/*\n+* RuntimeError - OpenVX runtime errors exception class\n+*/\n+class RuntimeError : public std::runtime_error\n+{\n+public:\n+    explicit RuntimeError(vx_status status, const std::string& msg = \"\")\n+        : runtime_error(msg), _status(status)\n+    {}\n+\n+    vx_status status() const\n+    { return _status; }\n+\n+private:\n+    vx_status   _status;\n+};\n+\n+/*\n+* WrapperError - wrappers logic errors exception class\n+*/\n+class WrapperError : public std::logic_error\n+{\n+public:\n+    explicit WrapperError(const std::string& msg) : logic_error(msg)\n+    {}\n+};\n+\n+inline void checkVxStatus(vx_status status, const std::string& func, const std::string& msg)\n+{\n+    if(status != VX_SUCCESS) throw RuntimeError( status, func + \"() : \" + msg );\n+}\n+\n+\n+#define IVX_CHECK_STATUS(code) checkVxStatus(code, __func__, #code)\n+\n+\n+/*\n+* EnumToType - enum to type compile-time converter (TODO: add more types)\n+*/\n+template<vx_enum E> struct EnumToType {};\n+template<> struct EnumToType<VX_TYPE_CHAR>     { typedef vx_char type;      static const vx_size bytes = sizeof(type); };\n+template<> struct EnumToType<VX_TYPE_INT8>     { typedef vx_int8 type;      static const vx_size bytes = sizeof(type); };\n+template<> struct EnumToType<VX_TYPE_UINT8>    { typedef vx_uint8 type;     static const vx_size bytes = sizeof(type); };\n+template<> struct EnumToType<VX_TYPE_INT16>    { typedef vx_int16 type;     static const vx_size bytes = sizeof(type); };\n+template<> struct EnumToType<VX_TYPE_UINT16>   { typedef vx_uint16 type;    static const vx_size bytes = sizeof(type); };\n+template<> struct EnumToType<VX_TYPE_INT32>    { typedef vx_int32 type;     static const vx_size bytes = sizeof(type); };\n+template<> struct EnumToType<VX_TYPE_UINT32>   { typedef vx_uint32 type;    static const vx_size bytes = sizeof(type); };\n+template<> struct EnumToType<VX_TYPE_INT64>    { typedef vx_int64 type;     static const vx_size bytes = sizeof(type); };\n+template<> struct EnumToType<VX_TYPE_UINT64>   { typedef vx_uint64 type;    static const vx_size bytes = sizeof(type); };\n+template<> struct EnumToType<VX_TYPE_FLOAT32>  { typedef vx_float32 type;   static const vx_size bytes = sizeof(type); };\n+template<> struct EnumToType<VX_TYPE_FLOAT64>  { typedef vx_float64 type;   static const vx_size bytes = sizeof(type); };\n+template<> struct EnumToType<VX_TYPE_ENUM>     { typedef vx_enum type;      static const vx_size bytes = sizeof(type); };\n+template<> struct EnumToType<VX_TYPE_SIZE>     { typedef vx_size type;      static const vx_size bytes = sizeof(type); };\n+template<> struct EnumToType<VX_TYPE_DF_IMAGE> { typedef vx_df_image type;  static const vx_size bytes = sizeof(type); };\n+template<> struct EnumToType<VX_TYPE_BOOL>     { typedef vx_bool type;      static const vx_size bytes = sizeof(type); };\n+#ifndef IVX_USE_CXX98\n+template <vx_enum E> using EnumToType_t = typename EnumToType<E>::type;\n+#endif\n+\n+vx_size enumToTypeSize(vx_enum type)\n+{\n+    switch (type)\n+    {\n+    case VX_TYPE_CHAR:      return EnumToType<VX_TYPE_CHAR>::bytes;\n+    case VX_TYPE_INT8:      return EnumToType<VX_TYPE_INT8>::bytes;\n+    case VX_TYPE_UINT8:     return EnumToType<VX_TYPE_UINT8>::bytes;\n+    case VX_TYPE_INT16:     return EnumToType<VX_TYPE_INT16>::bytes;\n+    case VX_TYPE_UINT16:    return EnumToType<VX_TYPE_UINT16>::bytes;\n+    case VX_TYPE_INT32:     return EnumToType<VX_TYPE_INT32>::bytes;\n+    case VX_TYPE_UINT32:    return EnumToType<VX_TYPE_UINT32>::bytes;\n+    case VX_TYPE_INT64:     return EnumToType<VX_TYPE_INT64>::bytes;\n+    case VX_TYPE_UINT64:    return EnumToType<VX_TYPE_UINT64>::bytes;\n+    case VX_TYPE_FLOAT32:   return EnumToType<VX_TYPE_FLOAT32>::bytes;\n+    case VX_TYPE_FLOAT64:   return EnumToType<VX_TYPE_FLOAT64>::bytes;\n+    case VX_TYPE_ENUM:      return EnumToType<VX_TYPE_ENUM>::bytes;\n+    case VX_TYPE_SIZE:      return EnumToType<VX_TYPE_SIZE>::bytes;\n+    case VX_TYPE_DF_IMAGE:  return EnumToType<VX_TYPE_DF_IMAGE>::bytes;\n+    case VX_TYPE_BOOL:      return EnumToType<VX_TYPE_BOOL>::bytes;\n+    default: throw WrapperError(std::string(__func__) + \": unsupported type enum\");\n+    }\n+}\n+\n+/*\n+* TypeToEnum - type to enum compile-time converter (TODO: add more types)\n+*/\n+template<typename T> struct TypeToEnum {};\n+template<> struct TypeToEnum<vx_char>     { static const vx_enum value = VX_TYPE_CHAR; };\n+template<> struct TypeToEnum<vx_int8>     { static const vx_enum value = VX_TYPE_INT8; };\n+template<> struct TypeToEnum<vx_uint8>    { static const vx_enum value = VX_TYPE_UINT8; };\n+template<> struct TypeToEnum<vx_int16>    { static const vx_enum value = VX_TYPE_INT16; };\n+template<> struct TypeToEnum<vx_uint16>   { static const vx_enum value = VX_TYPE_UINT16; };\n+template<> struct TypeToEnum<vx_int32>    { static const vx_enum value = VX_TYPE_INT32; };\n+template<> struct TypeToEnum<vx_uint32>   { static const vx_enum value = VX_TYPE_UINT32; };\n+template<> struct TypeToEnum<vx_int64>    { static const vx_enum value = VX_TYPE_INT64; };\n+template<> struct TypeToEnum<vx_uint64>   { static const vx_enum value = VX_TYPE_UINT64; };\n+template<> struct TypeToEnum<vx_float32>  { static const vx_enum value = VX_TYPE_FLOAT32; };\n+template<> struct TypeToEnum<vx_float64>  { static const vx_enum value = VX_TYPE_FLOAT64; };\n+template<> struct TypeToEnum<vx_bool>     { static const vx_enum value = VX_TYPE_BOOL; };\n+// the commented types are aliases (of integral tyes) and have conflicts with the types above\n+//template<> struct TypeToEnum<vx_enum>     { static const vx_enum val = VX_TYPE_ENUM; };\n+//template<> struct TypeToEnum<vx_size>     { static const vx_enum val = VX_TYPE_SIZE; };\n+//template<> struct TypeToEnum<vx_df_image> { static const vx_enum val = VX_TYPE_DF_IMAGE; };\n+\n+/*\n+* RefTypeTraits - provides info for vx_reference extending types\n+*/\n+template <typename T> struct RefTypeTraits {};\n+\n+class Context;\n+template <> struct RefTypeTraits <vx_context>\n+{\n+    typedef vx_context vxType;\n+    typedef Context wrapperType;\n+    static const vx_enum vxTypeEnum = VX_TYPE_CONTEXT;\n+    static vx_status release(vxType& ref) { return vxReleaseContext(&ref); }\n+};\n+\n+class Graph;\n+template <> struct RefTypeTraits <vx_graph>\n+{\n+    typedef vx_graph vxType;\n+    typedef Graph wrapperType;\n+    static const vx_enum vxTypeEnum = VX_TYPE_GRAPH;\n+    static vx_status release(vxType& ref) { return vxReleaseGraph(&ref); }\n+};\n+\n+class Node;\n+template <> struct RefTypeTraits <vx_node>\n+{\n+    typedef vx_node vxType;\n+    typedef Node wrapperType;\n+    static const vx_enum vxTypeEnum = VX_TYPE_NODE;\n+    static vx_status release(vxType& ref) { return vxReleaseNode(&ref); }\n+};\n+\n+class Kernel;\n+template <> struct RefTypeTraits <vx_kernel>\n+{\n+    typedef vx_kernel vxType;\n+    typedef Kernel wrapperType;\n+    static const vx_enum vxTypeEnum = VX_TYPE_KERNEL;\n+    static vx_status release(vxType& ref) { return vxReleaseKernel(&ref); }\n+};\n+\n+class Param;\n+template <> struct RefTypeTraits <vx_parameter>\n+{\n+    typedef vx_parameter vxType;\n+    typedef Param wrapperType;\n+    static const vx_enum vxTypeEnum = VX_TYPE_PARAMETER;\n+    static vx_status release(vxType& ref) { return vxReleaseParameter(&ref); }\n+};\n+\n+class Image;\n+template <> struct RefTypeTraits <vx_image>\n+{\n+    typedef vx_image vxType;\n+    typedef Image wrapperType;\n+    static const vx_enum vxTypeEnum = VX_TYPE_IMAGE;\n+    static vx_status release(vxType& ref) { return vxReleaseImage(&ref); }\n+};\n+\n+class Scalar;\n+template <> struct RefTypeTraits <vx_scalar>\n+{\n+    typedef vx_scalar vxType;\n+    typedef Scalar wrapperType;\n+    static const vx_enum vxTypeEnum = VX_TYPE_SCALAR;\n+    static vx_status release(vxType& ref) { return vxReleaseScalar(&ref); }\n+};\n+\n+class Array;\n+template <> struct RefTypeTraits <vx_array>\n+{\n+    typedef vx_array vxType;\n+    typedef Array wrapperType;\n+    static const vx_enum vxTypeEnum = VX_TYPE_ARRAY;\n+    static vx_status release(vxType& ref) { return vxReleaseArray(&ref); }\n+};\n+\n+class Threshold;\n+template <> struct RefTypeTraits <vx_threshold>\n+{\n+    typedef vx_threshold vxType;\n+    typedef Threshold wrapperType;\n+    static const vx_enum vxTypeEnum = VX_TYPE_THRESHOLD;\n+    static vx_status release(vxType& ref) { return vxReleaseThreshold(&ref); }\n+};\n+\n+/*\n+* Casting to vx_reference with compile-time check\n+*/\n+#ifdef IVX_USE_CXX98\n+\n+// takes 'vx_reference' itself and RefWrapper<T> via 'operator vx_reference()'\n+vx_reference castToReference(vx_reference ref)\n+{ return ref; }\n+\n+// takes vx_reference extensions that have RefTypeTraits<T> specializations\n+template<typename T>\n+vx_reference castToReference(const T& ref, typename RefTypeTraits<T>::vxType dummy = 0)\n+{ (void)dummy; return (vx_reference)ref; }\n+\n+#else\n+\n+template<typename T, typename = void>\n+struct is_ref : std::is_same<T, vx_reference>{}; // allow vx_reference\n+\n+// allow RefWrapper<> types\n+template<typename T>\n+#ifndef _MSC_VER\n+struct is_ref<T, decltype(T().operator vx_reference(), void())> : std::true_type {};\n+#else\n+// workarounding VC14 compiler crash\n+struct is_ref<T, decltype(T::vxType(), void())> : std::true_type {};\n+#endif\n+\n+// allow vx_reference extensions\n+template<typename T>\n+struct is_ref<T, decltype(RefTypeTraits<T>::vxTypeEnum, void())> : std::true_type {};\n+\n+template<typename T>\n+vx_reference castToReference(const T& obj)\n+{\n+    static_assert(is_ref<T>::value, \"unsupported conversion\");\n+    return (vx_reference) obj;\n+}\n+\n+#endif // IVX_USE_CXX98\n+\n+inline void checkVxRef(vx_reference ref, const std::string& func, const std::string& msg)\n+{\n+    vx_status status = vxGetStatus(ref);\n+    if(status != VX_SUCCESS) throw RuntimeError( status, func + \"() : \" + msg );\n+}\n+\n+#define IVX_CHECK_REF(code) checkVxRef(castToReference(code), __func__, #code)\n+\n+/*\n+* RefWrapper - base class for referenced objects wrappers\n+*/\n+\n+#ifdef IVX_USE_EXTERNAL_REFCOUNT\n+\n+template <typename T> class RefWrapper\n+{\n+public:\n+    typedef T vxType;\n+    static const vx_enum vxTypeEnum = RefTypeTraits <T>::vxTypeEnum;\n+\n+    RefWrapper() : ref(0), refcount(0)\n+    {}\n+\n+    explicit RefWrapper(T r, bool retainRef = false) : ref(0), refcount(0)\n+    { reset(r, retainRef); }\n+\n+    RefWrapper(const RefWrapper& r) : ref(r.ref), refcount(r.refcount)\n+    { addRef(); }\n+\n+#ifndef IVX_USE_CXX98\n+    RefWrapper(RefWrapper&& rw) noexcept : RefWrapper()\n+    {\n+        using std::swap;\n+        swap(ref, rw.ref);\n+        swap(refcount, rw.refcount);\n+    }\n+#endif\n+\n+    operator T() const\n+    { return ref; }\n+\n+    operator vx_reference() const\n+    { return castToReference(ref); }\n+\n+    void reset(T r, bool retainRef = false)\n+    {\n+        release();\n+        ref = r;\n+#ifdef VX_VERSION_1_1\n+        if(retainRef) addRef();\n+#else\n+        // if 'retainRef' -just don't use ref-counting for v 1.0\n+        if(!retainRef) refcount = new int(1);\n+#endif\n+        checkRef();\n+    }\n+\n+    void reset()\n+    { release(); }\n+\n+    T detach()\n+    {\n+        T tmp = ref;\n+        ref = 0;\n+        release();\n+        return tmp;\n+    }\n+\n+    RefWrapper& operator=(RefWrapper r)\n+    {\n+        using std::swap;\n+        swap(ref, r.ref);\n+        swap(refcount, r.refcount);\n+        return *this;\n+    }\n+\n+    bool operator !() const\n+    { return ref == 0; }\n+\n+#ifndef IVX_USE_CXX98\n+    explicit operator bool() const\n+    { return ref != 0; }\n+#endif\n+\n+#ifdef IVX_USE_CXX98\n+    template<typename C>\n+    C get() const\n+    {\n+        typedef int static_assert_context[is_same<C, Context>::value ? 1 : -1];\n+        vx_context c = vxGetContext(castToReference(ref));\n+        // vxGetContext doesn't increment ref count, let do it in wrapper c-tor\n+        return C(c, true);\n+    }\n+#else\n+    template<typename C = Context, typename = typename std::enable_if<std::is_same<C, Context>::value>::type>\n+    C getContext() const\n+    {\n+        vx_context c = vxGetContext(castToReference(ref));\n+        // vxGetContext doesn't increment ref count, let do it in wrapper c-tor\n+        return C(c, true);\n+    }\n+#endif // IVX_USE_CXX98\n+\n+protected:\n+    T ref;\n+    int* refcount;\n+\n+    void addRef()\n+    {\n+#ifdef VX_VERSION_1_1\n+        if(ref) IVX_CHECK_STATUS(vxRetainReference(castToReference(ref)));\n+#else //TODO: make thread-safe\n+        if(refcount) ++(*refcount);\n+#endif\n+    }\n+\n+    void release()\n+    {\n+#ifdef VX_VERSION_1_1\n+        if(ref) RefTypeTraits<T>::release(ref);\n+#else //TODO: make thread-safe\n+        if(refcount && --(*refcount) == 0)\n+        {\n+            if(ref) RefTypeTraits<T>::release(ref);\n+            ref = 0;\n+            delete refcount;\n+            refcount = 0;\n+        }\n+#endif\n+    }\n+\n+    void checkRef() const\n+    {\n+        IVX_CHECK_REF(ref);\n+        vx_enum type;\n+        IVX_CHECK_STATUS(vxQueryReference((vx_reference)ref, VX_REF_ATTRIBUTE_TYPE, &type, sizeof(type)));\n+        if (type != vxTypeEnum) throw WrapperError(\"incompatible reference type\");\n+    }\n+\n+    ~RefWrapper()\n+    { release(); }\n+};\n+\n+#ifdef IVX_USE_CXX98\n+\n+    #define IVX_REF_STD_CTORS_AND_ASSIGNMENT(Class) \\\n+        Class() : RefWrapper() {} \\\n+        explicit Class(Class::vxType _ref, bool retainRef = false) : RefWrapper(_ref, retainRef) {} \\\n+        Class(const Class& _obj) : RefWrapper(_obj) {} \\\n+        \\\n+        Class& operator=(Class _obj) { using std::swap; swap(ref, _obj.ref); swap(refcount, _obj.refcount); return *this; }\n+\n+#else\n+\n+    #define IVX_REF_STD_CTORS_AND_ASSIGNMENT(Class) \\\n+        Class() : RefWrapper() {} \\\n+        explicit Class(Class::vxType _ref, bool retainRef = false) : RefWrapper(_ref, retainRef) {} \\\n+        Class(const Class& _obj) : RefWrapper(_obj) {} \\\n+        Class(Class&& _obj) : RefWrapper(std::move(_obj)) {} \\\n+        \\\n+        Class& operator=(Class _obj) { using std::swap; swap(ref, _obj.ref); swap(refcount, _obj.refcount); return *this; }\n+\n+#endif // IVX_USE_CXX98\n+\n+#else // not IVX_USE_EXTERNAL_REFCOUNT\n+\n+template <typename T> class RefWrapper\n+{\n+public:\n+    typedef T vxType;\n+    static const vx_enum vxTypeEnum = RefTypeTraits <T>::vxTypeEnum;\n+\n+    RefWrapper() : ref(0)\n+    {}\n+\n+    explicit RefWrapper(T r, bool retainRef = false) : ref(0)\n+    { reset(r, retainRef); }\n+\n+    RefWrapper(const RefWrapper& r) : ref(r.ref)\n+    { addRef(); }\n+\n+#ifndef IVX_USE_CXX98\n+    RefWrapper(RefWrapper&& rw) noexcept : RefWrapper()\n+    {\n+        using std::swap;\n+        swap(ref, rw.ref);\n+    }\n+#endif\n+\n+    operator T() const\n+    { return ref; }\n+\n+    operator vx_reference() const\n+    { return castToReference(ref); }\n+\n+#ifdef IVX_USE_CXX98\n+    template<typename C>\n+    C get() const\n+    {\n+        typedef int static_assert_context[is_same<C, Context>::value ? 1 : -1];\n+        vx_context c = vxGetContext(castToReference(ref));\n+        // vxGetContext doesn't increment ref count, let do it in wrapper c-tor\n+        return C(c, true);\n+    }\n+#else\n+    template<typename C = Context, typename = typename std::enable_if<std::is_same<C, Context>::value>::type>\n+    C getContext() const\n+    {\n+        vx_context c = vxGetContext(castToReference(ref));\n+        // vxGetContext doesn't increment ref count, let do it in wrapper c-tor\n+        return C(c, true);\n+    }\n+#endif // IVX_USE_CXX98\n+\n+    void reset(T r, bool retainRef = false)\n+    {\n+        release();\n+        ref = r;\n+        if (retainRef) addRef();\n+        checkRef();\n+    }\n+\n+    void reset()\n+    { release(); }\n+\n+    T detach()\n+    {\n+        T tmp = ref;\n+        ref = 0;\n+        return tmp;\n+    }\n+\n+    RefWrapper& operator=(RefWrapper r)\n+    {\n+        using std::swap;\n+        swap(ref, r.ref);\n+        return *this;\n+    }\n+\n+    bool operator !() const\n+    { return ref == 0; }\n+\n+#ifndef IVX_USE_CXX98\n+    explicit operator bool() const\n+    { return ref != 0; }\n+#endif\n+\n+protected:\n+    T ref;\n+\n+    void addRef()\n+    { if (ref) IVX_CHECK_STATUS(vxRetainReference((vx_reference)ref)); }\n+\n+    void release()\n+    {\n+        if (ref) RefTypeTraits<T>::release(ref);\n+        ref = 0;\n+    }\n+\n+    void checkRef() const\n+    {\n+        IVX_CHECK_REF(ref);\n+        vx_enum type;\n+        IVX_CHECK_STATUS(vxQueryReference((vx_reference)ref, VX_REF_ATTRIBUTE_TYPE, &type, sizeof(type)));\n+        if (type != vxTypeEnum) throw WrapperError(\"incompatible reference type\");\n+    }\n+\n+    ~RefWrapper()\n+    { release(); }\n+};\n+\n+#ifdef IVX_USE_CXX98\n+\n+    #define IVX_REF_STD_CTORS_AND_ASSIGNMENT(Class) \\\n+        Class() : RefWrapper() {} \\\n+        explicit Class(Class::vxType _ref, bool retainRef = false) : RefWrapper(_ref, retainRef) {} \\\n+        Class(const Class& _obj) : RefWrapper(_obj) {} \\\n+        \\\n+        Class& operator=(Class _obj) { using std::swap; swap(ref, _obj.ref); return *this; }\n+\n+#else\n+\n+    #define IVX_REF_STD_CTORS_AND_ASSIGNMENT(Class) \\\n+        Class() : RefWrapper() {} \\\n+        explicit Class(Class::vxType _ref, bool retainRef = false) : RefWrapper(_ref, retainRef) {} \\\n+        Class(const Class& _obj) : RefWrapper(_obj) {} \\\n+        Class(Class&& _obj) : RefWrapper(std::move(_obj)) {} \\\n+        \\\n+        Class& operator=(Class _obj) { using std::swap; swap(ref, _obj.ref); return *this; }\n+\n+#endif // IVX_USE_CXX98\n+\n+#endif // IVX_USE_EXTERNAL_REFCOUNT\n+\n+/*\n+* Context\n+*/\n+class Context : public RefWrapper<vx_context>\n+{\n+public:\n+\n+    IVX_REF_STD_CTORS_AND_ASSIGNMENT(Context)\n+\n+    static Context create()\n+    { return Context(vxCreateContext()); }\n+\n+    template <typename T>\n+    static Context getFrom(const T& ref)\n+    {\n+        vx_context c = vxGetContext(castToReference(ref));\n+        // vxGetContext doesn't increment ref count, let do it in wrapper c-tor\n+        return Context(c, true);\n+    }\n+\n+    void loadKernels(const std::string& module)\n+    { IVX_CHECK_STATUS( vxLoadKernels(ref, module.c_str()) ); }\n+};\n+\n+/*\n+* Graph\n+*/\n+class Graph : public RefWrapper<vx_graph>\n+{\n+public:\n+    IVX_REF_STD_CTORS_AND_ASSIGNMENT(Graph);\n+\n+    static Graph create(vx_context c)\n+    { return Graph(vxCreateGraph(c)); }\n+\n+    void verify()\n+    { IVX_CHECK_STATUS( vxVerifyGraph(ref) ); }\n+\n+    void process()\n+    { IVX_CHECK_STATUS( vxProcessGraph(ref) ); }\n+\n+    void schedule()\n+    { IVX_CHECK_STATUS(vxScheduleGraph(ref) ); }\n+\n+    void wait()\n+    { IVX_CHECK_STATUS(vxWaitGraph(ref)); }\n+};\n+\n+/*\n+* Kernel\n+*/\n+class Kernel : public RefWrapper<vx_kernel>\n+{\n+public:\n+    IVX_REF_STD_CTORS_AND_ASSIGNMENT(Kernel);\n+\n+    static Kernel getByEnum(vx_context c, vx_enum kernelID)\n+    { return Kernel(vxGetKernelByEnum(c, kernelID)); }\n+\n+    static Kernel getByName(vx_context c, const std::string& name)\n+    { return Kernel(vxGetKernelByName(c, name.c_str())); }\n+};\n+\n+/*\n+* Node\n+*/\n+#ifdef IVX_USE_CXX98\n+\n+class Node : public RefWrapper<vx_node>\n+{\n+public:\n+    IVX_REF_STD_CTORS_AND_ASSIGNMENT(Node);\n+\n+    static Node create(vx_graph g, vx_kernel k)\n+    { return Node(vxCreateGenericNode(g, k)); }\n+\n+    static Node create(vx_graph graph, vx_kernel kernel, const std::vector<vx_reference>& params)\n+    {\n+        Node node = Node::create(graph, kernel);\n+        vx_uint32 i = 0;\n+        for (std::vector<vx_reference>::const_iterator p = params.begin(); p != params.end(); ++p)\n+            node.setParameterByIndex(i++, *p);\n+        return node;\n+    }\n+\n+    static Node create(vx_graph graph,  vx_enum kernelID, const std::vector<vx_reference>& params)\n+    { return Node::create(graph, Kernel::getByEnum(Context::getFrom(graph), kernelID), params); }\n+\n+    template<typename T0>\n+    static Node create(vx_graph g, vx_enum kernelID,\n+                       const T0& arg0)\n+    {\n+        std::vector<vx_reference> params;\n+        params.push_back(castToReference(arg0));\n+        return create(g, Kernel::getByEnum(Context::getFrom(g), kernelID), params);\n+    }\n+\n+    template<typename T0, typename T1>\n+    static Node create(vx_graph g, vx_enum kernelID,\n+                       const T0& arg0, const T1& arg1)\n+    {\n+        std::vector<vx_reference> params;\n+        params.push_back(castToReference(arg0));\n+        params.push_back(castToReference(arg1));\n+        return create(g, Kernel::getByEnum(Context::getFrom(g), kernelID), params);\n+    }\n+\n+    template<typename T0, typename T1, typename T2>\n+    static Node create(vx_graph g, vx_enum kernelID,\n+                       const T0& arg0, const T1& arg1, const T2& arg2)\n+    {\n+        std::vector<vx_reference> params;\n+        params.push_back(castToReference(arg0));\n+        params.push_back(castToReference(arg1));\n+        params.push_back(castToReference(arg2));\n+        return create(g, Kernel::getByEnum(Context::getFrom(g), kernelID), params);\n+    }\n+\n+    template<typename T0, typename T1, typename T2, typename T3>\n+    static Node create(vx_graph g, vx_enum kernelID,\n+                       const T0& arg0, const T1& arg1, const T2& arg2,\n+                       const T3& arg3)\n+    {\n+        std::vector<vx_reference> params;\n+        params.push_back(castToReference(arg0));\n+        params.push_back(castToReference(arg1));\n+        params.push_back(castToReference(arg2));\n+        params.push_back(castToReference(arg3));\n+        return create(g, Kernel::getByEnum(Context::getFrom(g), kernelID), params);\n+    }\n+\n+    template<typename T0, typename T1, typename T2, typename T3, typename T4>\n+    static Node create(vx_graph g, vx_enum kernelID,\n+                       const T0& arg0, const T1& arg1, const T2& arg2,\n+                       const T3& arg3, const T4& arg4)\n+    {\n+        std::vector<vx_reference> params;\n+        params.push_back(castToReference(arg0));\n+        params.push_back(castToReference(arg1));\n+        params.push_back(castToReference(arg2));\n+        params.push_back(castToReference(arg3));\n+        params.push_back(castToReference(arg4));\n+        return create(g, Kernel::getByEnum(Context::getFrom(g), kernelID), params);\n+    }\n+\n+    template<typename T0, typename T1, typename T2, typename T3, typename T4, typename T5>\n+    static Node create(vx_graph g, vx_enum kernelID,\n+                       const T0& arg0, const T1& arg1, const T2& arg2,\n+                       const T3& arg3, const T4& arg4, const T5& arg5)\n+    {\n+        std::vector<vx_reference> params;\n+        params.push_back(castToReference(arg0));\n+        params.push_back(castToReference(arg1));\n+        params.push_back(castToReference(arg2));\n+        params.push_back(castToReference(arg3));\n+        params.push_back(castToReference(arg4));\n+        params.push_back(castToReference(arg5));\n+        return create(g, Kernel::getByEnum(Context::getFrom(g), kernelID), params);\n+    }\n+\n+    void setParameterByIndex(vx_uint32 index, vx_reference value)\n+    { IVX_CHECK_STATUS(vxSetParameterByIndex(ref, index, value)); }\n+};\n+\n+#else // not IVX_USE_CXX98\n+\n+class Node : public RefWrapper<vx_node>\n+{\n+public:\n+    IVX_REF_STD_CTORS_AND_ASSIGNMENT(Node);\n+\n+    static Node create(vx_graph g, vx_kernel k)\n+    { return Node(vxCreateGenericNode(g, k)); }\n+\n+    static Node create(vx_graph graph, vx_kernel kernel, const std::vector<vx_reference>& params)\n+    {\n+        Node node = Node::create(graph, kernel);\n+        vx_uint32 i = 0;\n+        for (const auto& p : params)\n+            node.setParameterByIndex(i++, p);\n+        return node;\n+    }\n+\n+    static Node create(vx_graph graph,  vx_enum kernelID, const std::vector<vx_reference>& params)\n+    { return Node::create(graph, Kernel::getByEnum(Context::getFrom(graph), kernelID), params); }\n+\n+    template<typename...Ts>\n+    static Node create(vx_graph g, vx_enum kernelID, const Ts&...args)\n+    { return create(g, Kernel::getByEnum(Context::getFrom(g), kernelID), { castToReference(args)... }); }\n+\n+\n+    void setParameterByIndex(vx_uint32 index, vx_reference value)\n+    { IVX_CHECK_STATUS(vxSetParameterByIndex(ref, index, value)); }\n+};\n+\n+#endif // IVX_USE_CXX98\n+\n+/*\n+* Image\n+*/\n+class Image : public RefWrapper<vx_image>\n+{\n+public:\n+    IVX_REF_STD_CTORS_AND_ASSIGNMENT(Image);\n+\n+    static Image create(vx_context context, vx_uint32 width, vx_uint32 height, vx_df_image format)\n+    { return Image(vxCreateImage(context, width, height, format)); }\n+\n+    static Image createVirtual(vx_graph graph, vx_uint32 width = 0, vx_uint32 height = 0, vx_df_image format = VX_DF_IMAGE_VIRT)\n+    { return Image(vxCreateVirtualImage(graph, width, height, format)); }\n+\n+    static vx_size planes(vx_df_image format)\n+    {\n+        switch (format)\n+        {\n+        case VX_DF_IMAGE_IYUV:\n+        case VX_DF_IMAGE_YUV4: return 3;\n+        case VX_DF_IMAGE_NV12:\n+        case VX_DF_IMAGE_NV21: return 2;\n+        case VX_DF_IMAGE_RGB:\n+        case VX_DF_IMAGE_RGBX:\n+        case VX_DF_IMAGE_UYVY:\n+        case VX_DF_IMAGE_YUYV:\n+        case VX_DF_IMAGE_U8:\n+        case VX_DF_IMAGE_U16:\n+        case VX_DF_IMAGE_S16:\n+        case VX_DF_IMAGE_U32:\n+        case VX_DF_IMAGE_S32:\n+        case /*VX_DF_IMAGE_F32*/VX_DF_IMAGE('F', '0', '3', '2'):\n+                               return 1;\n+        default:               return 0;\n+        }\n+    }\n+\n+    static vx_imagepatch_addressing_t createAddressing()\n+    { vx_imagepatch_addressing_t ipa = VX_IMAGEPATCH_ADDR_INIT; return ipa; }\n+\n+    static vx_imagepatch_addressing_t createAddressing(\n+            vx_uint32 dimX, vx_uint32 dimY,\n+            vx_int32 strideX, vx_int32 strideY,\n+            vx_uint32 scaleX = VX_SCALE_UNITY, vx_uint32 scaleY = VX_SCALE_UNITY )\n+    {\n+        if (std::abs(strideY) < std::abs(strideX*(vx_int32)dimX))\n+            throw WrapperError(std::string(__func__)+\"(): invalid arguments\");\n+        vx_imagepatch_addressing_t ipa = VX_IMAGEPATCH_ADDR_INIT;\n+        ipa.dim_x = dimX;\n+        ipa.dim_y = dimY;\n+        ipa.stride_x = strideX;\n+        ipa.stride_y = strideY;\n+        ipa.scale_x = scaleX;\n+        ipa.scale_y = scaleY;\n+        return ipa;\n+    }\n+\n+    vx_imagepatch_addressing_t createAddressing(vx_uint32 planeIdx)\n+    { return createAddressing(planeIdx, getValidRegion()); }\n+\n+    vx_imagepatch_addressing_t createAddressing(vx_uint32 planeIdx, const vx_rectangle_t& rect)\n+    {\n+        vx_uint32 w = rect.end_x-rect.start_x, h = rect.end_y-rect.start_y;\n+        vx_size patchBytes = computePatchSize(planeIdx, rect);\n+        vx_imagepatch_addressing_t ipa = createAddressing(w, h, (vx_int32)(patchBytes/w/h), (vx_int32)(patchBytes/h));\n+        return ipa;\n+    }\n+\n+#ifndef VX_VERSION_1_1\n+    static const vx_enum VX_MEMORY_TYPE_HOST = VX_IMPORT_TYPE_HOST;\n+#endif\n+    static Image createFromHandle(\n+            vx_context context, vx_df_image format,\n+            const std::vector<vx_imagepatch_addressing_t>& addrs,\n+            const std::vector<void*>& ptrs, vx_enum memType = VX_MEMORY_TYPE_HOST )\n+    {\n+        vx_size num = planes(format);\n+        if(num == 0)\n+            throw WrapperError(std::string(__func__)+\"(): unknown/unexpected planes number for the requested format\");\n+        if (addrs.size() != num || ptrs.size() != num)\n+            throw WrapperError(std::string(__func__)+\"(): incomplete input\");\n+#ifdef VX_VERSION_1_1\n+        return Image(vxCreateImageFromHandle(context, format, &addrs[0], &ptrs[0], memType));\n+#else\n+        return Image( vxCreateImageFromHandle(context, format,\n+                     const_cast<vx_imagepatch_addressing_t*>(&addrs[0]),\n+                     const_cast<void**>(&ptrs[0]), memType) );\n+#endif\n+    }\n+\n+#ifdef VX_VERSION_1_1\n+    void swapHandle(const std::vector<void*>& newPtrs, std::vector<void*>& prevPtrs)\n+    {\n+        vx_size num = planes();\n+        if(num == 0)\n+            throw WrapperError(std::string(__func__)+\"(): unexpected planes number\");\n+        if (newPtrs.size() < num)\n+            throw WrapperError(std::string(__func__)+\"(): too few input pointers\");\n+        if (prevPtrs.empty()) prevPtrs.resize(num, 0);\n+        else if (prevPtrs.size() < num)\n+            throw WrapperError(std::string(__func__)+\"(): too few output pointers\");\n+        IVX_CHECK_STATUS( vxSwapImageHandle(ref, &newPtrs[0], &prevPtrs[0], num) );\n+    }\n+\n+    void swapHandle(const std::vector<void*>& newPtrs)\n+    {\n+        vx_size num = planes();\n+        if(num == 0)\n+            throw WrapperError(std::string(__func__)+\"(): unexpected planes number\");\n+        if (newPtrs.size() < num)\n+            throw WrapperError(std::string(__func__)+\"(): too few input pointers\");\n+        IVX_CHECK_STATUS( vxSwapImageHandle(ref, &newPtrs[0], 0, num) );\n+    }\n+\n+    void swapHandle()\n+    { IVX_CHECK_STATUS( vxSwapImageHandle(ref, 0, 0, 0) ); }\n+\n+    Image createFromChannel(vx_enum channel)\n+    { return Image(vxCreateImageFromChannel(ref, channel)); }\n+#endif // VX_VERSION_1_1\n+\n+    template<typename T>\n+    void query(vx_enum att, T& value) const\n+    { IVX_CHECK_STATUS( vxQueryImage(ref, att, &value, sizeof(value)) ); }\n+\n+#ifndef VX_VERSION_1_1\n+static const vx_enum\n+    VX_IMAGE_WIDTH  = VX_IMAGE_ATTRIBUTE_WIDTH,\n+    VX_IMAGE_HEIGHT = VX_IMAGE_ATTRIBUTE_HEIGHT,\n+    VX_IMAGE_FORMAT = VX_IMAGE_ATTRIBUTE_FORMAT,\n+    VX_IMAGE_PLANES = VX_IMAGE_ATTRIBUTE_PLANES,\n+    VX_IMAGE_SPACE  = VX_IMAGE_ATTRIBUTE_SPACE,\n+    VX_IMAGE_RANGE  = VX_IMAGE_ATTRIBUTE_RANGE,\n+    VX_IMAGE_SIZE   = VX_IMAGE_ATTRIBUTE_SIZE;\n+#endif\n+\n+    vx_uint32 width() const\n+    {\n+        vx_uint32 v;\n+        query(VX_IMAGE_WIDTH, v);\n+        return v;\n+    }\n+\n+    vx_uint32 height() const\n+    {\n+        vx_uint32 v;\n+        query(VX_IMAGE_HEIGHT, v);\n+        return v;\n+    }\n+\n+    vx_df_image format() const\n+    {\n+        vx_df_image v;\n+        query(VX_IMAGE_FORMAT, v);\n+        return v;\n+    }\n+\n+    vx_size planes() const\n+    {\n+        vx_size v;\n+        query(VX_IMAGE_PLANES, v);\n+        return v;\n+    }\n+\n+    vx_enum space() const\n+    {\n+        vx_enum v;\n+        query(VX_IMAGE_SPACE, v);\n+        return v;\n+    }\n+\n+    vx_enum range() const\n+    {\n+        vx_enum v;\n+        query(VX_IMAGE_RANGE, v);\n+        return v;\n+    }\n+\n+    vx_size size() const\n+    {\n+        vx_size v;\n+        query(VX_IMAGE_SIZE, v);\n+        return v;\n+    }\n+\n+#ifdef VX_VERSION_1_1\n+    vx_memory_type_e memType() const\n+    {\n+        vx_memory_type_e v;\n+        query(VX_IMAGE_MEMORY_TYPE, v);\n+        return v;\n+    }\n+#endif // VX_VERSION_1_1\n+\n+    vx_rectangle_t getValidRegion() const\n+    {\n+        vx_rectangle_t rect;\n+        IVX_CHECK_STATUS( vxGetValidRegionImage(ref, &rect) );\n+        return rect;\n+    }\n+\n+    vx_size computePatchSize(vx_uint32 planeIdx)\n+    { return computePatchSize(planeIdx, getValidRegion()); }\n+\n+    vx_size computePatchSize(vx_uint32 planeIdx, const vx_rectangle_t& rect)\n+    {\n+        vx_size bytes = vxComputeImagePatchSize(ref, &rect, planeIdx);\n+        if (bytes == 0) throw WrapperError(std::string(__func__)+\"(): vxComputeImagePatchSize returned 0\");\n+        return bytes;\n+    }\n+\n+#ifdef VX_VERSION_1_1\n+    void setValidRectangle(const vx_rectangle_t& rect)\n+    { IVX_CHECK_STATUS( vxSetImageValidRectangle(ref, &rect) ); }\n+#endif // VX_VERSION_1_1\n+\n+    void copyTo(vx_uint32 planeIdx, const vx_imagepatch_addressing_t& addr, void* data)\n+    {\n+        if(!data) throw WrapperError(std::string(__func__)+\"(): output pointer is 0\");\n+        vx_rectangle_t r = getValidRegion();\n+        // TODO: add sizes consistency checks\n+        /*\n+        vx_uint32 w = r.end_x - r.start_x, h = r.end_y - r.start_y;\n+        if (w != addr.dim_x) throw WrapperError(\"Image::copyTo(): inconsistent dimension X\");\n+        if (h != addr.dim_y) throw WrapperError(\"Image::copyTo(): inconsistent dimension Y\");\n+        */\n+#ifdef VX_VERSION_1_1\n+        IVX_CHECK_STATUS(vxCopyImagePatch(ref, &r, planeIdx, &addr, data, VX_READ_ONLY, VX_MEMORY_TYPE_HOST));\n+#else\n+        vx_imagepatch_addressing_t* a = const_cast<vx_imagepatch_addressing_t*>(&addr);\n+        IVX_CHECK_STATUS(vxAccessImagePatch(ref, &r, planeIdx, a, &data, VX_READ_ONLY));\n+        IVX_CHECK_STATUS(vxCommitImagePatch(ref, 0, planeIdx, a, data));\n+#endif\n+    }\n+\n+    void copyFrom(vx_uint32 planeIdx, const vx_imagepatch_addressing_t& addr, const void* data)\n+    {\n+        if (!data) throw WrapperError(std::string(__func__)+\"(): input pointer is 0\");\n+        vx_rectangle_t r = getValidRegion();\n+        // TODO: add sizes consistency checks\n+        /*\n+        vx_uint32 w = r.end_x - r.start_x, h = r.end_y - r.start_y;\n+        //vx_size patchBytes = vxComputeImagePatchSize(ref, &r, planeIdx);\n+        if (w != addr.dim_x) throw WrapperError(\"Image::copyFrom(): inconsistent dimension X\");\n+        if (h != addr.dim_y) throw WrapperError(\"Image::copyFrom(): inconsistent dimension Y\");\n+        */\n+#ifdef VX_VERSION_1_1\n+        IVX_CHECK_STATUS(vxCopyImagePatch(ref, &r, planeIdx, &addr, (void*)data, VX_WRITE_ONLY, VX_MEMORY_TYPE_HOST));\n+#else\n+        vx_imagepatch_addressing_t* a = const_cast<vx_imagepatch_addressing_t*>(&addr);\n+        IVX_CHECK_STATUS(vxAccessImagePatch(ref, &r, planeIdx, a, const_cast<void**>(&data), VX_WRITE_ONLY));\n+        IVX_CHECK_STATUS(vxCommitImagePatch(ref, &r, planeIdx, a, data));\n+#endif\n+    }\n+\n+    void copy( vx_uint32 planeIdx, vx_rectangle_t rect,\n+               const vx_imagepatch_addressing_t& addr, void* data,\n+               vx_enum usage, vx_enum memType = VX_MEMORY_TYPE_HOST )\n+    {\n+#ifdef VX_VERSION_1_1\n+        IVX_CHECK_STATUS(vxCopyImagePatch(ref, &rect, planeIdx, &addr, (void*)data, usage, memType));\n+#else\n+        (void)memType;\n+        vx_imagepatch_addressing_t* a = const_cast<vx_imagepatch_addressing_t*>(&addr);\n+        IVX_CHECK_STATUS(vxAccessImagePatch(ref, &rect, planeIdx, a, &data, usage));\n+        IVX_CHECK_STATUS(vxCommitImagePatch(ref, &rect, planeIdx, a, data));\n+#endif\n+    }\n+\n+#ifdef IVX_USE_OPENCV\n+    static int formatToMatType(vx_df_image format, vx_uint32 planeIdx = 0)\n+    {\n+        switch (format)\n+        {\n+        case VX_DF_IMAGE_RGB:  return CV_8UC3;\n+        case VX_DF_IMAGE_RGBX: return CV_8UC4;\n+        case VX_DF_IMAGE_U8:   return CV_8UC1;\n+        case VX_DF_IMAGE_U16:  return CV_16UC1;\n+        case VX_DF_IMAGE_S16:  return CV_16SC1;\n+        case VX_DF_IMAGE_U32:\n+        case VX_DF_IMAGE_S32:  return CV_32SC1;\n+        case VX_DF_IMAGE('F', '0', '3', '2'):\n+                               return CV_32FC1;\n+        case VX_DF_IMAGE_YUV4:\n+        case VX_DF_IMAGE_IYUV: return CV_8UC1;\n+        case VX_DF_IMAGE_UYVY:\n+        case VX_DF_IMAGE_YUYV: return CV_8UC2;\n+        case VX_DF_IMAGE_NV12:\n+        case VX_DF_IMAGE_NV21: return planeIdx == 0 ? CV_8UC1 : CV_8UC2;\n+        default: return CV_USRTYPE1;\n+        }\n+    }\n+\n+    static vx_df_image matTypeToFormat(int matType)\n+    {\n+        switch (matType)\n+        {\n+        case CV_8UC4:  return VX_DF_IMAGE_RGBX;\n+        case CV_8UC3:  return VX_DF_IMAGE_RGB;\n+        case CV_8UC1:  return VX_DF_IMAGE_U8;\n+        case CV_16UC1: return VX_DF_IMAGE_U16;\n+        case CV_16SC1: return VX_DF_IMAGE_S16;\n+        case CV_32SC1: return VX_DF_IMAGE_S32;\n+        case CV_32FC1: return VX_DF_IMAGE('F', '0', '3', '2');\n+        default:       throw WrapperError(std::string(__func__)+\"(): unsupported cv::Mat type\");\n+        }\n+    }\n+\n+    void createMatForPlane(cv::Mat& m, vx_uint32 planeIdx)\n+    {\n+        vx_df_image f = format();\n+        //vx_uint32 w = width(), h = height();\n+        vx_rectangle_t r = getValidRegion();\n+        vx_int32 w = vx_int32(r.end_x - r.start_x), h = vx_int32(r.end_y - r.start_y);\n+        switch (f)\n+        {\n+        case VX_DF_IMAGE_IYUV:\n+            if (planeIdx == 0u) m.create(h, w, formatToMatType(f));\n+            else if (planeIdx == 1u || planeIdx == 2u)  m.create(h/2, w/2, formatToMatType(f));\n+            else throw WrapperError(std::string(__func__)+\"(): wrong plane index\");\n+            break;\n+        case VX_DF_IMAGE_YUV4:\n+            if (planeIdx == 0u || planeIdx == 1u || planeIdx == 2u) m.create(h, w, formatToMatType(f));\n+            else throw WrapperError(std::string(__func__)+\"(): wrong plane index\");\n+            break;\n+        case VX_DF_IMAGE_NV12:\n+        case VX_DF_IMAGE_NV21:\n+            if (planeIdx == 0u) m.create(h, w, formatToMatType(f, 0));\n+            else if (planeIdx == 1u)  m.create(h/2, w/2, formatToMatType(f, 1));\n+            else throw WrapperError(std::string(__func__)+\"(): wrong plane index\");\n+            break;\n+        case VX_DF_IMAGE_RGB:\n+        case VX_DF_IMAGE_RGBX:\n+        case VX_DF_IMAGE_UYVY:\n+        case VX_DF_IMAGE_YUYV:\n+        case VX_DF_IMAGE_U8:\n+        case VX_DF_IMAGE_U16:\n+        case VX_DF_IMAGE_S16:\n+        case VX_DF_IMAGE_U32:\n+        case VX_DF_IMAGE_S32:\n+        case /*VX_DF_IMAGE_F32*/VX_DF_IMAGE('F', '0', '3', '2'):\n+            if(planeIdx == 0u) m.create(h, w, formatToMatType(f));\n+            else throw WrapperError(std::string(__func__)+\"(): wrong plane index\");\n+            break;\n+        default: throw WrapperError(std::string(__func__)+\"(): unsupported color format\");\n+        }\n+    }\n+\n+    void copyTo(vx_uint32 planeIdx, cv::Mat& m)\n+    {\n+        createMatForPlane(m, planeIdx);\n+        copyTo(planeIdx, createAddressing((vx_uint32)m.cols, (vx_uint32)m.rows, (vx_int32)m.elemSize(), (vx_int32)m.step), m.ptr());\n+    }\n+\n+    void copyFrom(vx_uint32 planeIdx, const cv::Mat& m)\n+    {\n+        // TODO: add sizes consistency checks\n+        //vx_rectangle_t r = getValidRegion();\n+        copyFrom(planeIdx, createAddressing((vx_uint32)m.cols, (vx_uint32)m.rows, (vx_int32)m.elemSize(), (vx_int32)m.step), m.ptr());\n+    }\n+#endif //IVX_USE_OPENCV\n+\n+    struct Patch;\n+};\n+\n+struct Image::Patch\n+{\n+public:\n+    const vx_imagepatch_addressing_t& addr() const\n+    { return _addr;}\n+\n+    void* data() const\n+    { return _data; }\n+\n+#ifdef VX_VERSION_1_1\n+    vx_memory_type_e memType() const\n+    { return _memType; }\n+\n+    vx_map_id mapId() const\n+    { return _mapId; }\n+#else\n+    const vx_rectangle_t& rect() const\n+    { return _rect; }\n+\n+    vx_uint32 planeIdx() const\n+    { return _planeIdx; }\n+#endif // VX_VERSION_1_1\n+\n+    vx_image img() const\n+    { return _img; }\n+\n+    bool isMapped() const\n+    { return _img != 0; }\n+\n+    bool isMemoryExternal() const\n+    { return _externalMem; }\n+\n+#ifdef IVX_USE_OPENCV\n+    cv::Mat& getMat()\n+    {\n+        if(_m.empty() && _data)\n+        {\n+            int matType = CV_8UC(_addr.stride_x);\n+            if(_img)\n+            {\n+                vx_df_image format;\n+                IVX_CHECK_STATUS( vxQueryImage(_img, VX_IMAGE_FORMAT, &format, sizeof(format)) );\n+                matType = formatToMatType(format);\n+            }\n+            _m = cv::Mat( vx_int32((vx_int64)_addr.dim_y * VX_SCALE_UNITY / _addr.scale_y),\n+                          vx_int32((vx_int64)_addr.dim_x * VX_SCALE_UNITY / _addr.scale_x),\n+                          matType, _data, std::size_t(_addr.stride_y) );\n+        }\n+        return _m;\n+    }\n+#endif //IVX_USE_OPENCV\n+\n+protected:\n+    vx_imagepatch_addressing_t _addr;\n+    void* _data;\n+    bool _externalMem;\n+    vx_image _img;\n+#ifdef VX_VERSION_1_1\n+    vx_memory_type_e _memType;\n+    vx_map_id _mapId;\n+#else\n+    vx_rectangle_t _rect;\n+    vx_uint32 _planeIdx;\n+#endif\n+#ifdef IVX_USE_OPENCV\n+    cv::Mat _m;\n+#endif\n+\n+    void alloc(vx_size bytes)\n+    {\n+        if (_externalMem || _data) throw WrapperError(std::string(__func__)+\"(): wrong state\");\n+        _data = new char[bytes];\n+#ifdef IVX_USE_OPENCV\n+        _m.release();\n+#endif\n+    }\n+\n+    void free()\n+    {\n+        if (_externalMem) throw WrapperError(std::string(__func__)+\"(): freeing external memory\");\n+        if(_data) delete[] (char*)_data; _data = 0;\n+#ifdef IVX_USE_OPENCV\n+        _m.release();\n+#endif\n+    }\n+\n+public:\n+    Patch() : _addr(createAddressing()), _data(0), _externalMem(false), _img(0)\n+#ifdef VX_VERSION_1_1\n+       , _memType(VX_MEMORY_TYPE_HOST)\n+    {}\n+#else\n+       , _planeIdx(-1)\n+    { _rect.start_x = _rect.end_x = _rect.start_y = _rect.end_y = 0u; }\n+#endif\n+\n+    Patch(const vx_imagepatch_addressing_t& addr, void* data = 0)\n+        : _addr(createAddressing()), _data(0), _externalMem(false), _img(0)\n+#ifdef VX_VERSION_1_1\n+           , _memType(VX_MEMORY_TYPE_HOST)\n+#else\n+           , _planeIdx(-1)\n+#endif\n+    {\n+#ifndef VX_VERSION_1_1\n+        _rect.start_x = _rect.end_x = _rect.start_y = _rect.end_y = 0u;\n+#endif\n+        _addr = addr;\n+        if (data)\n+        {\n+            _externalMem = true;\n+            _data = data;\n+        }\n+    }\n+\n+#ifndef IVX_USE_CXX98\n+    Patch(Patch&& p) : Patch()\n+    {\n+        using std::swap;\n+        swap(_addr, p._addr);\n+        swap(_data, p._data);\n+        swap(_externalMem, p._externalMem);\n+#ifdef VX_VERSION_1_1\n+        swap(_memType, p._memType);\n+        swap(_mapId, p._mapId);\n+#else\n+        swap(_rect, p._rect);\n+        swap(_planeIdx, p._planeIdx);\n+#endif\n+        swap(_img, p._img);\n+        swap(_m, p._m);\n+    }\n+#endif\n+\n+    void copyTo(vx_image img, vx_uint32 planeIdx)\n+    { copyTo(img, planeIdx, Image(img, true).getValidRegion()); }\n+\n+    void copyTo(vx_image img, vx_uint32 planeIdx, const vx_rectangle_t& rect)\n+    {\n+        // TODO: add sizes consistency checks\n+        /*\n+        vx_uint32 w = r.end_x-r.start_x, h = r.end_y-r.start_y;\n+        if (w > _addr.dim_x) throw WrapperError(\"Patch::copyTo(): inconsistent dimension X\");\n+        if (h > _addr.dim_y) throw WrapperError(\"Patch::copyTo(): inconsistent dimension Y\");\n+        */\n+        /*vx_size patchBytes = vxComputeImagePatchSize(img, &r, planeIdx);\n+        if (patchBytes == 0) throw WrapperError(\"Patch::copyTo(): vxComputeImagePatchSize returned 0\");\n+        vx_size strideX = patchBytes / w / h;\n+        if (strideX > _addr.stride_x) throw WrapperError(\"Patch::copyTo(): stride X is too small\");*/\n+#ifdef VX_VERSION_1_1\n+        IVX_CHECK_STATUS(vxCopyImagePatch(img, &rect, planeIdx, &_addr, _data, VX_WRITE_ONLY, _memType));\n+#else\n+        IVX_CHECK_STATUS(vxAccessImagePatch(img, &rect, planeIdx, &_addr, &_data, VX_WRITE_ONLY));\n+        IVX_CHECK_STATUS(vxCommitImagePatch(img, const_cast<vx_rectangle_t*>(&rect), planeIdx, &_addr, _data));\n+        _rect = rect;\n+        _planeIdx = planeIdx;\n+#endif\n+    }\n+\n+    void copyFrom(vx_image img, vx_uint32 planeIdx)\n+    { copyFrom(img, planeIdx, Image(img, true).getValidRegion()); }\n+\n+    void copyFrom(vx_image img, vx_uint32 planeIdx, const vx_rectangle_t& rect)\n+    {\n+        vx_uint32 w = rect.end_x-rect.start_x, h = rect.end_y-rect.start_y;\n+        vx_size patchBytes = vxComputeImagePatchSize(img, &rect, planeIdx);\n+        if (patchBytes == 0) throw WrapperError(std::string(__func__)+\"(): vxComputeImagePatchSize returned 0\");\n+        if (_addr.dim_x == 0)\n+        {\n+            // init\n+            _addr = createAddressing(w, h, (vx_int32)(patchBytes/w/h), (vx_int32)(patchBytes/h));\n+        }\n+        else\n+        {\n+            // check\n+            // TODO: add sizes consistency checks\n+            /*\n+            if (w != _addr.dim_x) throw WrapperError(\"Patch::copyFrom(): inconsistent dimension X\");\n+            if (h != _addr.dim_y) throw WrapperError(\"Patch::copyFrom(): inconsistent dimension Y\");\n+            */\n+            /*vx_size strideX = patchBytes / w / h;\n+            if (strideX > _addr.stride_x) throw WrapperError(\"Patch::copyFrom(): stride X is too small\");*/\n+        }\n+        if (!_data) alloc(_addr.stride_y * _addr.dim_y);\n+#ifdef VX_VERSION_1_1\n+        IVX_CHECK_STATUS(vxCopyImagePatch(img, &rect, planeIdx, &_addr, _data, VX_READ_ONLY, _memType));\n+#else\n+        IVX_CHECK_STATUS(vxAccessImagePatch(img, &rect, planeIdx, &_addr, &_data, VX_READ_ONLY));\n+        IVX_CHECK_STATUS(vxCommitImagePatch(img, const_cast<vx_rectangle_t*>(&rect), planeIdx, &_addr, _data));\n+        _rect = rect;\n+        _planeIdx = planeIdx;\n+#endif\n+    }\n+\n+    void map(vx_image img, vx_uint32 planeIdx)\n+    { map(img, planeIdx, Image(img, true).getValidRegion()); }\n+\n+    void map(vx_image img, vx_uint32 planeIdx, const vx_rectangle_t& rect, vx_enum usage = VX_READ_ONLY, vx_uint32 flags = 0)\n+    {\n+        if (isMapped()) throw WrapperError(std::string(__func__)+\"(): already mapped\");\n+        if(!_externalMem) free();\n+        _data = 0; // could still point to external\n+#ifdef VX_VERSION_1_1\n+        IVX_CHECK_STATUS(vxMapImagePatch(img, &rect, planeIdx, &_mapId, &_addr, &_data, usage, _memType, flags) );\n+#else\n+        IVX_CHECK_STATUS(vxAccessImagePatch(img, &rect, planeIdx, &_addr, &_data, usage));\n+        _rect = rect;\n+        _planeIdx = planeIdx;\n+#endif\n+        _img = img;\n+        _externalMem = true;\n+#ifdef IVX_USE_OPENCV\n+        _m.release();\n+#endif\n+    }\n+\n+    void unmap()\n+    {\n+#ifdef VX_VERSION_1_1\n+        IVX_CHECK_STATUS(vxUnmapImagePatch(_img, _mapId));\n+#else\n+        IVX_CHECK_STATUS(vxCommitImagePatch(_img, &_rect, _planeIdx, &_addr, _data));\n+        _rect.start_x = _rect.end_x = _rect.start_y = _rect.end_y = 0u;\n+        _planeIdx = -1;\n+\n+#endif\n+        _img = 0;\n+        _data = 0;\n+        _externalMem = false;\n+#ifdef IVX_USE_OPENCV\n+        _m.release();\n+#endif\n+    }\n+\n+    ~Patch()\n+    {\n+        try { if (_img) unmap(); } catch(...) {; /*ignore*/}\n+        if(!_externalMem) free();\n+    }\n+\n+    void* pixelPtr(vx_uint32 x, vx_uint32 y)\n+    {\n+        if (!_data) throw WrapperError(std::string(__func__)+\"(): base pointer is NULL\");\n+        if (x >= _addr.dim_x) throw WrapperError(std::string(__func__)+\"(): X out of range\");\n+        if (y >= _addr.dim_y) throw WrapperError(std::string(__func__)+\"(): Y out of range\");\n+        return vxFormatImagePatchAddress2d(_data, x, y, &_addr);\n+    }\n+\n+private:\n+    Patch(const Patch& p); // = delete\n+    Patch& operator=(const Patch&); // = delete\n+#ifndef IVX_USE_CXX98\n+    Patch& operator=(Patch&&); // = delete\n+#endif\n+};\n+\n+/*\n+* Param\n+*/\n+class Param : public RefWrapper<vx_parameter>\n+{\n+public:\n+    IVX_REF_STD_CTORS_AND_ASSIGNMENT(Param);\n+    // NYI\n+};\n+\n+/*\n+* Scalar\n+*/\n+class Scalar : public RefWrapper<vx_scalar>\n+{\n+public:\n+    IVX_REF_STD_CTORS_AND_ASSIGNMENT(Scalar);\n+\n+    static Scalar create(vx_context c, vx_enum dataType, const void *ptr)\n+    { return Scalar( vxCreateScalar(c, dataType, ptr) ); }\n+\n+    template<typename T> static Scalar create(vx_context c, vx_enum dataType, T value)\n+    { return Scalar( vxCreateScalar(c, dataType, &value) ); }\n+\n+    template<vx_enum E> static Scalar create(vx_context c, typename EnumToType<E>::type value)\n+    { return Scalar( vxCreateScalar(c, E, &value) ); }\n+\n+#ifndef VX_VERSION_1_1\n+static const vx_enum VX_SCALAR_TYPE = VX_SCALAR_ATTRIBUTE_TYPE;\n+#endif\n+    vx_enum type()\n+    {\n+        vx_enum val;\n+        IVX_CHECK_STATUS( vxQueryScalar(ref, VX_SCALAR_TYPE, &val, sizeof(val)) );\n+        return val;\n+    }\n+\n+    template<typename T>\n+    void getValue(T& val)\n+    {\n+        vx_enum t = type();\n+        if(sizeof(T) != enumToTypeSize(t)) throw WrapperError(std::string(__func__)+\"(): incompatible types\");\n+#ifdef VX_VERSION_1_1\n+        IVX_CHECK_STATUS( vxCopyScalar(ref, &val, VX_READ_ONLY, VX_MEMORY_TYPE_HOST) );\n+#else\n+        IVX_CHECK_STATUS( vxReadScalarValue(ref, &val) );\n+#endif\n+    }\n+\n+    template<typename T>\n+    T getValue()\n+    {\n+        T val;\n+        getValue(val);\n+        return val;\n+    }\n+\n+\n+    template<typename T>\n+    void setValue(T val)\n+    {\n+        vx_enum t = type();\n+        if (sizeof(T) != enumToTypeSize(t)) throw WrapperError(std::string(__func__)+\"(): incompatible types\");\n+#ifdef VX_VERSION_1_1\n+        IVX_CHECK_STATUS(vxCopyScalar(ref, &val, VX_WRITE_ONLY, VX_MEMORY_TYPE_HOST));\n+#else\n+        IVX_CHECK_STATUS( vxWriteScalarValue(ref, &val) );\n+#endif\n+    }\n+};\n+\n+/*\n+* Threshold\n+*/\n+class Threshold : public RefWrapper<vx_threshold>\n+{\n+public:\n+    IVX_REF_STD_CTORS_AND_ASSIGNMENT(Threshold);\n+\n+    static Threshold create(vx_context c, vx_enum threshType, vx_enum dataType)\n+    { return Threshold(vxCreateThreshold(c, threshType, dataType)); }\n+\n+#ifndef VX_VERSION_1_1\n+static const vx_enum\n+    VX_THRESHOLD_TYPE            = VX_THRESHOLD_ATTRIBUTE_TYPE,\n+    VX_THRESHOLD_THRESHOLD_VALUE = VX_THRESHOLD_ATTRIBUTE_THRESHOLD_VALUE,\n+    VX_THRESHOLD_THRESHOLD_LOWER = VX_THRESHOLD_ATTRIBUTE_THRESHOLD_LOWER,\n+    VX_THRESHOLD_THRESHOLD_UPPER = VX_THRESHOLD_ATTRIBUTE_THRESHOLD_UPPER,\n+    VX_THRESHOLD_TRUE_VALUE      = VX_THRESHOLD_ATTRIBUTE_TRUE_VALUE,\n+    VX_THRESHOLD_FALSE_VALUE     = VX_THRESHOLD_ATTRIBUTE_FALSE_VALUE,\n+    VX_THRESHOLD_DATA_TYPE       = VX_THRESHOLD_ATTRIBUTE_DATA_TYPE;\n+#endif\n+\n+\n+    static Threshold createBinary(vx_context c, vx_enum dataType, vx_int32 val)","path":"3rdparty/openvx/include/ivx.hpp","position":1512,"original_position":1512,"commit_id":"9117ca7b67e563a48f44029b5c4bcac9f64b2966","original_commit_id":"9117ca7b67e563a48f44029b5c4bcac9f64b2966","user":{"login":"apavlenko","id":2344952,"avatar_url":"https://avatars.githubusercontent.com/u/2344952?v=3","gravatar_id":"","url":"https://api.github.com/users/apavlenko","html_url":"https://github.com/apavlenko","followers_url":"https://api.github.com/users/apavlenko/followers","following_url":"https://api.github.com/users/apavlenko/following{/other_user}","gists_url":"https://api.github.com/users/apavlenko/gists{/gist_id}","starred_url":"https://api.github.com/users/apavlenko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apavlenko/subscriptions","organizations_url":"https://api.github.com/users/apavlenko/orgs","repos_url":"https://api.github.com/users/apavlenko/repos","events_url":"https://api.github.com/users/apavlenko/events{/privacy}","received_events_url":"https://api.github.com/users/apavlenko/received_events","type":"User","site_admin":false},"body":"I see no big reasons for that, sorry.","created_at":"2016-10-27T16:03:35Z","updated_at":"2016-10-27T16:03:35Z","html_url":"https://github.com/opencv/opencv/pull/7550#discussion_r85370563","pull_request_url":"https://api.github.com/repos/opencv/opencv/pulls/7550","_links":{"self":{"href":"https://api.github.com/repos/opencv/opencv/pulls/comments/85370563"},"html":{"href":"https://github.com/opencv/opencv/pull/7550#discussion_r85370563"},"pull_request":{"href":"https://api.github.com/repos/opencv/opencv/pulls/7550"}}},"pull_request":{"url":"https://api.github.com/repos/opencv/opencv/pulls/7550","id":90779103,"html_url":"https://github.com/opencv/opencv/pull/7550","diff_url":"https://github.com/opencv/opencv/pull/7550.diff","patch_url":"https://github.com/opencv/opencv/pull/7550.patch","issue_url":"https://api.github.com/repos/opencv/opencv/issues/7550","number":7550,"state":"open","locked":false,"title":"[WIP] C++ wrappers over OpenVX 1.x API","user":{"login":"apavlenko","id":2344952,"avatar_url":"https://avatars.githubusercontent.com/u/2344952?v=3","gravatar_id":"","url":"https://api.github.com/users/apavlenko","html_url":"https://github.com/apavlenko","followers_url":"https://api.github.com/users/apavlenko/followers","following_url":"https://api.github.com/users/apavlenko/following{/other_user}","gists_url":"https://api.github.com/users/apavlenko/gists{/gist_id}","starred_url":"https://api.github.com/users/apavlenko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apavlenko/subscriptions","organizations_url":"https://api.github.com/users/apavlenko/orgs","repos_url":"https://api.github.com/users/apavlenko/repos","events_url":"https://api.github.com/users/apavlenko/events{/privacy}","received_events_url":"https://api.github.com/users/apavlenko/received_events","type":"User","site_admin":false},"body":"### C++ wrappers for OpenVX C API\r\n\r\n#### Requirements:\r\n\r\n* lightweight - minimal overhead vs standard C API\r\n* automatic references releasing\r\n* exceptions instead of return codes\r\n* object-oriented design\r\n* helpers for user-defined kernels & nodes (NYI)\r\n\r\nOpenVX v. 1.0.1 and 1.1 are tested on Win64 (MSVC 2015) and Lin64 (gcc 5.4) with and without C++11 suport.\r\n\r\nUsage sample\r\n```cpp\r\n        ivx::Context context = ivx::Context::create();\r\n        ivx::Graph graph = ivx::Graph::create(context);\r\n        ivx::Image\r\n            gray = ivx::Image::create(context, width, height, VX_DF_IMAGE_U8),\r\n            gb   = ivx::Image::createVirtual(graph),\r\n            res  = ivx::Image::create(context, width, height, VX_DF_IMAGE_U8);\r\n\r\n        context.loadKernels(\"openvx-debug\");  // vxuFReadImage\r\n        context.loadKernels(\"openvx-extras\"); // vxNonMaxSuppressionNode\r\n\r\n        ivx::debug::fReadImage(context, inputPath, gray);\r\n\r\n        ivx::Node::create(graph, VX_KERNEL_GAUSSIAN_3x3, gray, gb);\r\n\r\n        ivx::Node::create(\r\n            graph,\r\n            VX_KERNEL_THRESHOLD,\r\n            gb,\r\n            ivx::Threshold::createBinary(context, VX_TYPE_UINT8, 50),\r\n            res\r\n        );\r\n\r\n        graph.verify();\r\n        graph.process();\r\n\r\n        {\r\n            // copy\r\n            {\r\n#ifndef IVX_USE_OPENCV\r\n                bool usePatchForCopying = true;\r\n                if(usePatchForCopying)\r\n                {\r\n                    ivx::Image::Patch p;\r\n                    p.copyFrom(res, 0);\r\n                    for(int i=0; i<16; i++)\r\n                        memset(p.pixelPtr(0, i), 0xff, i);\r\n                    p.copyTo(res, 0);\r\n                }\r\n                else\r\n                {\r\n                    vx_imagepatch_addressing_t addr = res.createAddressing(0);\r\n                    std::unique_ptr<char[]> mem(new char[addr.stride_y * addr.dim_y]);\r\n                    res.copyTo(0, addr, mem.get());\r\n                    for(int i=0; i<16; i++)\r\n                        memset(vxFormatImagePatchAddress2d(mem.get(), 0, i, &addr ), 0xff, i);\r\n                    res.copyFrom(0, addr, mem.get());\r\n                }\r\n#else\r\n                cv::Mat m;\r\n                res.copyTo(0, m);\r\n                if (m.empty()) throw std::runtime_error(\"empty Mat\");\r\n                for (int r = 0; r<16; r++)\r\n                    for (int c=0; c<r; c++)\r\n                        *m.ptr(r, c) = 0xff;\r\n                res.copyFrom(0, m);\r\n#endif //IVX_USE_VX_OPENCV\r\n            }\r\n\r\n            // map\r\n            {\r\n                ivx::Image::Patch p;\r\n                p.map(res, 0, res.getValidRegion(), VX_READ_AND_WRITE);\r\n#ifndef IVX_USE_OPENCV\r\n                for (int i=0; i<16; i++)\r\n                    memset(p.pixelPtr(0, i+20), 0xff, 16-i);\r\n#else\r\n                if(p.getMat().empty()) throw std::runtime_error(\"empty Mat\");\r\n                for (int r = 0; r < 16; r++)\r\n                    for (int c = 0; c < 16 - r; c++)\r\n                        *p.getMat().ptr(r + 20, c) = 0xff;\r\n#endif //IVX_USE_VX_OPENCV\r\n                //p.unmap(); - called in d-tor\r\n            }\r\n\r\n            ivx::debug::fWriteImage(context, res, \"ovx-res-cpp.pgm\");\r\n```\r\n","created_at":"2016-10-25T10:22:54Z","updated_at":"2016-10-27T16:03:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"dc5646a80ba11d503244be5ca27e8ee7305aa7c2","assignee":{"login":"alalek","id":4981219,"avatar_url":"https://avatars.githubusercontent.com/u/4981219?v=3","gravatar_id":"","url":"https://api.github.com/users/alalek","html_url":"https://github.com/alalek","followers_url":"https://api.github.com/users/alalek/followers","following_url":"https://api.github.com/users/alalek/following{/other_user}","gists_url":"https://api.github.com/users/alalek/gists{/gist_id}","starred_url":"https://api.github.com/users/alalek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alalek/subscriptions","organizations_url":"https://api.github.com/users/alalek/orgs","repos_url":"https://api.github.com/users/alalek/repos","events_url":"https://api.github.com/users/alalek/events{/privacy}","received_events_url":"https://api.github.com/users/alalek/received_events","type":"User","site_admin":false},"assignees":[{"login":"alalek","id":4981219,"avatar_url":"https://avatars.githubusercontent.com/u/4981219?v=3","gravatar_id":"","url":"https://api.github.com/users/alalek","html_url":"https://github.com/alalek","followers_url":"https://api.github.com/users/alalek/followers","following_url":"https://api.github.com/users/alalek/following{/other_user}","gists_url":"https://api.github.com/users/alalek/gists{/gist_id}","starred_url":"https://api.github.com/users/alalek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alalek/subscriptions","organizations_url":"https://api.github.com/users/alalek/orgs","repos_url":"https://api.github.com/users/alalek/repos","events_url":"https://api.github.com/users/alalek/events{/privacy}","received_events_url":"https://api.github.com/users/alalek/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/opencv/opencv/pulls/7550/commits","review_comments_url":"https://api.github.com/repos/opencv/opencv/pulls/7550/comments","review_comment_url":"https://api.github.com/repos/opencv/opencv/pulls/comments{/number}","comments_url":"https://api.github.com/repos/opencv/opencv/issues/7550/comments","statuses_url":"https://api.github.com/repos/opencv/opencv/statuses/9117ca7b67e563a48f44029b5c4bcac9f64b2966","head":{"label":"apavlenko:ivx","ref":"ivx","sha":"9117ca7b67e563a48f44029b5c4bcac9f64b2966","user":{"login":"apavlenko","id":2344952,"avatar_url":"https://avatars.githubusercontent.com/u/2344952?v=3","gravatar_id":"","url":"https://api.github.com/users/apavlenko","html_url":"https://github.com/apavlenko","followers_url":"https://api.github.com/users/apavlenko/followers","following_url":"https://api.github.com/users/apavlenko/following{/other_user}","gists_url":"https://api.github.com/users/apavlenko/gists{/gist_id}","starred_url":"https://api.github.com/users/apavlenko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apavlenko/subscriptions","organizations_url":"https://api.github.com/users/apavlenko/orgs","repos_url":"https://api.github.com/users/apavlenko/repos","events_url":"https://api.github.com/users/apavlenko/events{/privacy}","received_events_url":"https://api.github.com/users/apavlenko/received_events","type":"User","site_admin":false},"repo":{"id":5809234,"name":"opencv","full_name":"apavlenko/opencv","owner":{"login":"apavlenko","id":2344952,"avatar_url":"https://avatars.githubusercontent.com/u/2344952?v=3","gravatar_id":"","url":"https://api.github.com/users/apavlenko","html_url":"https://github.com/apavlenko","followers_url":"https://api.github.com/users/apavlenko/followers","following_url":"https://api.github.com/users/apavlenko/following{/other_user}","gists_url":"https://api.github.com/users/apavlenko/gists{/gist_id}","starred_url":"https://api.github.com/users/apavlenko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apavlenko/subscriptions","organizations_url":"https://api.github.com/users/apavlenko/orgs","repos_url":"https://api.github.com/users/apavlenko/repos","events_url":"https://api.github.com/users/apavlenko/events{/privacy}","received_events_url":"https://api.github.com/users/apavlenko/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/apavlenko/opencv","description":"OpenCV GitHub Mirror","fork":true,"url":"https://api.github.com/repos/apavlenko/opencv","forks_url":"https://api.github.com/repos/apavlenko/opencv/forks","keys_url":"https://api.github.com/repos/apavlenko/opencv/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apavlenko/opencv/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apavlenko/opencv/teams","hooks_url":"https://api.github.com/repos/apavlenko/opencv/hooks","issue_events_url":"https://api.github.com/repos/apavlenko/opencv/issues/events{/number}","events_url":"https://api.github.com/repos/apavlenko/opencv/events","assignees_url":"https://api.github.com/repos/apavlenko/opencv/assignees{/user}","branches_url":"https://api.github.com/repos/apavlenko/opencv/branches{/branch}","tags_url":"https://api.github.com/repos/apavlenko/opencv/tags","blobs_url":"https://api.github.com/repos/apavlenko/opencv/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apavlenko/opencv/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apavlenko/opencv/git/refs{/sha}","trees_url":"https://api.github.com/repos/apavlenko/opencv/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apavlenko/opencv/statuses/{sha}","languages_url":"https://api.github.com/repos/apavlenko/opencv/languages","stargazers_url":"https://api.github.com/repos/apavlenko/opencv/stargazers","contributors_url":"https://api.github.com/repos/apavlenko/opencv/contributors","subscribers_url":"https://api.github.com/repos/apavlenko/opencv/subscribers","subscription_url":"https://api.github.com/repos/apavlenko/opencv/subscription","commits_url":"https://api.github.com/repos/apavlenko/opencv/commits{/sha}","git_commits_url":"https://api.github.com/repos/apavlenko/opencv/git/commits{/sha}","comments_url":"https://api.github.com/repos/apavlenko/opencv/comments{/number}","issue_comment_url":"https://api.github.com/repos/apavlenko/opencv/issues/comments{/number}","contents_url":"https://api.github.com/repos/apavlenko/opencv/contents/{+path}","compare_url":"https://api.github.com/repos/apavlenko/opencv/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apavlenko/opencv/merges","archive_url":"https://api.github.com/repos/apavlenko/opencv/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apavlenko/opencv/downloads","issues_url":"https://api.github.com/repos/apavlenko/opencv/issues{/number}","pulls_url":"https://api.github.com/repos/apavlenko/opencv/pulls{/number}","milestones_url":"https://api.github.com/repos/apavlenko/opencv/milestones{/number}","notifications_url":"https://api.github.com/repos/apavlenko/opencv/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apavlenko/opencv/labels{/name}","releases_url":"https://api.github.com/repos/apavlenko/opencv/releases{/id}","deployments_url":"https://api.github.com/repos/apavlenko/opencv/deployments","created_at":"2012-09-14T12:52:19Z","updated_at":"2016-08-30T00:34:53Z","pushed_at":"2016-10-27T15:15:28Z","git_url":"git://github.com/apavlenko/opencv.git","ssh_url":"git@github.com:apavlenko/opencv.git","clone_url":"https://github.com/apavlenko/opencv.git","svn_url":"https://github.com/apavlenko/opencv","homepage":"code.opencv.org","size":428742,"stargazers_count":2,"watchers_count":2,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":2,"default_branch":"copyright_fixes"}},"base":{"label":"opencv:master","ref":"master","sha":"2038434c7ed20ee52f5f76bbf6e1621cb6167bfe","user":{"login":"opencv","id":5009934,"avatar_url":"https://avatars.githubusercontent.com/u/5009934?v=3","gravatar_id":"","url":"https://api.github.com/users/opencv","html_url":"https://github.com/opencv","followers_url":"https://api.github.com/users/opencv/followers","following_url":"https://api.github.com/users/opencv/following{/other_user}","gists_url":"https://api.github.com/users/opencv/gists{/gist_id}","starred_url":"https://api.github.com/users/opencv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/opencv/subscriptions","organizations_url":"https://api.github.com/users/opencv/orgs","repos_url":"https://api.github.com/users/opencv/repos","events_url":"https://api.github.com/users/opencv/events{/privacy}","received_events_url":"https://api.github.com/users/opencv/received_events","type":"Organization","site_admin":false},"repo":{"id":5108051,"name":"opencv","full_name":"opencv/opencv","owner":{"login":"opencv","id":5009934,"avatar_url":"https://avatars.githubusercontent.com/u/5009934?v=3","gravatar_id":"","url":"https://api.github.com/users/opencv","html_url":"https://github.com/opencv","followers_url":"https://api.github.com/users/opencv/followers","following_url":"https://api.github.com/users/opencv/following{/other_user}","gists_url":"https://api.github.com/users/opencv/gists{/gist_id}","starred_url":"https://api.github.com/users/opencv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/opencv/subscriptions","organizations_url":"https://api.github.com/users/opencv/orgs","repos_url":"https://api.github.com/users/opencv/repos","events_url":"https://api.github.com/users/opencv/events{/privacy}","received_events_url":"https://api.github.com/users/opencv/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/opencv/opencv","description":"Open Source Computer Vision Library","fork":false,"url":"https://api.github.com/repos/opencv/opencv","forks_url":"https://api.github.com/repos/opencv/opencv/forks","keys_url":"https://api.github.com/repos/opencv/opencv/keys{/key_id}","collaborators_url":"https://api.github.com/repos/opencv/opencv/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/opencv/opencv/teams","hooks_url":"https://api.github.com/repos/opencv/opencv/hooks","issue_events_url":"https://api.github.com/repos/opencv/opencv/issues/events{/number}","events_url":"https://api.github.com/repos/opencv/opencv/events","assignees_url":"https://api.github.com/repos/opencv/opencv/assignees{/user}","branches_url":"https://api.github.com/repos/opencv/opencv/branches{/branch}","tags_url":"https://api.github.com/repos/opencv/opencv/tags","blobs_url":"https://api.github.com/repos/opencv/opencv/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/opencv/opencv/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/opencv/opencv/git/refs{/sha}","trees_url":"https://api.github.com/repos/opencv/opencv/git/trees{/sha}","statuses_url":"https://api.github.com/repos/opencv/opencv/statuses/{sha}","languages_url":"https://api.github.com/repos/opencv/opencv/languages","stargazers_url":"https://api.github.com/repos/opencv/opencv/stargazers","contributors_url":"https://api.github.com/repos/opencv/opencv/contributors","subscribers_url":"https://api.github.com/repos/opencv/opencv/subscribers","subscription_url":"https://api.github.com/repos/opencv/opencv/subscription","commits_url":"https://api.github.com/repos/opencv/opencv/commits{/sha}","git_commits_url":"https://api.github.com/repos/opencv/opencv/git/commits{/sha}","comments_url":"https://api.github.com/repos/opencv/opencv/comments{/number}","issue_comment_url":"https://api.github.com/repos/opencv/opencv/issues/comments{/number}","contents_url":"https://api.github.com/repos/opencv/opencv/contents/{+path}","compare_url":"https://api.github.com/repos/opencv/opencv/compare/{base}...{head}","merges_url":"https://api.github.com/repos/opencv/opencv/merges","archive_url":"https://api.github.com/repos/opencv/opencv/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/opencv/opencv/downloads","issues_url":"https://api.github.com/repos/opencv/opencv/issues{/number}","pulls_url":"https://api.github.com/repos/opencv/opencv/pulls{/number}","milestones_url":"https://api.github.com/repos/opencv/opencv/milestones{/number}","notifications_url":"https://api.github.com/repos/opencv/opencv/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/opencv/opencv/labels{/name}","releases_url":"https://api.github.com/repos/opencv/opencv/releases{/id}","deployments_url":"https://api.github.com/repos/opencv/opencv/deployments","created_at":"2012-07-19T09:40:17Z","updated_at":"2016-10-27T12:28:40Z","pushed_at":"2016-10-27T16:00:46Z","git_url":"git://github.com/opencv/opencv.git","ssh_url":"git@github.com:opencv/opencv.git","clone_url":"https://github.com/opencv/opencv.git","svn_url":"https://github.com/opencv/opencv","homepage":"opencv.org","size":1087163,"stargazers_count":11758,"watchers_count":11758,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":9555,"mirror_url":null,"open_issues_count":1012,"forks":9555,"open_issues":1012,"watchers":11758,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/opencv/opencv/pulls/7550"},"html":{"href":"https://github.com/opencv/opencv/pull/7550"},"issue":{"href":"https://api.github.com/repos/opencv/opencv/issues/7550"},"comments":{"href":"https://api.github.com/repos/opencv/opencv/issues/7550/comments"},"review_comments":{"href":"https://api.github.com/repos/opencv/opencv/pulls/7550/comments"},"review_comment":{"href":"https://api.github.com/repos/opencv/opencv/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/opencv/opencv/pulls/7550/commits"},"statuses":{"href":"https://api.github.com/repos/opencv/opencv/statuses/9117ca7b67e563a48f44029b5c4bcac9f64b2966"}}}}
{"actor":{"display_login":"apavlenko"}}