Implementation of Camera Real-Time Filter on Android platform (9) -- Exploring skin polishing algorithm (1)

Source: Internet
Author: User

Implementation of Camera Real-Time Filter on Android platform (9) -- Exploring skin polishing algorithm (1)

The previous article mentioned some de-noise algorithms that can be used for skin polishing. Below we will implement these algorithms and observe the results, so we will not consider the real-time issue.

First, this article discusses "Image Denoising Based on Local Mean Square correlation information and Its Application in real-time skin polishing algorithms"

This algorithm uses the local statistical feature of the image for filtering. For example, the NXM pixel grayscale image calculates the window (the size is (2n + 1) where the vertex (I, j) is located) (2 m + 1) Average m (I, j)

And mean variance:

The result is as follows:

Where:

1. According to the optimization method proposed in the original article, the first step is to establish two integral graphs. The algorithm for creating integral graphs can be simply optimized by referring to this article. Then, the m value and v value in the formula can be calculated based on the Integral graph. For example, m (I, j) of a window with a radius of r is Integral (I + r, j + r) + Integral (i-r-1, j-r-1)-Integral (I + r, j-r-1)-Integral (i-r-1, j + r)

Void merge: initIntegral (uint32_t * inputMatrix, int width, int height, int mode) {LOGE ("initIntegral start"); uint64_t * outputMartix = new uint64_t [width * height]; uint64_t * outputMartixSqr = new uint64_t [width * height]; uint64_t * columnSum = new uint64_t [width]; uint64_t * columnSumSqr = new uint64_t [width]; int color = (inputMatrix [0]> mode) & 0xff); columnSum [0] = color; columnSumSqr [0] = color * color; outputMartix [0] = columnSum [0]; outputMartixSqr [0] = columnSumSqr [0]; for (int I = 1; I <width; I ++) {int color = (inputMatrix [I]> mode) & 0xff); columnSum [I] = color; columnSumSqr [I] = color * color; outputMartix [I] = columnSum [I]; outputMartix [I] + = outputMartix [I-1]; outputMartixSqr [I] = columnSumSqr [I]; outputMartixSqr [I] + = outputMartixSqr [I-1];} for (int I = 1; I 2. Calculate the RGB value of each pixel based on the formula.
For (int I = 0; I 

: The intensity of skin polishing is up to 10.


 

Next, you can modify the contrast, skin whitening, and other operations on the image.

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.