Merge pull request #21940 from hakaboom:python_wrap

This commit is contained in:
OpenCV Pushbot 2022-05-04 09:40:39 +00:00 committed by GitHub
commit ada703a73a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 1 deletions

View File

@ -155,7 +155,7 @@ public:
CV_WRAP void create(Size size, int type);
//! decreases reference counter, deallocate the data when reference counter reaches 0
void release();
CV_WRAP void release();
//! swaps with other smart pointer
CV_WRAP void swap(GpuMat& mat);

View File

@ -55,5 +55,14 @@ class cuda_test(NewOpenCVTests):
self.assertEqual(cuMat.size(), (1024, 1024))
self.assertEqual(cuMat.type(), cv.CV_8UC3)
def test_cuda_release(self):
npMat = (np.random.random((128, 128, 3)) * 255).astype(np.uint8)
cuMat = cv.cuda_GpuMat()
cuMat.upload(npMat)
cuMat.release()
self.assertTrue(cuMat.cudaPtr() == 0)
self.assertTrue(cuMat.step == 0)
self.assertTrue(cuMat.size() == (0, 0))
if __name__ == '__main__':
NewOpenCVTests.bootstrap()