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

error to call opencv #248

Closed
longqian95 opened this issue Mar 17, 2016 · 3 comments
Closed

error to call opencv #248

longqian95 opened this issue Mar 17, 2016 · 3 comments

Comments

@longqian95
Copy link

The following simple code has error:

ERROR: PyError (:PyObject_Call) <type 'exceptions.TypeError'>
TypeError('Layout of the output array image is incompatible with cv::Mat (step[ndims-1] != elemsize or step[1] != elemsize*nchannels)',)

using PyCall
@pyimport cv2
cv2.findContours(rand(UInt8,64,64),cv2.RETR_EXTERNAL,cv2.CHAIN_APPROX_SIMPLE)

But the corresponding python code has no problem:

import cv2
cv2.findContours(array(randint(0,255,(64,64)),uint8),cv2.RETR_EXTERNAL,cv2.CHAIN_APPROX_SIMPLE)

Julia: 0.4.3
PyCall: master
python: 2.7
opencv: 2.4.x
os: ubuntu 14.04

@stevengj
Copy link
Member

stevengj commented Apr 6, 2016

It sounds like OpenCV is expecting an array row-major order, whereas Julia's array is in column-major order. This needs something like #85, it seems like.

@stevengj
Copy link
Member

Fixed by #265

@longqian95
Copy link
Author

Thanks. Now cv2.findContours(PyReverseDims(rand(UInt8,64,64)), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE) works.

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

2 participants