aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/libchelleport.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/include/libchelleport.h b/include/libchelleport.h
index ef693cb..c74058d 100644
--- a/include/libchelleport.h
+++ b/include/libchelleport.h
@@ -1,3 +1,4 @@
+#include <leptonica/allheaders.h>
#include <tesseract/publictypes.h>
#include <vector>
@@ -8,11 +9,19 @@ struct OCRMatch {
const char *text;
};
+// OCR configuration
#define CONFIDENCE_THRESHOLD 25.
-#define MIN_CHARACTER_COUNT 2
-
+#define MIN_CHARACTER_COUNT 3
const tesseract::PageIteratorLevel RESULT_ITER_MODE = tesseract::RIL_WORD;
+// Preprocessing configuration
+const float contrast = 0.3;
+const float sharpness = 0.7;
+const float scaleFactor = 1;
+const float grayscaleWeightRed = 0.114;
+const float grayscaleWeightGreen = 0.587;
+const float grayscaleWeightBlue = 0.299;
+
extern "C" {
OCRMatch *findWordCoordinates(const char *image_path, /* returns */ int *size);
}
@@ -20,3 +29,5 @@ OCRMatch *findWordCoordinates(const char *image_path, /* returns */ int *size);
std::vector<OCRMatch> extractTextCoordinates(const char *imagePath);
void showMatch(const OCRMatch &match);
+
+void preprocessImage(Pix **image);