Embed webcam in Pluto

It was so cool to see a webcam embedded in a Pluto notebook. But as I tried out the codes shown in the screenshot, I got an error saying camera_input not defined. So what is missing here to achieve the same?:thinking::thinking::thinking:

1 Like

Which OS are you using? i assume a camera capture application such as Cheese on Linux or Webcam on windows shows the image from your camera OK?

MacOS. the function camera_input call must be from certain package? tried VideoIO, Images, PlutoUI not them…

Have a look here please Pluto.jl webcam available?
And here
https://github.com/lukavdplas/pluto-notebooks/blob/master/svd.jl

I may be making a fool of myself, but it uses Javascript.
Maybe your browser has some settings which disable image capture for a security reason?

2 Likes

is it meant to work? I just did using Pluto

But doesn’t seem to work

I guess some customized javascript plays the magic… I will close this.

The notebook Grant was using contains the Javascript code for the live webcam.
We are intending to make a version of this notebook available.

2 Likes

It’s defined somewhere else in Grant’s notebook - you need to load the whole notebook for it to work

https://github.com/mitmath/18S191/blob/master/lecture_notebooks/Lecture%201%20-%20Images.jl

1 Like

have you quitted ] mode?

Does this page work for you

1 Like

yes, and the notebook itself contains a detailed definition of camera_input as @fonsp has pointed out.

Thank you all for the help!

@xiaodai You need to run Pluto, and inside the main menu, paste the link to that notebook

using Pluto is never used inside a notebook - it’s used inside the REPL to launch the notebook server

1 Like

I think the other pages help. With this, I need to know how to bind it with Pluto.jl so this needs to be read in conjuction with a Pluto.jl guide.

The kiripa.com link was intended as an independent test that the webcam is functioning and that an image can be read from it. Sorry - I did not make that clear.

I’m also having problems with the webcam in Pluto. I’m running Windows 10, and have checked that my chrome browser has JavaScript enabled. The webcam works fine in Accessing Your Webcam in HTML5.
I’m working on HW1 downloaded from GitHub and all I get for an image is the Enable Webcam image.

I see now that there has been a fix in the last two days on GitHub:
https://github.com/mitmath/18S191/commit/f54733249deadb5ebed71831f4ed23f7b1d82a7d

1 Like

How do I get past the enable webcam image part? I have given the camera permission but grant seems to be using keyboard keys to enable it somehow