C# MODI ERROR: OCR text in image

0

My app use OCR (modi SharePoint 2017) on a list images for return all images that contains this text. It's work, but the app bug and stop at a time. Ex: I selected 32.000 images and I call the method, for some hours it's working and at a time it's stop and I don't know why. The app raise 8 errors before stop and when I restart on a image where error is appeared, it's work.

try
{
    modiDocument = new Document();
    modiDocument.Create(filePath);
    modiDocument.OCR(MiLANGUAGES.miLANG_FRENCH, false, false);

    MODI.Image modiImage = (modiDocument.Images[0] as MODI.Image);
    string extractedText = modiImage.Layout.Text;

    return extractedText;               
}
catch (Exception ex)
{                
   Console.WriteLine(
        "Une exception a eu lieu : {0}.",
        ex.Message);
    writeFileBug(filePath);
    return null;

}
finally
{
    modiDocument.Close();
}

The errors:

Exception levée : 'System.Runtime.InteropServices.COMException' dans teste ocr.exe
Une exception a eu lieu : OCR running error.
Exception levée : 'System.Runtime.InteropServices.COMException' dans teste ocr.exe
Une exception a eu lieu : OCR running error.
Exception levée : 'System.Runtime.InteropServices.COMException' dans teste ocr.exe
Une exception a eu lieu : OCR running error.
Exception levée : 'System.Runtime.InteropServices.COMException' dans teste ocr.exe
Une exception a eu lieu : OCR running error.
Exception levée : 'System.Runtime.InteropServices.COMException' dans teste ocr.exe
Une exception a eu lieu : OCR running error.
Exception levée : 'System.Runtime.InteropServices.COMException' dans teste ocr.exe
Une exception a eu lieu : OCR running error.
Exception levée : 'System.Runtime.InteropServices.COMException' dans teste ocr.exe
Une exception a eu lieu : OCR running error.
Exception levée : 'System.Runtime.InteropServices.COMException' dans teste ocr.exe
Une exception a eu lieu : OCR running error.
Le programme '[15152] teste ocr.vshost.exe' s'est arrêté avec le code -1073740791 (0xc0000409).
c#
image
sharepoint
ocr
modi
asked on Stack Overflow Dec 16, 2017 by emeliku • edited Dec 16, 2017 by Souvik Ghosh

1 Answer

0

The error you're getting -1073740791 (0xc0000409) indicates a buffer overflow.(source)

Check if any other of the objects being created in your code need to be disposed in your finally block.

answered on Stack Overflow Dec 16, 2017 by John M. Wright

User contributions licensed under CC BY-SA 3.0