#### Archived

This topic is now archived and is closed to further replies.

# Where can i find "Sharpen" codes?

## Recommended Posts

Yes,just like photoshop''s sharpen plugin,i wanna have my own code to process big count bitmap resources in short time and fast way,so i must code my own Sharpen tool.But where can i find a free code or algorithm about "Sharpen",any one helps me? thanks!

##### Share on other sites
TerranFury    142
Sharpen is the opposite of blur. Subtract neighboring pixels from the current pixel instead of adding.

##### Share on other sites
Guest Anonymous Poster
Its all about the convolution matrices, I hate them very much. Blur, sharpen, etc can be done with them. The java 2d tutorial has a section on that. <A HREF="http://java.sun.com/products/jdk/1.2/docs/guide/2d/spec/j2d-image.fm8.html"> Here </A>

##### Share on other sites
LilBudyWizer    491
Here is a nice article by Endar Wiggin on digital filtering. It is from the Articles & Resources on this site under Programming - Graphics - Algorithms and Data Structures.

##### Share on other sites
Beer Hunter    712
[   0     -1/4      0  ][ -1/4      2     -1/4 ][   0     -1/4      0  ]

##### Share on other sites
TerranFury    142
I''ll explain BeerHunter''s post:

The current pixel is the one in the middle of that matrix. Adjacent pixels have corresponding positions in the matrix. The current pixel value is set to be the sum of tha values of all the adjacent pixels, but with the coefficients in the matrix. So what his matrix means is this:

newpixel =    0 * getpixel(x-1, y-1) +           -1/4 * getpixel(x  , y-1) +              0 * getpixel(x+1, y-1) +           -1/4 * getpixel(x-1,   y) +              2 * getpixel(x  ,   y) +           -1/4 * getpixel(x+1,   y) +              0 * getpixel(x-1, y+1) +           -1/4 * getpixel(x  , y+1) +              0 * getpixel(x+1, y+1);

In my first post I told you to subtract the surrounding pixels from the current pixel. This is a way to do that.