Android Camera Real-Time Filter (8) and androidcamera

Source: Internet
Author: User

Android Camera Real-Time Filter (8) and androidcamera
1. What can Android Camera do?1. Functions

  • Take a photo
  • Video Recording
  • Viewfinder (scanning applications, such as face recognition, business card recognition, and bar code recognition)
2. Implement your own Camera program based on the Camera API. There are 7 steps in total. Created with Rapha rjl 2.1.2 1. initialize SurfaceHolder 2. Camera instance SurfaceCreated 3. Callback SurfaceChanged 4. Clear SurfaceDestroyed 5. layout SurfaceView 6. Add a photo button Ii. What is Camera Preview?


The RAW data returned by the camera is processed by the isp to form the yuv data. The android system draws the data to the framing area, and continuously draws the frame data to form the Real-Time Preview data.

3. How to obtain data in the Camera Preview?
  • Camera. PreviewCallback
  • SetPreviewCallback
    When a new preview frame is displayed on the screen, the onPreviewFrame method is called (obtained from time to time)
  • SetPreviewCallbackWithBuffer
    It works in the same way as setPreviewCallback, but requires a specified number of bytes.
    A group is used as a buffer to preview image data (addCallbackBuffer)
4. How does Android Camera Real-Time Filter work? Created with Rapha rjl 2.1.2 0. Set the scenic spot size to 1 pixel. 1. Obtain the preview frame data yuv from the Scenic Spot 2. The obtained YUV420SP and RGB are converted. 3. Filter Algorithm Rendering 4. Draw the processed layer on the screen.

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

Problem
1. Choppy screen, low user experience
2. Low performance, affecting system performance

How to optimize it?
-Increase the stream level
Image Rendering using OpenGL ES SurfaceTexture
-Improve Performance
GPU Optimization

Related Article

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.