![]() The Camera flash (device light) can be accessed via FillLightMode in PhotoCapabilities, but the Torch mode (flash constantly on) can be found in the MediaTrackCapabilities. Find out more about the API from Paul Kinlan's blog post. The Shape Detection API works well with Image Capture: grabFrame() can be called repeatedly to feed ImageBitmaps to a FaceDetector or BarcodeDetector. The WebRTC resolution constraint demo shows how to set getUserMedia() constraints for resolution. ![]() In other words, you may not be able to access the full resolution capabilities of your device when saving from getUserMedia() to a canvas. Note that the minimum and maximum width and height constraints for getUserMedia() are for video, which (as discussed) may be different from the camera capabilities for still images. The full range of available camera resolutions for still images can be get and set using the MediaSettingsRange values for PhotoCapabilities.imageHeight and imageWidth. CSS, of course, is used to set the display size of both. In this demo, the dimensions are set to the resolution of the video stream, whereas the natural size of the is the maximum still-image resolution of the camera. More information can be found in the README.md section. Previously, it was only possible to 'take a photo' by calling drawImage() on a canvas element, using a video as the source (as per the example here). In essence, this means that takePhoto() gives access to the full still-image resolution capabilities of the camera. GrabFrame() just takes the next available VideoFrame in the MediaStreamTrack inside the renderer process, whereas takePhoto() interrupts the MediaStream, reconfigures the camera, takes the photo (usually in a compressed format, hence the Blob) and then resumes the MediaStreamTrack. The takePhoto() method gives access to the camera's maximum resolution. If you run the code above, you'll notice a difference in dimensions between the grabFrame() and takePhoto() results. error ( 'Uh, oh, takePhoto() error:', error ) ) # Camera capabilities The Image Capture API gets access to a camera via a MediaStreamTrack obtained from getUserMedia(): navigator. The API has then two capture methods takePhoto() and grabFrame() and ways to retrieve the capabilities and settings of the camera, and to change those settings. ![]() Previous techniques for taking photos on the Web have used video snapshots, which are lower resolution than that available for still images.Īn ImageCapture object is constructed with a MediaStreamTrack as source. Best of all, Image Capture allows you to access the full resolution capabilities of any available device camera or webcam. ![]() The API enables control over camera features such as zoom, brightness, contrast, ISO and white balance. We've also published an ImageCapture polyfill library. This API is available in Chrome 59 on Android and desktop. Image Capture is an API to capture still images and configure camera hardware settings. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |