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)