The image special effect processing series will introduce the special effect processing of image pixels. These materials focus on the principle. That is, as long as you knowAlgorithmYou can make the same special effects for C ++, VB, C #, and Java. The following describes the image nostalgia algorithm. The algorithm is as follows:
The above formula means that the RGB values of each pixel are separated first, and then the RGB values are re-calculated as the RGB values of the current vertex according to the preceding three formulas.
See the following:
Original Image:
After processing:
Code:
/*** Nostalgia effect (twice faster than the previous optimization) * @ Param BMP * @ return */private bitmap oldremeber (bitmap BMP) {// speed test long start = system. currenttimemillis (); int width = BMP. getwidth (); int Height = BMP. getheight (); Bitmap bitmap = bitmap. createbitmap (width, height, bitmap. config. rgb_565); int pixcolor = 0; int pixr = 0; int pixg = 0; int pixb = 0; int newr = 0; int newg = 0; int newb = 0; int [] pixels = new int [width * Height]; BMP. Getpixels (pixels, 0, width, 0, 0, width, height); For (INT I = 0; I