Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError: array is not broadcastable to correct shape! #3

Open
getengqing opened this issue May 10, 2016 · 11 comments
Open

ValueError: array is not broadcastable to correct shape! #3

getengqing opened this issue May 10, 2016 · 11 comments

Comments

@getengqing
Copy link

Hello, I got the error:

frontal_raw[ind_frontal, :] = cv2.remap(img, temp_proj2[0, :].astype('float32'), temp_proj2[1, :].astype('float32'), cv2.INTER_CUBIC)
ValueError: array is not broadcastable to correct shape

what's the error?How can i sovle?

@dougsouza
Copy link
Owner

Hi @getengqing,

Could you give more details about the error? How are you reading the image? Is it a RGB image? Are having this issue with one image in particular?

@getengqing
Copy link
Author

I run your demo.py , I have no anyway change to your program. Then got the error!

@dougsouza
Copy link
Owner

That's odd. Which version of OpenCV are you using?

@181066
Copy link

181066 commented May 26, 2016

Hi, I've got the same error. OpenCV version is 2.4.8

Traceback (most recent call last):
File "/usr/lib/pycharm/helpers/pydev/pydevd.py", line 1531, in
globals = debugger.run(setup['file'], None, None, is_module)
File "/usr/lib/pycharm/helpers/pydev/pydevd.py", line 938, in run
pydev_imports.execfile(file, globals, locals) # execute the script
File "/home/boss/face-frontalization/demo.py", line 48, in
demo()
File "/home/boss/face-frontalization/demo.py", line 37, in demo
frontal_raw, frontal_sym = frontalize.frontalize(img, proj_matrix, model3D.ref_U, eyemask)
File "/home/boss/face-frontalization/frontalize.py", line 57, in frontalize
frontal_raw[ind_frontal, :] = cv2.remap(img, temp_proj2[0, :].astype('float32'), temp_proj2[1, :].astype('float32'), cv2.INTER_CUBIC)
ValueError: array is not broadcastable to correct shape

@dougsouza
Copy link
Owner

@181066,

Could you give more details about the input image? It would be great if could share the image itself

@181066
Copy link

181066 commented May 27, 2016

The input image is the one from your demo - test.jpg
I just run your code without changes. Well, initially I tried to use my image that was looking much more difficult for frontalization. It didn't find facial points and failed. Ok then I just decided to check your demo and got that error.

Thank you.

@dougsouza
Copy link
Owner

Try upgrading your numpy version

@181066
Copy link

181066 commented Jun 2, 2016

I have the latest numpy 1.8.2 for ubuntu 14.04.

@dougsouza
Copy link
Owner

dougsouza commented Jun 2, 2016

@181066, this is the not last version, I am using 1.10.4 on ubuntu 14.04, for example.

PS.: I am using the Anaconda python distribution.

@181066
Copy link

181066 commented Jun 3, 2016

Thanks a lot. Works fine with Anaconda.

@zhanlv600
Copy link

I also meet this problem and my numpy version is also 1.8.2.
I just use sudo pip install --upgrade numpy to get latest numpy 1.13.1, and this problem can be solved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants