How to read a text from an Image file?
I need to read a Text(Account Number) from a image file (.tif).
I tried the following approach :
But it was throwing problem. After googling, I found that ImageIO has some limitation to read an editable image.
Then, I tried the following approach :
Code Java:
try{File newFile=new File("C:\\Image\\9R6-CCI\\09082010\\K08E091209FT_8033.tif");
byte[] fileData = new byte[ (int)newFile.length()];
InputStream inStream = new FileInputStream( newFile);
inStream.read(fileData);
inStream.close();
String tempFileData = new String(fileData);
String imageString=new BASE64Encoder().encode(fileData); }catch (Exception e){}
But i did n't get the desired out put . The Out put is as below.
xTFMUxTFMUxTFMUxTFMUxTFMUxTFMUxTFMUxTFMUxTFMUxTFMU xTFMUxTFMUxTFMUxTFMUxTFMUx
Please, help me to address the issue.
Thanks and Regards
Gautam
Re: How to read a text from an Image file?
I don't see how you can "read" text from an image file. Can you explain? How was the image file created?
Are you talking about scanning an image for "letters" as in character recognition.
Re: How to read a text from an Image file?
The text of an image isn't stored in an easily accessible way for the computer to recognize. You'll need a text recognition algorithm to help you decipher what the text is. Do note that if the text is hand-written, or was generated to be illegible (but still readable by a human reader), you will get inaccurate results as this is still an open area of research in computer science.
Re: How to read a text from an Image file?
The Java Advanced Imaging package should be able to read tiff files. I'm not sure there is a method that allows you to read out any header data if this is what you need. You may want to look into this package and see, try and find another package which will help, or consider writing your own tiff parser (you need to closely inspect the file format for this option, just reading in the file might not cut it)
Re: How to read a text from an Image file?
Hi Gautam,
Please let me know for any solution you found on this at yeddu.lakshmana@gmail.com.
Thanks,
Lakshman