I want to read the text from image file of any format like .jpg,.png,.tif...
By using the following code Iam unable to read tha text in the correct format and also iam getting some error for different image formats..
And this code is unable to read Cursive Writing images and Large images..
Can any one Suggest me the proper code or y am getting that errors..
private void readtext_Click(object sender, EventArgs e)
{
MODI.Document doc = new MODI.Document();
doc.Create(getFileName); // Here am getting File Sharing Voilation error for .tiff images
doc.OCR(MODI.MiLANGUAGES.miLANG_ENGLISH, true, true); // Here for some image formats am getting OCR running error
MODI.Image img = (MODI.Image)doc.Images[0];
MODI.Layout layout = img.Layout;
FileStream createFile = new FileStream(getFileName + ".txt", FileMode.CreateNew);
//save the image text in the text file
StreamWriter writeFile = new StreamWriter(createFile);
writeFile.Write(img.Layout.Text);
writeFile.Close();
for (int i = 0; i < layout.Words.Count; i++)
{
MODI.Word word = (MODI.Word)layout.Words[i];
if (extractedText.Length > 0)
{
extractedText += " ";
}
extractedText += word.Text;
richTextBox1.Text = extractedText;
}
}
Sukhdeep PatelPosted Mar 20, 2014, 1:13 PM
http://social.msdn.microsoft.com/Forums/office/en-US/29093b50-1f09-4b5e-9f41-c0f4a540852f/using-modi-microsoft-office-document-imaging-how-to-get-images-and-table-in-text-file?forum=worddev
Regarding the ability to generate the correct OCR results, the majority of OCR engines only support OCR for plain-text, so using the engine with "Cursive Writing" images will not give good results.
As a general thought, OCR engines give the best results for black and white images. The accuracy of the OCR engine depends mainly on the image itself. For example, the quality of the image, the number of colors in the images, the resolution of the images..etc.