Skip to content

Commit a8c7a10

Browse files
committed
Merge pull request opencv#7817 from savuor:openvx_pyrWrap
2 parents 7d5fd6a + 45d3286 commit a8c7a10

File tree

1 file changed

+77
-0
lines changed

1 file changed

+77
-0
lines changed

3rdparty/openvx/include/ivx.hpp

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,15 @@ template <> struct RefTypeTraits <vx_lut>
343343
static vx_status release(vxType& ref) { return vxReleaseLUT(&ref); }
344344
};
345345

346+
class Pyramid;
347+
template <> struct RefTypeTraits <vx_pyramid>
348+
{
349+
typedef vx_pyramid vxType;
350+
typedef Pyramid wrapperType;
351+
static const vx_enum vxTypeEnum = VX_TYPE_PYRAMID;
352+
static vx_status release(vxType& ref) { return vxReleasePyramid(&ref); }
353+
};
354+
346355
class Distribution;
347356
template <> struct RefTypeTraits <vx_distribution>
348357
{
@@ -2755,6 +2764,74 @@ class LUT : public RefWrapper<vx_lut>
27552764
#endif //IVX_USE_OPENCV
27562765
};
27572766

2767+
/*
2768+
* Pyramid
2769+
*/
2770+
class Pyramid : public RefWrapper<vx_pyramid>
2771+
{
2772+
public:
2773+
IVX_REF_STD_CTORS_AND_ASSIGNMENT(Pyramid)
2774+
2775+
static Pyramid create(vx_context context, vx_size levels, vx_float32 scale,
2776+
vx_uint32 width, vx_uint32 height, vx_df_image format)
2777+
{return Pyramid(vxCreatePyramid(context, levels, scale, width, height, format));}
2778+
2779+
static Pyramid createVirtual(vx_graph graph, vx_size levels, vx_float32 scale,
2780+
vx_uint32 width, vx_uint32 height, vx_df_image format)
2781+
{return Pyramid(vxCreateVirtualPyramid(graph, levels, scale, width, height, format));}
2782+
2783+
#ifndef VX_VERSION_1_1
2784+
static const vx_enum
2785+
VX_PYRAMID_LEVELS = VX_PYRAMID_ATTRIBUTE_LEVELS,
2786+
VX_PYRAMID_SCALE = VX_PYRAMID_ATTRIBUTE_SCALE,
2787+
VX_PYRAMID_WIDTH = VX_PYRAMID_ATTRIBUTE_WIDTH,
2788+
VX_PYRAMID_HEIGHT = VX_PYRAMID_ATTRIBUTE_HEIGHT,
2789+
VX_PYRAMID_FORMAT = VX_PYRAMID_ATTRIBUTE_FORMAT;
2790+
#endif
2791+
2792+
template<typename T>
2793+
void query(vx_enum att, T& value) const
2794+
{ IVX_CHECK_STATUS( vxQueryPyramid(ref, att, &value, sizeof(value)) ); }
2795+
2796+
vx_size levels() const
2797+
{
2798+
vx_size l;
2799+
query(VX_PYRAMID_LEVELS, l);
2800+
return l;
2801+
}
2802+
2803+
vx_float32 scale() const
2804+
{
2805+
vx_float32 s;
2806+
query(VX_PYRAMID_SCALE, s);
2807+
return s;
2808+
}
2809+
2810+
vx_uint32 width() const
2811+
{
2812+
vx_uint32 v;
2813+
query(VX_PYRAMID_WIDTH, v);
2814+
return v;
2815+
}
2816+
2817+
vx_uint32 height() const
2818+
{
2819+
vx_uint32 v;
2820+
query(VX_PYRAMID_HEIGHT, v);
2821+
return v;
2822+
}
2823+
2824+
vx_df_image format() const
2825+
{
2826+
vx_df_image f;
2827+
query(VX_PYRAMID_FORMAT, f);
2828+
return f;
2829+
}
2830+
2831+
Image getLevel(vx_uint32 index)
2832+
{ return Image(vxGetPyramidLevel(ref, index)); }
2833+
};
2834+
27582835
/*
27592836
* Distribution
27602837
*/

0 commit comments

Comments
 (0)