background preloader

Face detection using HTML5, javascript, webrtc, websockets, Jetty and OpenCV

Face detection using HTML5, javascript, webrtc, websockets, Jetty and OpenCV
Through HTML5 and the corresponding standards, modern browsers get more standarized features with every release. Most people have heard of websockets that allows you to easily setup a two way communication channel with a server, but one of the specifications that hasn't been getting much coverage is the webrtc specificiation. With the webrtc specification it will become easier to create pure HTML/Javascript real-time video/audio related applications where you can access a user's microphone or webcam and share this data with other peers on the internet. For instance you can create video conferencing software that doesn't require a plugin, create a baby monitor using your mobile phone or more easily facilitate webcasts. Update: in the newest versions of the webrtc spec we can also access the microphone! As with a lot of HTML5 related specification, the webrtc one isn't quite finished yet, and support amongst browsers is minimal. For this we need to take the following steps:

Capturing Audio & Video in HTML5 Many browsers now have the ability to access video and audio input from the user. However, depending on the browser it might be a full dynamic and inline experience, or it could be delegated to another app on the user's device. On top of that, not every device even has a camera. So how can you create an experience that uses a user generated image that works well everywhere? Start simple and progressively If you want to progressively enhance your experience, you need to start with something that works everywhere. Ask for a URL This is the best supported but least satisfying option. Though, if you want to manipulate the image in any way, things are a bit more complicated. File input You can also use a simple file input element, including an accept filter that indicates you only want image files. This method works on all platforms. <input type="file" accept="image/*" id="file-input"><script> const fileInput = document.getElementById('file-input'); Drag and drop Paste from clipboard if (file ! Tips

Camera and Video Control with HTML5 Client-side APIs on mobile and desktop devices are quickly providing the same APIs. Of course our mobile devices got access to some of these APIs first, but those APIs are slowly making their way to the desktop. One of those APIs is the getUserMedia API, providing developers access to the user's camera. The HTML Please read my note about the HTML structure below: <video id="video" width="640" height="480" autoplay></video><button id="snap">Snap Photo</button><canvas id="canvas" width="640" height="480"></canvas> Each of these elements should be created once confirmation of camera support is confirmed, but for the sake of this tutorial, I wanted to show you what the elements look like with basic HTML. The JavaScript Since the HTML elements above are already created, the JavaScript portion will look smaller than you think: Once it's been established that the browser supports getUserMedia, a simple method sets the video element's src to the user's live camera/webcam.

HTML5: camera access Capturing Audio & Video in HTML5 Introduction Audio/Video capture has been the "Holy Grail" of web development for a long time. For many years we've had to rely on browser plugins (Flash or Silverlight) to get the job done. Come on! HTML5 to the rescue. It might not be apparent, but the rise of HTML5 has brought a surge of access to device hardware. This tutorial introduces a new API, navigator.getUserMedia(), which allows web apps to access a user's camera and microphone. The road to getUserMedia() If you're not aware of its history, the way we arrived at the getUserMedia() API is an interesting tale. Several variants of "Media Capture APIs" have evolved over the past few years. I'll try to summarize what happened in 2011... Round 1: HTML Media Capture HTML Media Capture was the DAP's first go at standardizing media capture on the web. If you wanted to let users take a snapshot of themselves with the webcam, that's possible with capture=camera: Recording a video or audio is similar: Kinda nice right? Support: Take a breath.

Related: