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)