ValueError could not broadcast input array from shape 360 270 3 into shape 360 280 3

0 votes

I tried to crop my face from a photo using cv2 module in python. But I got this below error.

ValueError                                Traceback (most recent call last)
<ipython-input-23-6fa3f8830675> in <module>
      3 photo1 = photo[100:460,200:480].copy()
      4 photo2 = photo[140:500,780:1050].copy()
----> 5 photo[100:460,200:480]=photo2
      6 photo[140:500,780:1050]=photo1
      7 cv2.imshow('My Photo',photo)
ValueError: could not broadcast input array from shape (360,270,3) into shape (360,280,3)

How can I solve this error?

Thank You

Apr 9, 2020 in Python by akhtar
• 38,170 points
2,155 views

1 answer to this question.