-
-
Notifications
You must be signed in to change notification settings - Fork 161
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
Ndarray to Mat conversion. #588
Comments
Hi, thanks for the report, that's an interesting issue. Will it be possible for you to provide a minimum code snippet that exhibits this problem? I can understand the particular issue that OpenCV doesn't accept Also if you you know the section in the Python wrapper that's handling this conversion it would be really useful too. |
Will do! When it comes to Python wrapper, it's not the best piece of code, but I think I can point you to a potential candidate. |
Hey @twistedfall
Basically we read a 3-channel image and then create a mask out of it to later do things to it, like However if we pass
Let me know if this is snippet enough. If you need the whole project setup - it's a pretty typical
|
Actually, here's the simplified example without Python: https://github.com/ruseinov/chan-fail . |
When it comes to OpenCV Python conversions, I think you'll find them around here: And some others within the same directory. Please let me know if I can help in any way. Fixing this would be really cool, by having some sort of rust numpy compat. There used to be this https://github.com/jerry73204/rust-cv-convert/, but it's both outdated and does not solve that issue. |
I have been working on a python extension, using
The main issue I'm facing now is that Python OpenCV code is now reading images as numpy arrays, so that's what I have to pass to Rust. But those numpy arrays have too many channels, so when I actually need to call any Rust OpenCV methods - I need to convert this back to Mat, but the reshape fails due to
CV_CN_MAX
, which is512
.It seems there is some way of tackling this within the C++ OpenCV Python extensions. It'd be really nice to introduce a way of doing that for Rust too.
Here's the code in question:
Here's some context: opencv/opencv#20070
It looks like the PythonWrapper knows how to convert these things back and forth, reshaping to fit the bill.
The text was updated successfully, but these errors were encountered: