Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to capture images from Webcam?

Tags:

javascript

Is there a way to capture images from a webcam with JavaScript?

like image 218
xRobot Avatar asked Mar 18 '10 20:03

xRobot


People also ask

Can we take pictures from webcam?

If your PC has a built-in camera or a connected webcam, you can use the Camera app to take photos and videos. To find the Camera app, select Start > Camera.

How do I take a picture with my Logitech webcam?

Taking Pictures with your Logitech QuickCamDouble-click the Logitech QuickCam icon on your desktop to access the Logitech QuickCam software. NOTE: You can also access the Logitech QuickCam software by double-clicking the icon in your system tray. In the Logitech QuickCam menu bar, click on the Quick Capture button.


3 Answers

Nope - think of the security implications!

It is possible with Flash, but the user will see a popup requesting access to their webcam.

like image 82
Mike Robinson Avatar answered Oct 10 '22 00:10

Mike Robinson


If the webcam had a web interface, then in theory it would be possible to just slap an image tag into a page somewhere and point it directly at the cam's snapshot interface:

<img src="http://address.of.webcam.example.com/webcam/capture" />

But otherwise, no. Standard Javascript has no API for accessing a webcam. There's no

var wc = new WebCam();
img = wc.capture();

type calls you can do.

like image 25
Marc B Avatar answered Oct 10 '22 00:10

Marc B


The situation has changed from when this question was originally posted. The getUserMedia API was introduced to allow things like capturing webcam images. You can find tutorials and plugins demonstrating it.

But MDN now says the Navigator.getUserMedia API is deprecated in favour of the experimental API MediaDevices.getUserMedia. The getUserMedia tutorials and plugins don't work on iOS devices - they just don't support it.

The answer at the moment seems to be that there is an HTML API for it, but browser support is patchy and the API is possibly on its way out. You can only use it in Firefox and IE Edge, and in Chrome only from an https domain.

I would like to revive this question and ask if anyone knows of any web API that will successfully capture webcam images in all major browsers and devices.

like image 28
And Finally Avatar answered Oct 09 '22 23:10

And Finally