mirror of
https://github.com/opencv/opencv.git
synced 2025-07-30 17:37:05 +08:00
Merge pull request #21919 from asmorkalov:as/cuda_buffer_pool_python
This commit is contained in:
commit
d44ac61033
@ -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);
|
||||
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user