feat: 切换后端至PaddleOCR-NCNN,切换工程为CMake
1.项目后端整体迁移至PaddleOCR-NCNN算法,已通过基本的兼容性测试 2.工程改为使用CMake组织,后续为了更好地兼容第三方库,不再提供QMake工程 3.重整权利声明文件,重整代码工程,确保最小化侵权风险 Log: 切换后端至PaddleOCR-NCNN,切换工程为CMake Change-Id: I4d5d2c5d37505a4a24b389b1a4c5d12f17bfa38c
This commit is contained in:
33
3rdparty/opencv-4.5.4/modules/core/misc/python/package/mat_wrapper/__init__.py
vendored
Normal file
33
3rdparty/opencv-4.5.4/modules/core/misc/python/package/mat_wrapper/__init__.py
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
__all__ = []
|
||||
|
||||
import sys
|
||||
import numpy as np
|
||||
import cv2 as cv
|
||||
|
||||
# NumPy documentation: https://numpy.org/doc/stable/user/basics.subclassing.html
|
||||
|
||||
class Mat(np.ndarray):
|
||||
'''
|
||||
cv.Mat wrapper for numpy array.
|
||||
|
||||
Stores extra metadata information how to interpret and process of numpy array for underlying C++ code.
|
||||
'''
|
||||
|
||||
def __new__(cls, arr, **kwargs):
|
||||
obj = arr.view(Mat)
|
||||
return obj
|
||||
|
||||
def __init__(self, arr, **kwargs):
|
||||
self.wrap_channels = kwargs.pop('wrap_channels', getattr(arr, 'wrap_channels', False))
|
||||
if len(kwargs) > 0:
|
||||
raise TypeError('Unknown parameters: {}'.format(repr(kwargs)))
|
||||
|
||||
def __array_finalize__(self, obj):
|
||||
if obj is None:
|
||||
return
|
||||
self.wrap_channels = getattr(obj, 'wrap_channels', None)
|
||||
|
||||
|
||||
Mat.__module__ = cv.__name__
|
||||
cv.Mat = Mat
|
||||
cv._registerMatType(Mat)
|
14
3rdparty/opencv-4.5.4/modules/core/misc/python/package/utils/__init__.py
vendored
Normal file
14
3rdparty/opencv-4.5.4/modules/core/misc/python/package/utils/__init__.py
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
from collections import namedtuple
|
||||
|
||||
import cv2
|
||||
|
||||
|
||||
NativeMethodPatchedResult = namedtuple("NativeMethodPatchedResult",
|
||||
("py", "native"))
|
||||
|
||||
|
||||
def testOverwriteNativeMethod(arg):
|
||||
return NativeMethodPatchedResult(
|
||||
arg + 1,
|
||||
cv2.utils._native.testOverwriteNativeMethod(arg)
|
||||
)
|
8
3rdparty/opencv-4.5.4/modules/core/misc/python/pyopencv_async.hpp
vendored
Normal file
8
3rdparty/opencv-4.5.4/modules/core/misc/python/pyopencv_async.hpp
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
#ifdef HAVE_OPENCV_CORE
|
||||
|
||||
#include "opencv2/core/async.hpp"
|
||||
|
||||
CV_PY_TO_CLASS(AsyncArray);
|
||||
CV_PY_FROM_CLASS(AsyncArray);
|
||||
|
||||
#endif
|
37
3rdparty/opencv-4.5.4/modules/core/misc/python/pyopencv_cuda.hpp
vendored
Normal file
37
3rdparty/opencv-4.5.4/modules/core/misc/python/pyopencv_cuda.hpp
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
#ifdef HAVE_OPENCV_CORE
|
||||
|
||||
#include "opencv2/core/cuda.hpp"
|
||||
|
||||
typedef std::vector<cuda::GpuMat> vector_GpuMat;
|
||||
typedef cuda::GpuMat::Allocator GpuMat_Allocator;
|
||||
typedef cuda::HostMem::AllocType HostMem_AllocType;
|
||||
typedef cuda::Event::CreateFlags Event_CreateFlags;
|
||||
|
||||
template<> struct pyopencvVecConverter<cuda::GpuMat>
|
||||
{
|
||||
static bool to(PyObject* obj, std::vector<cuda::GpuMat>& value, const ArgInfo& info)
|
||||
{
|
||||
return pyopencv_to_generic_vec(obj, value, info);
|
||||
}
|
||||
|
||||
static PyObject* from(const std::vector<cuda::GpuMat>& value)
|
||||
{
|
||||
return pyopencv_from_generic_vec(value);
|
||||
}
|
||||
};
|
||||
|
||||
CV_PY_TO_CLASS(cuda::GpuMat);
|
||||
CV_PY_TO_CLASS(cuda::Stream);
|
||||
CV_PY_TO_CLASS(cuda::Event);
|
||||
CV_PY_TO_CLASS(cuda::HostMem);
|
||||
|
||||
CV_PY_TO_CLASS_PTR(cuda::GpuMat);
|
||||
CV_PY_TO_CLASS_PTR(cuda::GpuMat::Allocator);
|
||||
|
||||
CV_PY_FROM_CLASS(cuda::GpuMat);
|
||||
CV_PY_FROM_CLASS(cuda::Stream);
|
||||
CV_PY_FROM_CLASS(cuda::HostMem);
|
||||
|
||||
CV_PY_FROM_CLASS_PTR(cuda::GpuMat::Allocator);
|
||||
|
||||
#endif
|
36
3rdparty/opencv-4.5.4/modules/core/misc/python/pyopencv_umat.hpp
vendored
Normal file
36
3rdparty/opencv-4.5.4/modules/core/misc/python/pyopencv_umat.hpp
vendored
Normal file
@ -0,0 +1,36 @@
|
||||
#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);
|
||||
|
||||
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
|
59
3rdparty/opencv-4.5.4/modules/core/misc/python/shadow_umat.hpp
vendored
Normal file
59
3rdparty/opencv-4.5.4/modules/core/misc/python/shadow_umat.hpp
vendored
Normal file
@ -0,0 +1,59 @@
|
||||
#error This is a shadow header file, which is not intended for processing by any compiler. \
|
||||
Only bindings parser should handle this file.
|
||||
|
||||
namespace cv
|
||||
{
|
||||
|
||||
class CV_EXPORTS_W UMat
|
||||
{
|
||||
public:
|
||||
//! default constructor
|
||||
CV_WRAP UMat(UMatUsageFlags usageFlags = USAGE_DEFAULT);
|
||||
//! constructs 2D matrix of the specified size and type
|
||||
// (_type is CV_8UC1, CV_64FC3, CV_32SC(12) etc.)
|
||||
CV_WRAP UMat(int rows, int cols, int type, UMatUsageFlags usageFlags = USAGE_DEFAULT);
|
||||
CV_WRAP UMat(Size size, int type, UMatUsageFlags usageFlags = USAGE_DEFAULT);
|
||||
//! constructs 2D matrix and fills it with the specified value _s.
|
||||
CV_WRAP UMat(int rows, int cols, int type, const Scalar& s, UMatUsageFlags usageFlags = USAGE_DEFAULT);
|
||||
CV_WRAP UMat(Size size, int type, const Scalar& s, UMatUsageFlags usageFlags = USAGE_DEFAULT);
|
||||
|
||||
//! Mat is mappable to UMat
|
||||
CV_WRAP_MAPPABLE(Ptr<Mat>);
|
||||
|
||||
//! returns the OpenCL queue used by OpenCV UMat
|
||||
CV_WRAP_PHANTOM(static void* queue());
|
||||
|
||||
//! returns the OpenCL context used by OpenCV UMat
|
||||
CV_WRAP_PHANTOM(static void* context());
|
||||
|
||||
//! copy constructor
|
||||
CV_WRAP UMat(const UMat& m);
|
||||
|
||||
//! creates a matrix header for a part of the bigger matrix
|
||||
CV_WRAP UMat(const UMat& m, const Range& rowRange, const Range& colRange = Range::all());
|
||||
CV_WRAP UMat(const UMat& m, const Rect& roi);
|
||||
CV_WRAP UMat(const UMat& m, const std::vector<Range>& ranges);
|
||||
|
||||
//CV_WRAP_AS(get) Mat getMat(int flags CV_WRAP_DEFAULT(ACCESS_RW)) const;
|
||||
//! returns a numpy matrix
|
||||
CV_WRAP_PHANTOM(Mat get() const);
|
||||
|
||||
//! returns true iff the matrix data is continuous
|
||||
// (i.e. when there are no gaps between successive rows).
|
||||
// similar to CV_IS_MAT_CONT(cvmat->type)
|
||||
CV_WRAP bool isContinuous() const;
|
||||
|
||||
//! returns true if the matrix is a submatrix of another matrix
|
||||
CV_WRAP bool isSubmatrix() const;
|
||||
|
||||
/*! Returns the OpenCL buffer handle on which UMat operates on.
|
||||
The UMat instance should be kept alive during the use of the handle to prevent the buffer to be
|
||||
returned to the OpenCV buffer pool.
|
||||
*/
|
||||
CV_WRAP void* handle(AccessFlag accessFlags) const;
|
||||
|
||||
// offset of the submatrix (or 0)
|
||||
CV_PROP_RW size_t offset;
|
||||
};
|
||||
|
||||
} // namespace cv
|
Reference in New Issue
Block a user