Android Camera Live Filter (eight)

Source: Internet
Author: User
Tags linecap

one, what can Android camera do? 1. function
    • Take photos
    • Video recording
    • Viewfinder (scanning applications such as face recognition, business card recognition, barcode recognition)
2, according to the camera API to achieve their own photo program, a total of 7 steps Created with Rapha?l 2.1.2 1. Initialize Surfaceholder 2. Camera Instance surfacecreated 3. Callback Surfacechanged 4. Cleaning surfacedestroyed 5. Layout Surfaceview 6. Button to add the camera button second, what is Camera preview?


The raw data returned by the camera is processed by the ISP to form YUV data, and the Android system draws the data to the scenic area and continuously draws the frame data to form the real-time preview data.

third, how to get the data in Camera preview?
    • Camera.previewcallback
    • Setpreviewcallback
      Call the Onpreviewframe method when a new preview frame is displayed on the screen (get it at all times)
    • Setpreviewcallbackwithbuffer
      It works the same way as setpreviewcallback, but requires a specified number of bytes
      Group as a buffer for previewing image data (Addcallbackbuffer)
Iv. How does the Android Camera live filter work? Created with Rapha?l 2.1.2 0. Set the area size to 1 pixels 1. Take the scenic area to get preview frame data YUV 2. Get the YUV420SP and RGB to convert 3. Render the filter algorithm 4. Draw the processed layer on the screen

YUV to RGB algorithm, the conversion formula is generally as follows, is also a linear relationship:
R = Y + 1.14V
G = y-0.39u-0.58v
B = Y + 2.03U

Problem
1, screen lag, low user experience
2, low performance, affect system performance

How to optimize?
- increase flow level
Image rendering using OpenGL ES Surfacetexture
- Lift Performance
GPU Optimization

Android Camera Live Filter (eight)

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.