diff --git a/modules/python/src2/gen2.py b/modules/python/src2/gen2.py index 1a9dfb8e68..bb2acb2674 100755 --- a/modules/python/src2/gen2.py +++ b/modules/python/src2/gen2.py @@ -211,6 +211,7 @@ simple_argtype_mapping = { "double": ArgTypeInfo("double", FormatStrings.double, "0", True), "c_string": ArgTypeInfo("char*", FormatStrings.string, '(char*)""'), "string": ArgTypeInfo("std::string", FormatStrings.object, None, True), + "Stream": ArgTypeInfo("Stream", FormatStrings.object, 'Stream::Null()', True), } diff --git a/modules/python/test/test_cuda.py b/modules/python/test/test_cuda.py index 4bcd4108f1..4b3fc7d278 100644 --- a/modules/python/test/test_cuda.py +++ b/modules/python/test/test_cuda.py @@ -26,6 +26,15 @@ class cuda_test(NewOpenCVTests): self.assertTrue(np.allclose(cuMat.download(), npMat)) + def test_cuda_upload_download_stream(self): + stream = cv.cuda_Stream() + npMat = (np.random.random((128, 128, 3)) * 255).astype(np.uint8) + cuMat = cv.cuda_GpuMat(128,128, cv.CV_8UC3) + cuMat.upload(npMat, stream) + npMat2 = cuMat.download(stream=stream) + stream.waitForCompletion() + self.assertTrue(np.allclose(npMat2, npMat)) + def test_cuda_interop(self): npMat = (np.random.random((128, 128, 3)) * 255).astype(np.uint8) cuMat = cv.cuda_GpuMat()