I want to extract text from image using
MODI OCR
but getting error while creating MODI document.
My Code:
private static string Scan(string imagePath)
{
MODI.Document md = new MODI.Document();
md.Create(imagePath);
md.OCR(MODI.MiLANGUAGES.miLANG_ENGLISH, true, true);
MODI.Image image = (MODI.Image)md.Images[0];
MODI.Layout layout = image.Layout;
string scanned = string.Empty;
for (int j = 0; j < layout.Words.Count; j++)
{
MODI.Word word = (MODI.Word)layout.Words[j];
string text = word.Text;
var rect = word.Rects;
short Confidence = word.RecognitionConfidence;
scanned += text + " ";
}
md.Close(false);
return scanned;
}
I am getting run time error on md.Create(imagePath);
File extention is .tif and there is no issue with the image.
What will be the reason for this error and how I can solve it?