mirror of
https://github.com/opencv/opencv.git
synced 2025-08-03 20:56:30 +08:00
Merge pull request #18505 from alalek:fix_python_test
This commit is contained in:
commit
aabeb8a18e
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user