Android 5.0 Lollipop new Webcam API

Source: Internet
Author: User

Pre-record: Today I suddenly found out that the project code I just opened had several warnings in eclipse, Camera is deprecated, camera.parameters was deprecated ... and other warnings that have been discarded. A look at official documents originally Google this time Android version update to the camera this piece of new alternative classAndroid.hardware.camera2. This class encapsulates a camera device into a multi-level, linear pipeline with multiple processing stages, which is used to process each frame captured in the input request. When a photo is requested by CAMERA2 to the system, an output packet with a set of image buffers is returned. If multiple requests are processed sequentially, multiple repeated requests are sent only once. using the new API: 1. Get Cameramanager instances to traverse, query, and open a camera object.  2. Research by Cameramanager ObjectGetcameracharacteristics (String) to obtain the Cameracharacteristics object that contains the device's setup information and output parameters. 3. Pre-set each preview object through the Cameracapturesession object, such as size and format, which must be supported by the device, and can call Camera.createcapturesession (List, Cameracapturesession.statecallback, Handler)to obtain this object.
4. Create Surfaceview Ortextureview (via its surfacetexture). Renders the image.   The system is at the bottom or calls Renderscript or opengles, or even native local methods to the data that the instance passes to the view.   5. Construct a Capturerequest object that describes the specific settings for each capture picture. 6. Finally call the capture () method to finish capturing the image.

Precautions :If you fail to open or get a camera object with a Cameramanager object, or if you attempt to connect to an already open device to throw an exception, remember to catch and handle the exception with Cameraaccessexception.



Android 5.0 Lollipop new Webcam API

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.