1, Android system will be built-in filter function
The filter feature has more than 20 different effects, not less than the effects of Instagram , the most popular smartphone app .
2. Color Matrix ColorMatrix
The color matrix is a 5x4 matrix that can be manipulated by the color matrix (ColorMatrix Class) in Android. It can be used to modify the values of the RGBA components in the image , and the color matrix is stored as a one-dimensional array as follows:
[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, p, Q, R, S, T]
He uses the Rgba Four channels to directly manipulate the corresponding color, if you will use Photoshop will know sometimes processing pictures by controlling the rgba Each color channel to make a special effect.
The effect of this matrix on color is calculated as follows:
The rule of the matrix is that a row of matrix a is multiplied by a column of Matrix C as a row of the matrix R .
The c matrix is the ARGB information contained in the picture , andtheR matrix is a new color component that is applied to C after the color matrix , and the result is as follows:
R ' = a*r + b*g + c*b + d*a + E;
G ' = f*r + g*g + h*b + i*a + j;
B ' = k*r + l*g + m*b + n*a + o;
A ' = p*r + q*g + r*b + s*a + t;
Ps: the 1th to 3rd column controls the hue, the 4th column controls the transparency, and the 5th column is the increment value of the component.
3, the basic filter effect implementation:
If we use ColorMatrix to adjust the proportion of RGB Three color, we can achieve such as monochrome, black and white effect.
4, Lomo Filter Effect of the implementation:
Change image value + mask
Android Camera Live Filter (i)