Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

ValueError: could not broadcast input array from shape (0,60,3) into shape (7,60,3)

I am a newbie to openCV. I am tryying to implement image ROI by following this tutorial . Numpy version - 1.15.2 openCv Version - 3.4.3 Python - 3.4.3

Code i am using is -

import cv2
import numpy as np

img = cv2.imread("roi.jpg")
k = img.shape
print("Shape of Image in terms of Row, Column and Pattern i.e, BGR : ",k)
print("Type of Image : ",img.dtype)
ball = img[280:340, 330:390]
img[273:333, 100:160] = ball

Output Produced is -

Shape of Image in terms of Row, Column and Pattern i.e, BGR :  (280, 450, 3)
Type of Image :  uint8
Traceback (most recent call last):
  File ".\pixelAccess.py", line 36, in <module>
    img[273:333, 100:160] = nose
ValueError: could not broadcast input array from shape (0,60,3) into shape (7,60,3)