mirror of
https://github.com/opencv/opencv.git
synced 2026-07-29 07:13:02 +04:00
Merge branch 4.x
This commit is contained in:
@@ -68,13 +68,20 @@ if(DEFINED OPENCV_PYTHON_INSTALL_PATH)
|
||||
endif()
|
||||
set(CMAKE_PYTHON_BINARIES_PATH "${CMAKE_PYTHON_BINARIES_INSTALL_PATH}")
|
||||
if (WIN32 AND HAVE_CUDA)
|
||||
set(_cuda_bin_dir "bin")
|
||||
if (ENABLE_CUDA_FIRST_CLASS_LANGUAGE)
|
||||
if (DEFINED CUDAToolkit_LIBRARY_ROOT)
|
||||
list(APPEND CMAKE_PYTHON_BINARIES_PATH "os.path.join(os.getenv('CUDA_PATH', '${CUDAToolkit_LIBRARY_ROOT}'), 'bin')")
|
||||
if(DEFINED CUDAToolkit_VERSION_MAJOR AND CUDAToolkit_VERSION_MAJOR GREATER_EQUAL 13)
|
||||
set(_cuda_bin_dir "bin/x64")
|
||||
endif()
|
||||
list(APPEND CMAKE_PYTHON_BINARIES_PATH "os.path.join(os.getenv('CUDA_PATH', '${CUDAToolkit_LIBRARY_ROOT}'), '${_cuda_bin_dir}')")
|
||||
endif()
|
||||
else()
|
||||
if (DEFINED CUDA_TOOLKIT_ROOT_DIR)
|
||||
list(APPEND CMAKE_PYTHON_BINARIES_PATH "os.path.join(os.getenv('CUDA_PATH', '${CUDA_TOOLKIT_ROOT_DIR}'), 'bin')")
|
||||
if(DEFINED CUDA_VERSION_MAJOR AND CUDA_VERSION_MAJOR GREATER_EQUAL 13)
|
||||
set(_cuda_bin_dir "bin/x64")
|
||||
endif()
|
||||
list(APPEND CMAKE_PYTHON_BINARIES_PATH "os.path.join(os.getenv('CUDA_PATH', '${CUDA_TOOLKIT_ROOT_DIR}'), '${_cuda_bin_dir}')")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -133,6 +133,9 @@ static PyGetSetDef pyopencv_${name}_getseters[] =
|
||||
|
||||
static PyMethodDef pyopencv_${name}_methods[] =
|
||||
{
|
||||
#ifdef PYOPENCV_EXTRA_METHODS_${name}
|
||||
PYOPENCV_EXTRA_METHODS_${name}
|
||||
#endif
|
||||
${methods_inits}
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
@@ -70,6 +70,7 @@ class cuda_test(NewOpenCVTests):
|
||||
self.assertTrue(cuMat.step == 0)
|
||||
self.assertTrue(cuMat.size() == (0, 0))
|
||||
|
||||
@unittest.skip("failed test")
|
||||
def test_cuda_convertTo(self):
|
||||
# setup
|
||||
npMat_8UC4 = (np.random.random((128, 128, 4)) * 255).astype(np.uint8)
|
||||
@@ -105,6 +106,7 @@ class cuda_test(NewOpenCVTests):
|
||||
stream.waitForCompletion()
|
||||
self.assertTrue(np.array_equal(npMat_32FC4, npMat_32FC4_out))
|
||||
|
||||
@unittest.skip("failed test")
|
||||
def test_cuda_copyTo(self):
|
||||
# setup
|
||||
npMat_8UC4 = (np.random.random((128, 128, 4)) * 255).astype(np.uint8)
|
||||
@@ -143,5 +145,18 @@ class cuda_test(NewOpenCVTests):
|
||||
self.assertEqual(True, hasattr(cv.cuda, 'fastNlMeansDenoisingColored'))
|
||||
self.assertEqual(True, hasattr(cv.cuda, 'nonLocalMeans'))
|
||||
|
||||
def test_dlpack_GpuMat(self):
|
||||
for dtype in [np.int8, np.uint8, np.int16, np.uint16, np.float16, np.int32, np.float32, np.float64]:
|
||||
for channels in [2, 3, 5]:
|
||||
ref = (np.random.random((64, 128, channels)) * 255).astype(dtype)
|
||||
src = cv.cuda_GpuMat()
|
||||
src.upload(ref)
|
||||
dst = cv.cuda_GpuMat.from_dlpack(src)
|
||||
test = dst.download()
|
||||
equal = np.array_equal(ref, test)
|
||||
if not equal:
|
||||
print(f"Failed test with dtype {dtype} and {channels} channels")
|
||||
self.assertTrue(equal)
|
||||
|
||||
if __name__ == '__main__':
|
||||
NewOpenCVTests.bootstrap()
|
||||
|
||||
Reference in New Issue
Block a user