Hi.
I am trying to create an OCR where it will take an image and recognize the contents into a text file. Right now, the code that I have compiled is working nicely except for the output. The output is not written properly to the text file upon execution for unknown reason. I left the code with initial state where the output will be written back into an image file.
I hope someone can clarify based on the code below and help me to solve the problem. Here's the code:
package assignment10; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import java.io.*; import java.util.Arrays; import javax.imageio.ImageIO; public class A10Driver { /** * @param args * @throws IOException */ public static void main(String[] args) throws IOException { String name = "Translation_Standard_Galactic_Alphabet.png"; double factor = 0.3; System.out.println(Arrays.toString(args)); // if(args.length < 1){ // System.out.println("Usage: java -jar Filename.jpg"); // System.out.println("Exiting ..."); // System.exit(0); // } // // // String name = args[0]; // double factor = Double.parseDouble(args[1]); String[] arr = name.split("\\."); String format = arr[1]; BufferedImage image = ImageIO.read(new File(name)); BoundaryFilterOp bOp = new BoundaryFilterOp(factor); BufferedImage bImg = bOp.filter(image, null); // IPUtil.displayMatrix(IPUtil.readImageAsMatrix(image)); File file = new File("boundaryFilter-"+name); ImageIO.write(bImg, format, file); } }
Hope for kind replies. Thanks in advance!