Use WebCam Through R

Is there a way to open and click a picture through your webcam with r.

I need it urgently. I just want to know if I can do it in R or NOT. If yes then please tell me how.

I want to open webcam and click and save the picture through R.

Please do reply. any opinion matter.

That is certainly possible with a modern web browser. It happens that I just wrote a blog post yesterday about webcams: https://yihui.name/en/2017/12/html5-camera/ You can read this tutorial to know more technical details, but that is only the first step. The second step is to send the picture to R. You can consider Shiny, although this would require substantial knowledge about Shiny.

2 Likes

Thanks for the reply. Now can you please let me know how to capture a screenshot in SHINY. how can I create the same thing in Shiny webapp.

if possible can I add this js in Shiny directly

Please

While I can't help you with the webcam issue, you can check out the shinyjs package by @daattali to add your js to your shiny app

1 Like

In order to integrate this with a shiny app, you will need to know at least some basic javascript. You'll have to look at the usage documentation of webcamjs and understand it enough to know how to build a minimal page that uses that library. If you know how to do that with plain javascript then shinyjs can indeed make it fairly simple to transfer it into a shiny app. You can look at this example of porting a different javascript library into shinyjs as an example to follow: https://github.com/timelyportfolio/sweetalertR/issues/1#issuecomment-151685005

1 Like

Thanks for the reply but I don't know any JS. Isn't there any package in R to do this kind of stuff. I mean webcam should be a pretty normal thing for any programming right???

That is what I was looking for. But thanks anyways for the reply.

I really appreciate you taking time in writing the response.

thanks again.

I doubt there is a package for it, but maybe. You can go to the CRAN
website that lists all the packages and search for the word webcam or web
cam. Or Google search for "r package webcam". But I've never run into
anyone trying to do that and even if someone did, most people would not go
as far as making a package for it, so it's very likely there is none

I found 2 packages written in base C++ specially for R.

Rvision
ROpenCVLite

I think he was trying to take R into Artificiall inteligence.

But Anyways I found the packages they aren't well maintained but I will find rest from here thanks for help.

more people should look into this thing as well.