]> _ Git - 1000pourcent.git/commitdiff
wip #3206 @1
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 28 Nov 2019 11:35:26 +0000 (12:35 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 28 Nov 2019 11:35:26 +0000 (12:35 +0100)
_doc/areas.psd
js/ocr.js

index 80a0632e43b73c98c1d3c4b85ccd92278f702a4e..3abb9e0a4473290476595c50390d529e3f02c80c 100644 (file)
Binary files a/_doc/areas.psd and b/_doc/areas.psd differ
index 9b0be4ebe0fb66eaa94a1cf9feb61a82bf593af0..91edaa7aa7b81634a9e638e218f4b2268dd8eec2 100644 (file)
--- a/js/ocr.js
+++ b/js/ocr.js
@@ -70,6 +70,15 @@ function extractRegion(src, region, color, area) {
     M.data64F[5] += (bbox.height - h) / 2;
     cv.warpAffine(dst, res, M, bbox, cv.INTER_LINEAR, cv.BORDER_CONSTANT, new cv.Scalar());
 
+    // Invert colors
+    cv.bitwise_not(res, res);
+    // Grayscale
+    cv.cvtColor(res, res, cv.COLOR_RGBA2GRAY, 0);
+    // Brightness
+    cv.convertScaleAbs(res, res,2,100);
+    // Contrast
+     cv.equalizeHist(res, res);
+
     let canvas = getCanvas(drawId);
     cv.imshow(canvas, res);