forked from pradana.aumars/videocr
Compare commits
3 Commits
aec2b9c95a
...
25765b8b6f
Author | SHA1 | Date | |
---|---|---|---|
25765b8b6f | |||
09f5098e19 | |||
b005e36fcd |
@ -4,6 +4,7 @@ import sys
|
||||
import multiprocessing
|
||||
import pytesseract
|
||||
import cv2
|
||||
import numpy as np
|
||||
|
||||
from . import constants
|
||||
from . import utils
|
||||
@ -69,7 +70,7 @@ class Video:
|
||||
color_mask = cv2.inRange(hsv, (0, 0, 190), (179, 20, 255))
|
||||
|
||||
# apply mask, inverse image so it's black text on white background, add borders to top and bottom
|
||||
img = cv2.copyMakeBorder(cv2.bitwise_not(cv2.bitwise_and(img, img, mask=color_mask)), 10, 10, 0, 0, cv2.BORDER_CONSTANT, None, (255,255,255)
|
||||
img = cv2.copyMakeBorder(cv2.bitwise_not(cv2.bitwise_and(img, img, mask=color_mask)), 10, 10, 0, 0, cv2.BORDER_CONSTANT, None, (255,255,255))
|
||||
config = '--tessdata-dir "{}" --psm 7 -c preserve_interword_spaces=1'.format(constants.TESSDATA_DIR)
|
||||
try:
|
||||
return pytesseract.image_to_data(img, lang=self.lang, config=config)
|
||||
|
Loading…
Reference in New Issue
Block a user