Results 1 to 4 of 4
Thread: Image filter Assignment help
- 12-11-2010, 02:20 AM #1
Member
- Join Date
- Dec 2010
- Posts
- 2
- Rep Power
- 0
Image filter Assignment help
For my assignment I have to create an emboss filter class and a test program which displays the original image and filtered image.
This is my test code
Im getting errors for this line in the test codeJava Code:// import java.io.*; import java.awt.image.BufferedImage; import javax.imageio.ImageIO; import java.io.File; import java.io.IOException; import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.SwingUtilities; import javax.swing.JOptionPane; import java.awt.image.Kernel; import java.awt.image.ConvolveOp; public class FilterTest{ public static void main(String[] args) throws IOException { MyEmbossFilter Filter1= new MyEmbossFilter(); //Read in image BufferedImage img=null; File imgFile=new File("C:\\Users\\tommy\\Documents\\college2010\\software\\lab5\\Color.jpg"); try { img=ImageIO.read(imgFile); } catch(IOException e) { e.printStackTrace(); } //Display image ImageIcon icon=new ImageIcon(img); JLabel label=new JLabel(icon); final JFrame f=new JFrame("Image Display1"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.getContentPane().add(label); f.pack(); SwingUtilities.invokeLater(new Runnable() { public void run() { f.setLocationRelativeTo(null); f.setVisible(true); } } ); //Apply filter to image Filter1.Apply(BufferedImage img2); System.out.println("\ndebug 5 \n"); //Display filtered image ImageIcon icon2= new ImageIcon(img2); JLabel label2=new JLabel(icon2); final JFrame f2= new JFrame("Image Display2"); f2.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f2.getContentPane().add(label); f2.pack(); SwingUtilities.invokeLater(new Runnable() { public void run() { f2.setLocationRelativeTo(null); f2.setVisible(true); } } ); } }
Filter1.Apply(BufferedImage img2);
Errors:
1. ')' expected
2. illegal start of expression
What am I doing wrong here?
Is there something missing out of my test program?Last edited by tommy9avh; 12-12-2010 at 01:19 PM.
- 12-11-2010, 02:41 AM #2
Moderator
- Join Date
- Feb 2009
- Location
- New Zealand
- Posts
- 4,561
- Rep Power
- 11
Java Code:Filter1.Apply(BufferedImage img2);
The error occurs because you should not mention the type of img2 when you call the method.
- 12-11-2010, 03:21 AM #3
Member
- Join Date
- Dec 2010
- Posts
- 2
- Rep Power
- 0
Hi pbrockway2
How would I use my Apply(); function to filter the image?
I then display the filtered image. Is my test ok or does anything need to be changed?
- 12-11-2010, 03:30 AM #4
Moderator
- Join Date
- Feb 2009
- Location
- New Zealand
- Posts
- 4,561
- Rep Power
- 11
Similar Threads
-
servlet filter
By redforce.bala in forum Java ServletReplies: 3Last Post: 10-07-2010, 09:21 AM -
data filter
By karq in forum Java ServletReplies: 3Last Post: 10-07-2010, 05:40 AM -
web content filter or internet filter
By sundarjothi in forum Advanced JavaReplies: 3Last Post: 05-15-2008, 11:36 AM -
Need a filter
By revathi17 in forum New To JavaReplies: 1Last Post: 08-08-2007, 07:37 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks