-2
A
回答
0
public void test(int x, int y){ // Here x and y are the parameter thrown by mouseDragged() function
blur1 = displayImage; // blur1 is Image variable
blur2 = new BufferedImage(blur1.getWidth(this), blur1 //blur2 is BufferedImage Variable
.getHeight(this), BufferedImage.TYPE_INT_RGB);
tst = blur2.createGraphics(); // tst is Graphics2D variable
tst.drawImage(blur1, 0, 0, this);
blur3 = new BufferedImage(blur1.getWidth(this), blur1 //blur3 is BufferedImage Variable
.getHeight(this), BufferedImage.TYPE_INT_RGB);
float data[] = { 0.0625f, 0.125f, 0.0625f, 0.125f, 0.25f, 0.125f,
0.0625f, 0.125f, 0.0625f };
Kernel kernel = new Kernel(3, 3, data);
ConvolveOp convolve = new ConvolveOp(kernel, ConvolveOp.EDGE_NO_OP,
null);
blur2 = OSC.getSubimage(x, y, 20, 20); // 20 is the size in pixels where the effect is applied
blur3 = OSC.getSubimage(x, y, 20, 20);
convolve.filter(blur2, blur3);
Graphics osg = OSC.getGraphics();
osg.setColor(fillColor);
osg.drawImage(blur3,x,y,null);
osg.dispose();
repaint();
}
0
看這裏: http://www.java2s.com/Code/Java/2D-Graphics-GUI/ImageEffectSharpenblur.htm
您需要定義一個數組你想要的任何值內核,實例化用的ConvolveOp的籽粒作爲參數,然後篩選所需的圖像。
相關問題
- 1. 鼠標懸停的圖像模糊圖像和顯示文字
- 2. 如何模糊iframe以模糊圖像?
- 3. 如何模糊圖像?
- 4. 將鼠標懸停在圖像上進行縮放和模糊
- 5. 鼠標向下,鼠標移動和鼠標事件的圖像?
- 6. 圖像模糊
- 7. 模糊圖像
- 8. 模糊的圖像
- 9. 模糊的圖像
- 10. 運動模糊圖像的去模糊
- 11. 圓形圖標圖像模糊
- 12. 如何在下載時模糊圖像? (像Facebook一樣)
- 13. 與模糊圖像
- 14. setImageDrawable圖像模糊
- 15. Fabric.js圖像模糊
- 16. 去模糊圖像
- 17. C#模糊圖像
- 18. Android模糊圖像
- 19. 如何在圖像變得模糊的情況下拉伸ImageButton?
- 20. iOS標籤項目模糊圖像
- 21. Android圖標爲像素化/模糊
- 22. ios:如何用CGPath模糊圖像?
- 23. 檢測圖像如何模糊
- 24. WPF圖像,如何去除模糊?
- 25. 如何檢查模糊圖像?
- 26. 當鼠標懸停在圖標上時,按鈕文字模糊
- 27. 的RenderTransform RotateTransform模糊圖像
- 28. 對圖像的javascript模糊
- 29. GD模糊的圖像Opencart
- 30. Tmux - 模糊選項:鼠標錯誤
我剛剛使用java.awt.image.ConvolveOp模糊了整個圖像。 – ppst99
「你有什麼嘗試?」,換句話說,**你可以在這裏粘貼你試過的代碼嗎?** – BackSlash
1)爲了更好地幫助,請發佈[SSCCE](http://sscce.org/)。 2)解決方案可能是繪製清晰的圖像,然後將剪輯應用到鼠標下的區域並繪製模糊的圖像。 –