Unknown source for ConvolveOp
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Tommaso_Agostinacchio
Posted On:   Monday, February 11, 2008 08:57 AM

Hi all! I found and try to adapt this code: public final float[] BLUR3x3 = { 0.1f, 0.1f, 0.1f, // low-pass filter kernel 0.1f, 0.2f, 0.1f, 0.1f, 0.1f, 0.1f }; This is a class i write to performe a blur proceccing to the loades image: public void Blur_actionPerformed(ActionEvent e) { float[] data = BLUR3x3; if (g_rast != null) { Graphics2D l_g2 = (Graphics2D) image.getGraphics(); ConvolveOp cop = new ConvolveOp(new Kernel(3, 3, data)); l_g2.drawImage(image.image2, cop, 0, 0); image.repaint(); }    More>>

Hi all!



I found and try to adapt this code:



public final float[] BLUR3x3 = {

0.1f, 0.1f, 0.1f, // low-pass filter kernel

0.1f, 0.2f, 0.1f,

0.1f, 0.1f, 0.1f

};

This is a class i write to performe a blur proceccing to the
loades image:



public void Blur_actionPerformed(ActionEvent e)

{

float[] data = BLUR3x3;

if (g_rast != null)

{

Graphics2D l_g2 = (Graphics2D) image.getGraphics();

ConvolveOp cop = new ConvolveOp(new Kernel(3, 3, data));

l_g2.drawImage(image.image2, cop, 0, 0);

image.repaint();

}

}



and ImageClass image;

BufferedImage image2;

ImageClass is a file that extends Component and declares
BufferedImage image2;


I have this problem: when I run my program I see these messages:



Exception in thread "AWT-EventQueue-0"
java.awt.image.ImagingOpException: Unable to convolve src image

at java.awt.image.ConvolveOp.filter(Unknown Source)

at sun.java2d.d3d.D3DDrawImage.transformImage(Unknown Source)

at sun.java2d.pipe.ValidatePipe.transformImage(Unknown Source)

at sun.java2d.SunGraphics2D.drawImage(Unknown Source)

at nuovo.Frame1.Blur_actionPerformed(Frame1.java:183)

at nuovo.Frame1_Blur_actionAdapter.actionPerformed(Frame1.java:413)

at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)

at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)

at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)

at javax.swing.DefaultButtonModel.setPressed(Unknown Source)

at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)

at java.awt.Component.processMouseEvent(Unknown Source)

at javax.swing.JComponent.processMouseEvent(Unknown Source)

at java.awt.Component.processEvent(Unknown Source)

at java.awt.Container.processEvent(Unknown Source)

at java.awt.Component.dispatchEventImpl(Unknown Source)

at java.awt.Container.dispatchEventImpl(Unknown Source)

at java.awt.Component.dispatchEvent(Unknown Source)

at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)

at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)

at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)

at java.awt.Container.dispatchEventImpl(Unknown Source)

at java.awt.Window.dispatchEventImpl(Unknown Source)

at java.awt.Component.dispatchEvent(Unknown Source)

at java.awt.EventQueue.dispatchEvent(Unknown Source)

at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)

at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)

at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)

at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

at java.awt.EventDispatchThread.run(Unknown Source)



Can anyone help me, please?



Tom

   <<Less
About | Sitemap | Contact