Where can i find "Sharpen" codes?

Started by
5 comments, last by darkworldgames 22 years, 4 months ago
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!
a leader of game development studio in china
Advertisement
Sharpen is the opposite of blur. Subtract neighboring pixels from the current pixel instead of adding.
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>
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.
Keys to success: Ability, ambition and opportunity.
[   0     -1/4      0  ][ -1/4      2     -1/4 ][   0     -1/4      0  ] 
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.
Thanks for your responses.
I can code it now
a leader of game development studio in china

This topic is closed to new replies.

Advertisement