Android Camera Real-Time Filter (5), androidcamera
Android static filter implementation 1. Review knowledge point 1. Basic filter effect implementation (black and white filter)
The technology used is ColorMatrix. The image imaging effect is changed by changing the RGBA coefficient.
Created with Rapha rjl 2.1.2 Image Bitmap ColorMateix RGB Coefficient Filter Image 2. Implementation of the PS filter effect (reversed color effect, frozen effect, and oil painting effect)
The technology used is to traverse the pixel points of the image and set the RGB primary colors of the pixel points to achieve the PS effect.
Created with Rapha rjl 2.1.2 Image Bitmap Get pixel getPixels The PS algorithm modifies the pixel Color. red/green/blue. Filter Image II. Implementation of static Filters
Based on the accumulated knowledge points, we can improve the implementation of static filters in two aspects.
1. Upgrade the basic filter effect-> implement the pseudo lomo Filter Created with Rapha rjl 2.1.2 Original Image ColorMatrix Processing Overwrite a color lomo image on the processed image Overwrite color lomo Pseudo lomo filter effect
- Step 1: Original Image
- Step 2: ColorMatrix Processing
- Step 3: cover a color lomo image on the processed image
- Step 4: overwrite the color lomo Effect
- Step 5: pseudo lomo filter effect
2. PS filter effect upgraded-> Implementation of the filter for old photos (1) HSL color standard
- The HSL color model is a color standard in the industry. It is based on the colors (H), saturation (S), and brightness (L) the changes of the three color channels and Their superposition to obtain a variety of colors, HSL represents the color, saturation, brightness three channels of color, this standard covers almost all colors that human vision can perceive and is one of the most widely used color systems.
- HSL color mode uses the HSL model to allocate a 0 ~ The intensity value within the range of 255. HSL images only use three channels to mix them in different proportions and reproduce the 16777216 colors on the screen.
- In HSL mode, each HSL component can use a value from 0 to 255. (L is a gradient from Black (0) to white (255 ).
The general idea of the old photo effect is to process the color, saturation, and brightness, rather than the previous red, green, and blue colors.
(2) Algorithm Implementation Created with Rapha rjl 2.1.2 Customize a ColorBalance class (for color balancing) Bitmap Create a search table Color matrix (used for fine-tuning RGB values) Converting images to HSL standards HSL to RGB Alpha obfuscation of negative films