python: replace numpy.full() to support numpy<1.13
authorAlexander Alekhin <alexander.a.alekhin@gmail.com>
Sun, 4 Oct 2020 14:52:13 +0000 (14:52 +0000)
committerAlexander Alekhin <alexander.a.alekhin@gmail.com>
Mon, 5 Oct 2020 15:15:49 +0000 (15:15 +0000)
modules/python/test/test_copytomask.py

index 05e30ed72799883b9b3c157b94fcfd35a06ddd5c..ce0e614d44854c2c82ab7d8e8d0b7bccb45a1e5c 100644 (file)
@@ -24,10 +24,12 @@ class copytomask_test(NewOpenCVTests):
         valeurBGRSup = np.array([70, 70,255])
         maskRed = cv.inRange(img, valeurBGRinf, valeurBGRSup)
         #New binding
-        dstcv = np.full(np.array((2, 2, 1))*img.shape, 255, dtype=img.dtype)
+        dstcv = np.ndarray(np.array((2, 2, 1))*img.shape, dtype=img.dtype)
+        dstcv.fill(255)
         cv.copyTo(img, maskRed, dstcv[:img.shape[0],:img.shape[1],:])
         #using numpy
-        dstnp = np.full(np.array((2, 2, 1))*img.shape, 255, dtype=img.dtype)
+        dstnp = np.ndarray(np.array((2, 2, 1))*img.shape, dtype=img.dtype)
+        dstnp.fill(255)
         mask2=maskRed.astype(bool)
         _, mask_b = np.broadcast_arrays(img, mask2[..., None])
         np.copyto(dstnp[:img.shape[0],:img.shape[1],:], img, where=mask_b)