diff --git a/modules/core/include/opencv2/core/cuda.hpp b/modules/core/include/opencv2/core/cuda.hpp index 719003f21f..09220cd6b2 100644 --- a/modules/core/include/opencv2/core/cuda.hpp +++ b/modules/core/include/opencv2/core/cuda.hpp @@ -689,7 +689,7 @@ class CV_EXPORTS_W BufferPool public: //! Gets the BufferPool for the given stream. - explicit BufferPool(Stream& stream); + CV_WRAP explicit BufferPool(Stream& stream); //! Allocates a new GpuMat of given size and type. CV_WRAP GpuMat getBuffer(int rows, int cols, int type); diff --git a/modules/python/test/test_cuda.py b/modules/python/test/test_cuda.py index 4b3fc7d278..a047a8b2f4 100644 --- a/modules/python/test/test_cuda.py +++ b/modules/python/test/test_cuda.py @@ -45,5 +45,15 @@ class cuda_test(NewOpenCVTests): asyncstream = cv.cuda_Stream(1) # cudaStreamNonBlocking self.assertTrue(asyncstream.cudaPtr() != 0) + def test_cuda_buffer_pool(self): + cv.cuda.setBufferPoolUsage(True) + cv.cuda.setBufferPoolConfig(cv.cuda.getDevice(), 1024 * 1024 * 64, 2) + stream_a = cv.cuda.Stream() + pool_a = cv.cuda.BufferPool(stream_a) + cuMat = pool_a.getBuffer(1024, 1024, cv.CV_8UC3) + cv.cuda.setBufferPoolUsage(False) + self.assertEqual(cuMat.size(), (1024, 1024)) + self.assertEqual(cuMat.type(), cv.CV_8UC3) + if __name__ == '__main__': NewOpenCVTests.bootstrap()