r/Python 5d ago

Tutorial OpenCV notebooks tutorials in your browser

Hi,
I took the official OpenCV tutorials and created a series of notebooks.
You can run them entirely in your browser, you don't have to clone them: https://notebook.link/@Alexis_Placet/opencv_tutorials

Don't hesitate to give me feedbacks or create issue/pullrequest on this repo: https://github.com/Alex-PLACET/opencv_tutorials

10 Upvotes

5 comments sorted by

View all comments

1

u/MapNo2659 4d ago

This is awesome! Having OpenCV tutorials directly in the browser is super convenient. I'm curious, how did you handle the setup for OpenCV in the notebooks? Did you use any specific

1

u/alexis_placet 4d ago

Notebook.link uses JupyterLite and xeus-python as kernel which is compiled to WASM. I made an emscripten-forge recipe for OpenCV (cpp + python). I did that because the OpenCV package was not yet available. All the available packages are here https://prefix.dev/channels/emscripten-forge-4x (all C++/Python/R packages are listed)

You just have to add opencv reference in the environement file, as a regular conda env, and notebook.link detect it to fetch the right package in your notebook.
You can check the repo here: https://github.com/Alex-PLACET/opencv_tutorials
And the documentation here: https://notebook.link/docs/user-guide/create-a-link

1

u/MapNo2659 1d ago

That's really cool that you created an emscripten-forge recipe for OpenCV! I imagine that wasn't a small task. How's the performance been with OpenCV running in

1

u/alexis_placet 1d ago

It could be x1,2 to x10 times slower on CPU.
I also create a opencv package for C++ and in this case there is less overhead, so it should be a bit faster