forked from pradana.aumars/videocr
Compare commits
No commits in common. "25765b8b6f516837e361d29fc7635ebe3e8ff224" and "aec2b9c95a30af354b366297732fdc7372fd7170" have entirely different histories.
25765b8b6f
...
aec2b9c95a
@ -4,7 +4,6 @@ import sys
|
|||||||
import multiprocessing
|
import multiprocessing
|
||||||
import pytesseract
|
import pytesseract
|
||||||
import cv2
|
import cv2
|
||||||
import numpy as np
|
|
||||||
|
|
||||||
from . import constants
|
from . import constants
|
||||||
from . import utils
|
from . import utils
|
||||||
@ -70,7 +69,7 @@ class Video:
|
|||||||
color_mask = cv2.inRange(hsv, (0, 0, 190), (179, 20, 255))
|
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
|
# 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)
|
config = '--tessdata-dir "{}" --psm 7 -c preserve_interword_spaces=1'.format(constants.TESSDATA_DIR)
|
||||||
try:
|
try:
|
||||||
return pytesseract.image_to_data(img, lang=self.lang, config=config)
|
return pytesseract.image_to_data(img, lang=self.lang, config=config)
|
||||||
|
Loading…
Reference in New Issue
Block a user