Click here to Skip to main content
15,885,985 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how can I take a text from image I have code in ocr but it's not run it's broken in the line
C#
modiDocument.OCR(MiLANGUAGES.miLANG_ENGLISH);


it's all my code

C#
private void button1_Click(object sender, EventArgs e)
{
    //string filePath = Server.MapPath("~/Uploads/" + Path.GetFileName(FileUpload1.PostedFile.FileName));
    //FileUpload1.SaveAs(filePath);
    string filePath = ("image\an91cut.jpg");
    string extractText = this.ExtractTextFromImage(filePath);
    label1.Text = extractText.Replace(Environment.NewLine, "<br />");
}

private string ExtractTextFromImage(string filePath)
{
    Document modiDocument = new Document();
  
    modiDocument.Create("C:\\Users\\אפרת\\Desktop\\oo.png");
    modiDocument.OCR(MiLANGUAGES.miLANG_ENGLISH);
    MODI.Image modiImage = (modiDocument.Images[0] as MODI.Image);
    string extractedText = modiImage.Layout.Text;
    modiDocument.Close();
    return extractedText;
}
Posted
Updated 9-Sep-14 1:09am
v3
Comments
George Jonsson 9-Sep-14 7:12am    
What is the error message?
And you should check if modiDocument.Images has any images before using the variable.

1 solution

 
Share this answer
 
Comments
Gihan Liyanage 15-Sep-14 6:29am    
Did you got a solution from my support, I can see you have not accepted any answer.If you are ok with this answer plz accept it. Then any user having same problem can identified it has solved the problem..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900