1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 15:23:05 +04:00

Rewrite the UMat Python wrapper

This commit is contained in:
Hamdi Sahloul
2018-08-25 07:19:14 +09:00
parent 2bbe31a8f6
commit 669ee0415a
4 changed files with 97 additions and 281 deletions
@@ -0,0 +1,37 @@
#ifdef HAVE_OPENCV_CORE
#include "opencv2/core/mat.hpp"
typedef std::vector<Range> vector_Range;
CV_PY_TO_CLASS(UMat);
CV_PY_FROM_CLASS(UMat);
CV_PY_TO_ENUM(UMatUsageFlags);
static bool cv_mappable_to(const Ptr<Mat>& src, Ptr<UMat>& dst)
{
//dst.reset(new UMat(src->getUMat(ACCESS_RW)));
dst.reset(new UMat());
src->copyTo(*dst);
return true;
}
static void* cv_UMat_queue()
{
return cv::ocl::Queue::getDefault().ptr();
}
static void* cv_UMat_context()
{
return cv::ocl::Context::getDefault().ptr();
}
static Mat cv_UMat_get(const UMat* _self)
{
Mat m;
m.allocator = &g_numpyAllocator;
_self->copyTo(m);
return m;
}
#endif