summaryrefslogtreecommitdiff
path: root/dev-ros/cv_bridge
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2020-08-25 10:45:55 +0100
committerV3n3RiX <venerix@redcorelinux.org>2020-08-25 10:45:55 +0100
commit3cf7c3ef441822c889356fd1812ebf2944a59851 (patch)
treec513fe68548b40365c1c2ebfe35c58ad431cdd77 /dev-ros/cv_bridge
parent05b8b0e0af1d72e51a3ee61522941bf7605cd01c (diff)
gentoo resync : 25.08.2020
Diffstat (limited to 'dev-ros/cv_bridge')
-rw-r--r--dev-ros/cv_bridge/Manifest9
-rw-r--r--dev-ros/cv_bridge/cv_bridge-1.13.0.ebuild24
-rw-r--r--dev-ros/cv_bridge/cv_bridge-1.15.0.ebuild30
-rw-r--r--dev-ros/cv_bridge/cv_bridge-9999.ebuild20
-rw-r--r--dev-ros/cv_bridge/files/boostpython.patch11
-rw-r--r--dev-ros/cv_bridge/files/ocv4.patch432
6 files changed, 54 insertions, 472 deletions
diff --git a/dev-ros/cv_bridge/Manifest b/dev-ros/cv_bridge/Manifest
index 36cc0262223f..0dc4f121dfa8 100644
--- a/dev-ros/cv_bridge/Manifest
+++ b/dev-ros/cv_bridge/Manifest
@@ -1,6 +1,5 @@
-AUX boostpython.patch 551 BLAKE2B f3cecec73fbc584f324da2c1438ca42e283031fdf6df3f8ac458da9f09c3344716e9ca901de9f35edceaf6cc0223f66a1cef2e77ee3106f7b39b8ab96b204ade SHA512 9b306662ccef96aa9eee0b5c244de4919a9f8614502e1d75e63e787b4a0408ca6363c67b4b6eb897ffd8ca90df856444c357acee5f23074e33f7afd985686f7f
-AUX ocv4.patch 12322 BLAKE2B a27a3c0b9303969c2984f283657b6dc9b0d1840183bf9fe875280db7ed9862d16fe44dc3e917d6620431a351cdcadb13000a152b1b49528d90733813ba859d05 SHA512 167a4a3f16e3560c23a354ad2e041e60b5318ee56e9af4d35e9255faa9449cd4d2af3dde9648d8f49fdf64c5d28a66959efd90fbecb5af5a262c3ec090bd7e7f
-DIST vision_opencv-1.13.0.tar.gz 82177 BLAKE2B 1c863f3c9e6b856d61a0e879f958f0f1fd184f088e208023a504cf5bb982c5496b71e1f2b4761e4456ca76348e51bc2bc760b2c43e1a35b02fa5c23c8e444502 SHA512 a20ec2f41a0c94dde51b19f902ae078cbf5449a2aadbeacbc49bbfc2ab52c39878e63448a3137591f7e1b2f6025baef616579463cf32274e7838157137d214bc
-EBUILD cv_bridge-1.13.0.ebuild 658 BLAKE2B eda35a1df52c2c743ef76904a92e74ed1fd711785c846f035657270f14ee21dcccff95a428c49c8c430fe9092cfcb820bd74833d5df126b141d487cbee26a6a2 SHA512 9f9dfd0e6af3a4d0ec5ce10ae41f1e4f14e7fde90fe597505e9120dd8f975deec20f5bae0d053e03dd999d46972f9f7ed19517b8c236c1ebada4d922d8201f25
-EBUILD cv_bridge-9999.ebuild 633 BLAKE2B 43e33f439c1fa4af188c7cadbfc36c16ebb4bf1594cd1b797fdb09dc1cc660b4773d1488ff189666dcd8d6a3cba4024f20b0a7b4ad82c4fa47c33c987b15196a SHA512 757803d5fa063ad1856bb9d758522b2a8908999187742f6a8fb3398204ab4c824d0da8e70b085c0e687e23ed49740ec2073e962c60f49e650ceacee2e44e1a25
+AUX boostpython.patch 599 BLAKE2B 5076c2efdfd06afa9dbc9e3ad344774c1fca54ef172a4808e4ba7b40f4770250d49b1e478abcee1ac973c3a1012579694499a1dd48fd84c19f996441920c329c SHA512 21c5a6589a1ee19d5f586b535807c35f5eef77da6dae614deb7542d8cb1cf850902b5d7de197d6060016f43dcbef8d6d69d104abc5f5fa0af6131a415a43ba64
+DIST vision_opencv-1.15.0.tar.gz 82281 BLAKE2B 6e86cf67bb9fbf07ca36dbe0bb3fb32611a4e216cea209048bfe34b71622a56954063f2e7ff466275810f36c62d016a1d04e987383dde35f0bb85abf0e74350f SHA512 b6331b00aac18f96eb40ef57b2b4fe55da956007390549762818eab7ad36fcf192549448f2edcc6b4e550273f80320bf15eb6a60900d155be680ec8682fd17ba
+EBUILD cv_bridge-1.15.0.ebuild 801 BLAKE2B 92b9e314c3c22a21a6496ecb8c1e8c047dbf14993c30a453cd6f934a99602ea6c9bb8c5c1d9c1b86c28f51bfd6d8a137a24349343ec8ace88debadd6364bfbf8 SHA512 0871710d79cbd4fcce528d783fb6c52c2cf4d9a678ac69fa05ff1790788140c007355b5b38341c806999b6c3656f56e81d74822c4a4183bc36692dcdf00b6993
+EBUILD cv_bridge-9999.ebuild 801 BLAKE2B 92b9e314c3c22a21a6496ecb8c1e8c047dbf14993c30a453cd6f934a99602ea6c9bb8c5c1d9c1b86c28f51bfd6d8a137a24349343ec8ace88debadd6364bfbf8 SHA512 0871710d79cbd4fcce528d783fb6c52c2cf4d9a678ac69fa05ff1790788140c007355b5b38341c806999b6c3656f56e81d74822c4a4183bc36692dcdf00b6993
MISC metadata.xml 342 BLAKE2B 41ebd1d903bb2c2be8df58a29062ae314becf1e29b309369eb8295f49760e35800d2164de2d9088b90716432d04b5290123f1a1110175250348301e12afe3f26 SHA512 ebd8a1fd0c584bd4dbbcbdd6e396c288a50d68916d357f030dfaf13ec8204c0bf8a4c98f740952400e43ce5d6f112a0865086484de1a8abdd088d39e79f74693
diff --git a/dev-ros/cv_bridge/cv_bridge-1.13.0.ebuild b/dev-ros/cv_bridge/cv_bridge-1.13.0.ebuild
deleted file mode 100644
index a592d05deeb9..000000000000
--- a/dev-ros/cv_bridge/cv_bridge-1.13.0.ebuild
+++ /dev/null
@@ -1,24 +0,0 @@
-# Copyright 1999-2019 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=5
-ROS_REPO_URI="https://github.com/ros-perception/vision_opencv"
-KEYWORDS="~amd64 ~arm"
-PYTHON_COMPAT=( python2_7 )
-ROS_SUBDIR=${PN}
-
-inherit ros-catkin
-
-DESCRIPTION="Converts between ROS Image messages and OpenCV images"
-LICENSE="BSD"
-SLOT="0"
-IUSE=""
-
-RDEPEND="
- dev-ros/rosconsole
- >=media-libs/opencv-3:=[contrib(+)]
- dev-libs/boost:=[threads,python,${PYTHON_USEDEP}]
- dev-ros/sensor_msgs[${CATKIN_MESSAGES_CXX_USEDEP},${CATKIN_MESSAGES_PYTHON_USEDEP}]
-"
-DEPEND="${RDEPEND}"
-PATCHES=( "${FILESDIR}/boostpython.patch" "${FILESDIR}/ocv4.patch" )
diff --git a/dev-ros/cv_bridge/cv_bridge-1.15.0.ebuild b/dev-ros/cv_bridge/cv_bridge-1.15.0.ebuild
new file mode 100644
index 000000000000..582de3e58f72
--- /dev/null
+++ b/dev-ros/cv_bridge/cv_bridge-1.15.0.ebuild
@@ -0,0 +1,30 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+ROS_REPO_URI="https://github.com/ros-perception/vision_opencv"
+KEYWORDS="~amd64 ~arm"
+ROS_SUBDIR=${PN}
+
+inherit ros-catkin
+
+DESCRIPTION="Converts between ROS Image messages and OpenCV images"
+LICENSE="BSD"
+SLOT="0"
+IUSE=""
+
+RDEPEND="
+ dev-ros/rosconsole
+ >=media-libs/opencv-3:=[contrib(+),png,jpeg,tiff]
+ $(python_gen_cond_dep "dev-libs/boost:=[threads,python,\${PYTHON_USEDEP}]")
+ dev-ros/sensor_msgs[${CATKIN_MESSAGES_PYTHON_USEDEP}]
+"
+DEPEND="${RDEPEND}
+ dev-ros/sensor_msgs[${CATKIN_MESSAGES_CXX_USEDEP}]
+ test? (
+ dev-cpp/gtest
+ $(python_gen_cond_dep "dev-python/nose[\${PYTHON_USEDEP}]")
+ dev-ros/rostest[${PYTHON_SINGLE_USEDEP}]
+ )
+"
+PATCHES=( "${FILESDIR}/boostpython.patch" )
diff --git a/dev-ros/cv_bridge/cv_bridge-9999.ebuild b/dev-ros/cv_bridge/cv_bridge-9999.ebuild
index 422225d82b4f..582de3e58f72 100644
--- a/dev-ros/cv_bridge/cv_bridge-9999.ebuild
+++ b/dev-ros/cv_bridge/cv_bridge-9999.ebuild
@@ -1,10 +1,9 @@
-# Copyright 1999-2019 Gentoo Authors
+# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
-EAPI=5
+EAPI=7
ROS_REPO_URI="https://github.com/ros-perception/vision_opencv"
KEYWORDS="~amd64 ~arm"
-PYTHON_COMPAT=( python2_7 )
ROS_SUBDIR=${PN}
inherit ros-catkin
@@ -16,9 +15,16 @@ IUSE=""
RDEPEND="
dev-ros/rosconsole
- >=media-libs/opencv-3:=[contrib(+)]
- dev-libs/boost:=[threads,python,${PYTHON_USEDEP}]
- dev-ros/sensor_msgs[${CATKIN_MESSAGES_CXX_USEDEP},${CATKIN_MESSAGES_PYTHON_USEDEP}]
+ >=media-libs/opencv-3:=[contrib(+),png,jpeg,tiff]
+ $(python_gen_cond_dep "dev-libs/boost:=[threads,python,\${PYTHON_USEDEP}]")
+ dev-ros/sensor_msgs[${CATKIN_MESSAGES_PYTHON_USEDEP}]
+"
+DEPEND="${RDEPEND}
+ dev-ros/sensor_msgs[${CATKIN_MESSAGES_CXX_USEDEP}]
+ test? (
+ dev-cpp/gtest
+ $(python_gen_cond_dep "dev-python/nose[\${PYTHON_USEDEP}]")
+ dev-ros/rostest[${PYTHON_SINGLE_USEDEP}]
+ )
"
-DEPEND="${RDEPEND}"
PATCHES=( "${FILESDIR}/boostpython.patch" )
diff --git a/dev-ros/cv_bridge/files/boostpython.patch b/dev-ros/cv_bridge/files/boostpython.patch
index 72fac8087363..a6192f98be24 100644
--- a/dev-ros/cv_bridge/files/boostpython.patch
+++ b/dev-ros/cv_bridge/files/boostpython.patch
@@ -2,14 +2,17 @@ Index: cv_bridge/CMakeLists.txt
===================================================================
--- cv_bridge.orig/CMakeLists.txt
+++ cv_bridge/CMakeLists.txt
-@@ -5,11 +5,7 @@ find_package(catkin REQUIRED COMPONENTS
+@@ -5,14 +5,7 @@ find_package(catkin REQUIRED COMPONENTS
if(NOT ANDROID)
find_package(PythonLibs)
-- if(PYTHONLIBS_VERSION_STRING VERSION_LESS 3)
-- find_package(Boost REQUIRED python)
+-
+- if(PYTHONLIBS_VERSION_STRING VERSION_LESS "3.8")
+- # Debian Buster
+- find_package(Boost REQUIRED python37)
- else()
-- find_package(Boost REQUIRED python3)
+- # Ubuntu Focal
+- find_package(Boost REQUIRED python)
- endif()
+ find_package(Boost REQUIRED python${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR})
else()
diff --git a/dev-ros/cv_bridge/files/ocv4.patch b/dev-ros/cv_bridge/files/ocv4.patch
deleted file mode 100644
index 8a58408c9e8e..000000000000
--- a/dev-ros/cv_bridge/files/ocv4.patch
+++ /dev/null
@@ -1,432 +0,0 @@
-From b0281a5c844ea0b0d9e0104674474adf50810f49 Mon Sep 17 00:00:00 2001
-From: BrutusTT <brutusthetschiepel@gmail.com>
-Date: Wed, 4 Sep 2019 11:39:30 +0100
-Subject: [PATCH 1/2] add OpenCV4 support addresses
- ros-perception/vision_opencv#272
-
----
- cv_bridge/CMakeLists.txt | 2 +-
- cv_bridge/src/CMakeLists.txt | 8 +++++---
- 2 files changed, 6 insertions(+), 4 deletions(-)
-
-diff --git a/cv_bridge/CMakeLists.txt b/cv_bridge/CMakeLists.txt
-index 997bef3e..c203aad1 100644
---- a/cv_bridge/CMakeLists.txt
-+++ b/cv_bridge/CMakeLists.txt
-@@ -13,7 +13,7 @@ if(NOT ANDROID)
- else()
- find_package(Boost REQUIRED)
- endif()
--find_package(OpenCV 3 REQUIRED
-+find_package(OpenCV REQUIRED
- COMPONENTS
- opencv_core
- opencv_imgproc
-diff --git a/cv_bridge/src/CMakeLists.txt b/cv_bridge/src/CMakeLists.txt
-index 37ba30ee..6d91003b 100644
---- a/cv_bridge/src/CMakeLists.txt
-+++ b/cv_bridge/src/CMakeLists.txt
-@@ -32,10 +32,12 @@ if (PYTHON_VERSION_MAJOR VERSION_EQUAL 3)
- add_definitions(-DPYTHON3)
- endif()
-
--if (OpenCV_VERSION_MAJOR VERSION_EQUAL 3)
--add_library(${PROJECT_NAME}_boost module.cpp module_opencv3.cpp)
-+if (OpenCV_VERSION_MAJOR VERSION_EQUAL 4)
-+ add_library(${PROJECT_NAME}_boost module.cpp module_opencv4.cpp)
-+elseif(OpenCV_VERSION_MAJOR VERSION_EQUAL 3)
-+ add_library(${PROJECT_NAME}_boost module.cpp module_opencv3.cpp)
- else()
--add_library(${PROJECT_NAME}_boost module.cpp module_opencv2.cpp)
-+ add_library(${PROJECT_NAME}_boost module.cpp module_opencv2.cpp)
- endif()
- target_link_libraries(${PROJECT_NAME}_boost ${Boost_LIBRARIES}
- ${catkin_LIBRARIES}
-
-From 8e01b44c5c1c0003dc91273076f8ca7feb9a8025 Mon Sep 17 00:00:00 2001
-From: BrutusTT <brutusthetschiepel@gmail.com>
-Date: Thu, 17 Oct 2019 14:37:40 +0100
-Subject: [PATCH 2/2] added missig file
-
----
- cv_bridge/src/module_opencv4.cpp | 371 +++++++++++++++++++++++++++++++
- 1 file changed, 371 insertions(+)
- create mode 100644 cv_bridge/src/module_opencv4.cpp
-
-diff --git a/cv_bridge/src/module_opencv4.cpp b/cv_bridge/src/module_opencv4.cpp
-new file mode 100644
-index 00000000..60a9d05d
---- /dev/null
-+++ b/cv_bridge/src/module_opencv4.cpp
-@@ -0,0 +1,371 @@
-+// Taken from opencv/modules/python/src2/cv2.cpp
-+
-+#include "module.hpp"
-+
-+#include "opencv2/core/types_c.h"
-+
-+#include "opencv2/opencv_modules.hpp"
-+
-+#include "pycompat.hpp"
-+
-+static PyObject* opencv_error = 0;
-+
-+static int failmsg(const char *fmt, ...)
-+{
-+ char str[1000];
-+
-+ va_list ap;
-+ va_start(ap, fmt);
-+ vsnprintf(str, sizeof(str), fmt, ap);
-+ va_end(ap);
-+
-+ PyErr_SetString(PyExc_TypeError, str);
-+ return 0;
-+}
-+
-+struct ArgInfo
-+{
-+ const char * name;
-+ bool outputarg;
-+ // more fields may be added if necessary
-+
-+ ArgInfo(const char * name_, bool outputarg_)
-+ : name(name_)
-+ , outputarg(outputarg_) {}
-+
-+ // to match with older pyopencv_to function signature
-+ operator const char *() const { return name; }
-+};
-+
-+class PyAllowThreads
-+{
-+public:
-+ PyAllowThreads() : _state(PyEval_SaveThread()) {}
-+ ~PyAllowThreads()
-+ {
-+ PyEval_RestoreThread(_state);
-+ }
-+private:
-+ PyThreadState* _state;
-+};
-+
-+class PyEnsureGIL
-+{
-+public:
-+ PyEnsureGIL() : _state(PyGILState_Ensure()) {}
-+ ~PyEnsureGIL()
-+ {
-+ PyGILState_Release(_state);
-+ }
-+private:
-+ PyGILState_STATE _state;
-+};
-+
-+#define ERRWRAP2(expr) \
-+try \
-+{ \
-+ PyAllowThreads allowThreads; \
-+ expr; \
-+} \
-+catch (const cv::Exception &e) \
-+{ \
-+ PyErr_SetString(opencv_error, e.what()); \
-+ return 0; \
-+}
-+
-+using namespace cv;
-+
-+static PyObject* failmsgp(const char *fmt, ...)
-+{
-+ char str[1000];
-+
-+ va_list ap;
-+ va_start(ap, fmt);
-+ vsnprintf(str, sizeof(str), fmt, ap);
-+ va_end(ap);
-+
-+ PyErr_SetString(PyExc_TypeError, str);
-+ return 0;
-+}
-+
-+class NumpyAllocator : public MatAllocator
-+{
-+public:
-+ NumpyAllocator() { stdAllocator = Mat::getStdAllocator(); }
-+ ~NumpyAllocator() {}
-+
-+ UMatData* allocate(PyObject* o, int dims, const int* sizes, int type, size_t* step) const
-+ {
-+ UMatData* u = new UMatData(this);
-+ u->data = u->origdata = (uchar*)PyArray_DATA((PyArrayObject*) o);
-+ npy_intp* _strides = PyArray_STRIDES((PyArrayObject*) o);
-+ for( int i = 0; i < dims - 1; i++ )
-+ step[i] = (size_t)_strides[i];
-+ step[dims-1] = CV_ELEM_SIZE(type);
-+ u->size = sizes[0]*step[0];
-+ u->userdata = o;
-+ return u;
-+ }
-+
-+ UMatData* allocate(int dims0, const int* sizes, int type, void* data, size_t* step, AccessFlag flags, UMatUsageFlags usageFlags) const
-+ {
-+ if( data != 0 )
-+ {
-+ CV_Error(Error::StsAssert, "The data should normally be NULL!");
-+ // probably this is safe to do in such extreme case
-+ return stdAllocator->allocate(dims0, sizes, type, data, step, flags, usageFlags);
-+ }
-+ PyEnsureGIL gil;
-+
-+ int depth = CV_MAT_DEPTH(type);
-+ int cn = CV_MAT_CN(type);
-+ const int f = (int)(sizeof(size_t)/8);
-+ int typenum = depth == CV_8U ? NPY_UBYTE : depth == CV_8S ? NPY_BYTE :
-+ depth == CV_16U ? NPY_USHORT : depth == CV_16S ? NPY_SHORT :
-+ depth == CV_32S ? NPY_INT : depth == CV_32F ? NPY_FLOAT :
-+ depth == CV_64F ? NPY_DOUBLE : f*NPY_ULONGLONG + (f^1)*NPY_UINT;
-+ int i, dims = dims0;
-+ cv::AutoBuffer<npy_intp> _sizes(dims + 1);
-+ for( i = 0; i < dims; i++ )
-+ _sizes[i] = sizes[i];
-+ if( cn > 1 )
-+ _sizes[dims++] = cn;
-+ PyObject* o = PyArray_SimpleNew(dims, _sizes.data(), typenum);
-+ if(!o)
-+ CV_Error_(Error::StsError, ("The numpy array of typenum=%d, ndims=%d can not be created", typenum, dims));
-+ return allocate(o, dims0, sizes, type, step);
-+ }
-+
-+ bool allocate(UMatData* u, AccessFlag accessFlags, UMatUsageFlags usageFlags) const CV_OVERRIDE
-+ {
-+ return stdAllocator->allocate(u, accessFlags, usageFlags);
-+ }
-+
-+ void deallocate(UMatData* u) const CV_OVERRIDE
-+ {
-+ if(!u)
-+ return;
-+ PyEnsureGIL gil;
-+ CV_Assert(u->urefcount >= 0);
-+ CV_Assert(u->refcount >= 0);
-+ if(u->refcount == 0)
-+ {
-+ PyObject* o = (PyObject*)u->userdata;
-+ Py_XDECREF(o);
-+ delete u;
-+ }
-+ }
-+
-+ const MatAllocator* stdAllocator;
-+};
-+
-+NumpyAllocator g_numpyAllocator;
-+
-+
-+template<typename T> static
-+bool pyopencv_to(PyObject* obj, T& p, const char* name = "<unknown>");
-+
-+template<typename T> static
-+PyObject* pyopencv_from(const T& src);
-+
-+enum { ARG_NONE = 0, ARG_MAT = 1, ARG_SCALAR = 2 };
-+
-+// special case, when the convertor needs full ArgInfo structure
-+static bool pyopencv_to(PyObject* o, Mat& m, const ArgInfo info)
-+{
-+ // to avoid PyArray_Check() to crash even with valid array
-+ do_numpy_import( );
-+
-+
-+ bool allowND = true;
-+ if(!o || o == Py_None)
-+ {
-+ if( !m.data )
-+ m.allocator = &g_numpyAllocator;
-+ return true;
-+ }
-+
-+ if( PyInt_Check(o) )
-+ {
-+ double v[] = {(double)PyInt_AsLong((PyObject*)o), 0., 0., 0.};
-+ m = Mat(4, 1, CV_64F, v).clone();
-+ return true;
-+ }
-+ if( PyFloat_Check(o) )
-+ {
-+ double v[] = {PyFloat_AsDouble((PyObject*)o), 0., 0., 0.};
-+ m = Mat(4, 1, CV_64F, v).clone();
-+ return true;
-+ }
-+ if( PyTuple_Check(o) )
-+ {
-+ int i, sz = (int)PyTuple_Size((PyObject*)o);
-+ m = Mat(sz, 1, CV_64F);
-+ for( i = 0; i < sz; i++ )
-+ {
-+ PyObject* oi = PyTuple_GET_ITEM(o, i);
-+ if( PyInt_Check(oi) )
-+ m.at<double>(i) = (double)PyInt_AsLong(oi);
-+ else if( PyFloat_Check(oi) )
-+ m.at<double>(i) = (double)PyFloat_AsDouble(oi);
-+ else
-+ {
-+ failmsg("%s is not a numerical tuple", info.name);
-+ m.release();
-+ return false;
-+ }
-+ }
-+ return true;
-+ }
-+
-+ if( !PyArray_Check(o) )
-+ {
-+ failmsg("%s is not a numpy array, neither a scalar", info.name);
-+ return false;
-+ }
-+
-+ PyArrayObject* oarr = (PyArrayObject*) o;
-+
-+ bool needcopy = false, needcast = false;
-+ int typenum = PyArray_TYPE(oarr), new_typenum = typenum;
-+ int type = typenum == NPY_UBYTE ? CV_8U :
-+ typenum == NPY_BYTE ? CV_8S :
-+ typenum == NPY_USHORT ? CV_16U :
-+ typenum == NPY_SHORT ? CV_16S :
-+ typenum == NPY_INT ? CV_32S :
-+ typenum == NPY_INT32 ? CV_32S :
-+ typenum == NPY_FLOAT ? CV_32F :
-+ typenum == NPY_DOUBLE ? CV_64F : -1;
-+
-+ if( type < 0 )
-+ {
-+ if( typenum == NPY_INT64 || typenum == NPY_UINT64 || type == NPY_LONG )
-+ {
-+ needcopy = needcast = true;
-+ new_typenum = NPY_INT;
-+ type = CV_32S;
-+ }
-+ else
-+ {
-+ failmsg("%s data type = %d is not supported", info.name, typenum);
-+ return false;
-+ }
-+ }
-+
-+#ifndef CV_MAX_DIM
-+ const int CV_MAX_DIM = 32;
-+#endif
-+
-+ int ndims = PyArray_NDIM(oarr);
-+ if(ndims >= CV_MAX_DIM)
-+ {
-+ failmsg("%s dimensionality (=%d) is too high", info.name, ndims);
-+ return false;
-+ }
-+
-+ int size[CV_MAX_DIM+1];
-+ size_t step[CV_MAX_DIM+1];
-+ size_t elemsize = CV_ELEM_SIZE1(type);
-+ const npy_intp* _sizes = PyArray_DIMS(oarr);
-+ const npy_intp* _strides = PyArray_STRIDES(oarr);
-+ bool ismultichannel = ndims == 3 && _sizes[2] <= CV_CN_MAX;
-+
-+ for( int i = ndims-1; i >= 0 && !needcopy; i-- )
-+ {
-+ // these checks handle cases of
-+ // a) multi-dimensional (ndims > 2) arrays, as well as simpler 1- and 2-dimensional cases
-+ // b) transposed arrays, where _strides[] elements go in non-descending order
-+ // c) flipped arrays, where some of _strides[] elements are negative
-+ if( (i == ndims-1 && (size_t)_strides[i] != elemsize) ||
-+ (i < ndims-1 && _strides[i] < _strides[i+1]) )
-+ needcopy = true;
-+ }
-+
-+ if( ismultichannel && _strides[1] != (npy_intp)elemsize*_sizes[2] )
-+ needcopy = true;
-+
-+ if (needcopy)
-+ {
-+ if (info.outputarg)
-+ {
-+ failmsg("Layout of the output array %s is incompatible with cv::Mat (step[ndims-1] != elemsize or step[1] != elemsize*nchannels)", info.name);
-+ return false;
-+ }
-+
-+ if( needcast ) {
-+ o = PyArray_Cast(oarr, new_typenum);
-+ oarr = (PyArrayObject*) o;
-+ }
-+ else {
-+ oarr = PyArray_GETCONTIGUOUS(oarr);
-+ o = (PyObject*) oarr;
-+ }
-+
-+ _strides = PyArray_STRIDES(oarr);
-+ }
-+
-+ for(int i = 0; i < ndims; i++)
-+ {
-+ size[i] = (int)_sizes[i];
-+ step[i] = (size_t)_strides[i];
-+ }
-+
-+ // handle degenerate case
-+ if( ndims == 0) {
-+ size[ndims] = 1;
-+ step[ndims] = elemsize;
-+ ndims++;
-+ }
-+
-+ if( ismultichannel )
-+ {
-+ ndims--;
-+ type |= CV_MAKETYPE(0, size[2]);
-+ }
-+
-+ if( ndims > 2 && !allowND )
-+ {
-+ failmsg("%s has more than 2 dimensions", info.name);
-+ return false;
-+ }
-+
-+ m = Mat(ndims, size, type, PyArray_DATA(oarr), step);
-+ m.u = g_numpyAllocator.allocate(o, ndims, size, type, step);
-+ m.addref();
-+
-+ if( !needcopy )
-+ {
-+ Py_INCREF(o);
-+ }
-+ m.allocator = &g_numpyAllocator;
-+
-+ return true;
-+}
-+
-+template<>
-+bool pyopencv_to(PyObject* o, Mat& m, const char* name)
-+{
-+ return pyopencv_to(o, m, ArgInfo(name, 0));
-+}
-+
-+PyObject* pyopencv_from(const Mat& m)
-+{
-+ if( !m.data )
-+ Py_RETURN_NONE;
-+ Mat temp, *p = (Mat*)&m;
-+ if(!p->u || p->allocator != &g_numpyAllocator)
-+ {
-+ temp.allocator = &g_numpyAllocator;
-+ ERRWRAP2(m.copyTo(temp));
-+ p = &temp;
-+ }
-+ PyObject* o = (PyObject*)p->u->userdata;
-+ Py_INCREF(o);
-+ return o;
-+}
-+
-+int convert_to_CvMat2(const PyObject* o, cv::Mat& m)
-+{
-+ pyopencv_to(const_cast<PyObject*>(o), m, "unknown");
-+ return 0;
-+}