Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.Color;
- protected Color[] grayLevels() {
- Color[] grayLevels = new Color[256];
- for (int i = 0; i < 256; i++)
- grayLevels[i] = new Color(i, i, i);
- return grayLevels;
- }
- public Color[][] filter(Color[][] inPixels, String parameter) {
- int height = inPixels.length;
- int width = inPixels[0].length;
- short[][] inIntensity = computeIntensity(inPixels);
- Color[][] outPixels = new Color[height][width];
- Color[] grayLevels = grayLevels();
- for (int i = 0; i < height; ++i)
- for (int j = 0; j < width; ++j)
- outPixels[i][j] = grayLevels[inIntensity[i][j]];
- return outPixels;
- }
Add Comment
Please, Sign In to add comment