DEV Community

El Bruno for Microsoft Azure

Posted on β€’ Originally published at elbruno.com on

7

#OpenCV – Access to a camera in a Jupyter Notebook with #Python 🐍

Hi !

Super quick post today, with an answet to a question that we had last week in one of our Reactor Sessions:

Can we access to a camera 🀳 while I’m coding in a Jupter Notebook?

So, the answer is YES. Here is a sample:

vscode jupyter notebooks accesing a camera using open cv

And as usual, let’s share some code and some notes to test this.

  • I’m coding this sample using Visual Studio Code and the Jupyter Notebook extension (link)
  • I’m accesing camera 2 on my devices, I have several cameras.
  • I’m using matpotlib to show the image, from an OpenCV Mat. This is super cool, it automatically understand Mat().
  • Important: remember to release the camera at the end!

And here is the code:

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Happy coding!

Greetings

El Bruno

More posts in my blog ElBruno.com.


Heroku

This site is built on Heroku

Join the ranks of developers at Salesforce, Airbase, DEV, and more who deploy their mission critical applications on Heroku. Sign up today and launch your first app!

Get Started

Top comments (0)

AWS Security LIVE!

Join us for AWS Security LIVE!

Discover the future of cloud security. Tune in live for trends, tips, and solutions from AWS and AWS Partners.

Learn More

πŸ‘‹ Kindness is contagious

Please leave a ❀️ or a friendly comment on this post if you found it helpful!

Okay