Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- img = cv2.imread(path, -1)
- eye = img[349:307, 410:383]
- img[30:180, 91:256] = eye
- Traceback (most recent call last):
- File "test.py", line 13, in <module>
- img[30:180, 91:256] = eye
- ValueError: could not broadcast input array from shape (0,0,3) into shape (150,165,3)
- ValueError: could not broadcast input array from shape (0,0,3) into shape (150,165,3)
- In [8]: import cv2
- ...: fn=r'D:DocumentsDesktop1.jpg'
- ...: img=cv2.imread(fn, -1)
- ...: roi=img[200:400, 200:300]
- In [9]: roi.shape
- Out[9]: (200, 100, 3)
- In [10]: img2=img.copy()
- In [11]: img2[:roi.shape[0], :roi.shape[1]]=roi
- In [12]: cv2.imshow('img', img)
- ...: cv2.imshow('roi', roi)
- ...: cv2.imshow('img2', img2)
- ...: cv2.waitKey(0)
- ...: cv2.destroyAllWindows()
- In [13]: img2[:100, :100]=roi
- ---------------------------------------------------------------------------
- ValueError Traceback (most recent call last)
- <ipython-input-13-85de95cf3ded> in <module>()
- ----> 1 img2[:100, :100]=roi
- ValueError: could not broadcast input array from shape (200,100,3) into shape (100,100,3)
- img[349:307, 410:383]
- img[307,349, 383:413]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement