Posted By

whitetiger on 11/09/06


Tagged

image jpg java filter images Converter RGB j2me gray JAI dilate bit planes


Versions (?)

Java - EdgeW / EdgeH


 / Published in: Java
 

  1. public BufferedImage EdgeW(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. -1f, 0f, 1f,
  7. -2f, 0f, 2f,
  8. -1f, 0f, 1f
  9. });
  10.  
  11. ConvolveOp op = new ConvolveOp(kernel);
  12. op.filter(bi, buff);
  13.  
  14. return buff;
  15. }
  16.  
  17.  
  18. public BufferedImage EdgeH(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, -2f, -1f,
  24. 0f, 0f, 0f,
  25. 1f, 2f, 1f
  26. });
  27.  
  28. ConvolveOp op = new ConvolveOp(kernel);
  29. op.filter(bi, buff);
  30.  
  31. return buff;
  32. }

Report this snippet  

You need to login to post a comment.