Java-ImageFilter简单

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Java-ImageFilter简单相关的知识,希望对你有一定的参考价值。

  1. public BufferedImage Embrossing(BufferedImage bi)
  2. {
  3. BufferedImage buff = new BufferedImage(bi.getWidth(), bi.getHeight(), bi.getType());
  4.  
  5. Kernel kernel = new Kernel(3, 3, new float[] {
  6. -2f, 0f, 0f,
  7. 0f, 1f, 0f,
  8. 0f, 0f, 2f
  9. });
  10.  
  11. ConvolveOp op = new ConvolveOp(kernel);
  12. op.filter(bi, buff);
  13.  
  14. return buff;
  15. }
  16.  
  17.  
  18. public BufferedImage Blurring(BufferedImage bi)
  19. {
  20. BufferedImage buff = new BufferedImage(bi.getWidth(), bi.getHeight(), bi.getType());
  21.  
  22. Kernel kernel = new Kernel(3, 3, new float[] {
  23. 1f/9f, 1f/9f, 1f/9f,
  24. 1f/9f, 1f/9f, 1f/9f,
  25. 1f/9f, 1f/9f, 1f/9f
  26. });
  27.  
  28. ConvolveOp op = new ConvolveOp(kernel);
  29. op.filter(bi, buff);
  30.  
  31. return buff;
  32. }
  33.  
  34.  
  35. public BufferedImage Sharpening(BufferedImage bi)
  36. {
  37. BufferedImage buff = new BufferedImage(bi.getWidth(), bi.getHeight(), bi.getType());
  38.  
  39. Kernel kernel = new Kernel(3, 3, new float[] {
  40. -1f, -1f, -1f,
  41. -1f, 9f, -1f,
  42. -1f, -1f, -1f
  43. });
  44.  
  45. ConvolveOp op = new ConvolveOp(kernel);
  46. op.filter(bi, buff);
  47.  
  48. return buff;
  49. }

以上是关于Java-ImageFilter简单的主要内容,如果未能解决你的问题,请参考以下文章

简单介绍AngularJs Filters

jsp简单的filter使用

struts2jsp的简单路径的简单拦截

Filter过滤器简单学习

Spring Boot实战之Filter实现简单的Http Basic认证

DirectShow Filter 基础与简单的示例程序