Android Camera Real-Time Filter (1), androidcamera

Source: Internet
Author: User

Android Camera Real-Time Filter (1), androidcamera

1. The Android system has built-in filter functions.

Filters have more than 20 different effects, not inferior to those produced by the popular smartphone app Instagram.

 

2. color matrix ColorMatrix

In android, you can use the color matrix (ColorMatrix class) to operate the color. The color matrix is a matrix of 5x4. It can be used to modify the values of each RGBA component in the image. 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 four RGBA channels to directly operate the corresponding color. If Photoshop is used, he will know that sometimes the processing image is made special by controlling the different color channels of RGBA.

The effect of this matrix on color is calculated as follows:


The calculation rule of the matrix is to multiply one row of matrix A by one column of matrix C as A row of matrix R,

The C matrix is the ARGB information contained in the image. The R matrix is a new color component after applying the color matrix to C. The calculation 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: 1st ~ Three columns control the color phase, 4th columns control transparency, and 5th columns control the added value of components.

 

3. Basic filter effects:

If we use ColorMatrix to adjust the proportions of RGB colors, we can achieve effects such as monochrome, black and white.

4. Implementation of the Lomo filter effect:

Change Image value + mask

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.