1

I use C# with Tesseract Library for recognition temperature value from webcam, that get video stream from Infrared Thermal Imager Screen. I use Tesseract parameter tessedit_char_whitelist and get not bad result, but it's would be improved.

Is it possible to use something like Reg Expression in Tesseract?

In my case, the first digit is always 3 or 4. Then any digit, the separator of the integer and fractional parts "." and any number. There are only 4 signs to recognize. The color and size of the characters does not change. However, the background may change and highlight the numbers if a warm object hits the place where the numbers are displayed.

Tesseract.Rect rCurr = new Tesseract.Rect(x1, y1, w1, h1);
Tesseract.Rect rMax = new Tesseract.Rect(x2, y2, w2, h2);

using (var ocr = new TesseractEngine(@"./tessdata", "eng", EngineMode.TesseractOnly))
{
    ocr.SetVariable("tessedit_char_whitelist", "0123456789.");
    //ocr.SetVariable("editor_image_text_color", "white");

    Bitmap bitMapInput = _imageInput.ToBitmap(); 
    Bitmap bitMapOutput = _imageOutput.ToBitmap();

    var imgIn = PixConverter.ToPix(bitMapInput); 
    var imgOut = PixConverter.ToPix(bitMapOutput);

    using (var page = ocr.Process(imgIn, rCurr, PageSegMode.SparseText))
    {
        SetTextBoxCurrent("Текущ: " + page.GetText());
    }

    using (var page2 = ocr.Process(imgOut, rMax, PageSegMode.SparseText))
    {
        SetTextBoxMax("Макс: " + page2.GetText());
    }
}

Result of OCR1:

Result of OCR2:

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.