python - What does the ValueError : could not broadcast from input array(1) to input array(2) mean? -
import numpy np import cv2 matplotlib import pyplot plt while(1): img=cv2.imread('d:\img_0590_1.jpg') ball = img[278:104, 330:158] img[181:355, 100:274] = ball cv2.imshow('img',img) if cv2.waitkey(10) & 0xff == ord('q'): break cv2.destroyallwindows()
this code giving above mentioned error. problem?
the first number in slice needs smaller second. turn
ball = img[278:104, 330:158]
into
ball = img[104:278, 158:330]
also dimensions don't match. ball 172 pixels wide, , you're putting slice 174 pixels wide
Comments
Post a Comment