I want to use opencv module but I can't import OpenCV. So how can I solve this problem? By the way, Pyodide supports OpenCV.
-
Please provide enough code so others can better understand or reproduce the problem.Community– Community Bot2022-05-11 11:05:35 +00:00Commented May 11, 2022 at 11:05
-
Do not use links to provide question details. Create self-contained questions. Links change, break, etc rendering your question useless in the future.John Hanley– John Hanley2022-05-11 17:45:37 +00:00Commented May 11, 2022 at 17:45
Add a comment
|
2 Answers
OpenCV is not supported yet.
At this time, OpenCV requires pypi-json. Loading that package via Pyscript micropip throws a CORS error. Once that is fixed, I am not sure which other problems will surface.
This means some OpenCV dependencies must be corrected first.
[UPDATE]
This link infers that the Pyodide dev branch now supports openCV. I have not verified that information.
1 Comment
Yılmaz ALACA
Hi Mr. John, thanks a lot for your answer.
Have you loaded it as a module in your HTML?
<py-env>
- bokeh
- numpy
....
- OpenCV
</py-env>
7 Comments
Yılmaz ALACA
I added as <py-env> - cv2 <py-env>.
lukygee
Are you also importing as usual in your file? Try opencv-python. Do you get an error when you try to use the module?
Christoph Rackwitz
the import is called
cv2 but the PyPI package is called opencv-pythonYılmaz ALACA
As I understand, I editted the question part. You can find example code in "Example Code".
Wayne
@Yılmaz ALACA I'm confused then. Did it work yet? If that is the solution that works, make it clear in the edited answer. Plus, don't put in code as an image. You'll want to put it in as a text code block. I like the second and third way listed here. Those options will serve you well posting code at StackOverflow here and in the future.
|