Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions generate_tesseract_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
from tqdm import tqdm
import os
import json
from utils import config
import extract_candidates

candidates_dir=str(config.CANDIDATE_DIR)+'/'

def get_tesseract_results(image_path):
image = cv2.imread(image_path)
Expand All @@ -29,5 +32,8 @@ def get_tesseract_results(image_path):
for image in tqdm(images[:1], desc='Generating Tesseract Results'):
image_name = os.path.splitext(os.path.split(image)[-1])[0]
result = get_tesseract_results(image)
candidates=extract_candidates.get_candidates(results)#extract_candidates from ocr results
with open(os.path.join(tesseract_results, image_name + '.json'), 'w') as f:
json.dump(result, f)
with open(candidates_dir+image_name+'.json','w') as c:
json.dump(candidates,c)