Guest User

Untitled

a guest
Feb 21st, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. import java.awt.Color;
  2.  
  3. protected Color[] grayLevels() {
  4. Color[] grayLevels = new Color[256];
  5.  
  6. for (int i = 0; i < 256; i++)
  7. grayLevels[i] = new Color(i, i, i);
  8.  
  9. return grayLevels;
  10. }
  11.  
  12. public Color[][] filter(Color[][] inPixels, String parameter) {
  13. int height = inPixels.length;
  14. int width = inPixels[0].length;
  15.  
  16. short[][] inIntensity = computeIntensity(inPixels);
  17. Color[][] outPixels = new Color[height][width];
  18. Color[] grayLevels = grayLevels();
  19.  
  20. for (int i = 0; i < height; ++i)
  21. for (int j = 0; j < width; ++j)
  22. outPixels[i][j] = grayLevels[inIntensity[i][j]];
  23.  
  24. return outPixels;
  25. }
Add Comment
Please, Sign In to add comment