From b15e244a8b67f8f93fb07d99bf9b804b86792864 Mon Sep 17 00:00:00 2001 From: "oriahulrich@microvu.com" Date: Thu, 23 Oct 2014 15:53:29 +0000 Subject: [PATCH] Issue 1353: Patch for /training/tessopt.cpp https://code.google.com/p/tesseract-ocr/issues/detail?id=1353 When training batch boxes and tifs this causes training to fail after 2nd iteration. The issue is that the tessopt iterator index is a global. The fix is to 1.) reset before each tessopt usage 2.) wrap the iterator state in a class/generator. Low priority, but useful if we want to generate a bunch of traineddatas in the same process or even multiple threads. --- training/tessopt.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/training/tessopt.cpp b/training/tessopt.cpp index 30d58f82b0..9e7e020340 100644 --- a/training/tessopt.cpp +++ b/training/tessopt.cpp @@ -57,3 +57,9 @@ const char *arglist //string of arg chars else return EOF; } + +void tessopt_reset() +{ + tessoptind = 0; + tessoptarg = 0; +}