Sharpening Effect of special image effects in Android system

Source: Internet
Author: User

I made an image browser and used some image processingAlgorithm, This is part of the APK installation package address: http://static.apk.hiapk.com/html/2012/08/797656.html, welcome to download and feedback;

Sharpening Effect of special image effects in Android system

Public static bitmap sharpenimageameliorate (softreference <bitmap> BMP) {// Laplace matrix int [] Laplacian = new int [] {-1,-1,-1,-1, 9, -1,-1,-1,-1}; Final int width = BMP. get (). getwidth (); Final int Height = BMP. get (). getheight (); Bitmap bitmap = bitmap. createbitmap (width, height, bitmap. config. rgb_565); int pixr = 0; int pixg = 0; int pixb = 0; int pixcolor = 0; int newr = 0; int newg = 0; int newb = 0; int idx = 0; float alpha = 0.3f; int [] pixels = new int [width * Height]; BMP. get (). getpixels (pixels, 0, width, 0, 0, width, height); // BMP. recycle (); // BMP = NULL; For (INT I = 1, length = height-1; I <length; I ++) {for (int K = 1, len = width-1; k <Len; k ++) {idx = 0; For (int m =-1; m <= 1; m ++) {for (INT n =-1; n <= 1; n ++) {pixcolor = pixels [(I + n) * width + K + M]; pixr = color. red (pixcolor); pixg = color. green (pixcolor); pixb = color. blue (pixcolor); newr = newr + (INT) (pixr * Laplacian [idx] * alpha); newg = newg + (INT) (pixg * Laplacian [idx] * alpha); newb = newb + (INT) (pixb * Laplacian [idx] * alpha); idx ++;} newr = math. min (255, math. max (0, newr); newg = math. min (255, math. max (0, newg); newb = math. min (255, math. max (0, newb); pixels [I * width + k] = color. argb (255, newr, newg, newb); newr = 0; newg = 0; newb = 0 ;}} bitmap. setpixels (pixels, 0, width, 0, 0, width, height); Return bitmap ;}

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.