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 in Python by akhtar
• 10,580 points
109 views

1 answer to this question.

0 votes

Hi@akhtar,

In the above error it shows could not broadcast input array from shape (360,270,3) into shape (360,280,3), means you are tying to exchange your crop sections but they are not in same dimension. So please make sure that the dimensions are same.

Hope this will help.

Thank You

answered Apr 9 by MD
• 23,050 points

Related Questions In Python

0 votes
1 answer
0 votes
1 answer

ValueError: could not broadcast input array from shape (4,1) into shape (4)

Hey @Giorgio, You can try this hope this ...READ MORE

answered Feb 18 in Python by Gitika
• 29,290 points
769 views
+1 vote
0 answers

ValueError: operands could not be broadcast together with shapes (3,) (1000,)

This is the part of my code, why ...READ MORE

May 17 in Python by anonymous
• 200 points

edited May 18 by Gitika 141 views
+1 vote
3 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 947 views
0 votes
0 answers
+1 vote
0 answers

ValueError: could not broadcast input array from shape (2) into shape (5)

I was implementing gillespie algorithm and when ...READ MORE

Dec 23, 2019 in Python by anonymous
• 130 points

reshown Jan 13 by Kalgi 1,085 views
0 votes
1 answer

How to crop face from a photo using cv2 in python?

Hi@akhtar, You can do this task using cv2 ...READ MORE

answered Apr 9 in Python by MD
• 23,050 points
42 views