Skip to content

Commit

Permalink
Update generate_tesseract_results.py
Browse files Browse the repository at this point in the history
Saving candidates ( fix Praneet9#26 ) Please review @CS-savvy
  • Loading branch information
darsh169 authored Jun 23, 2021
1 parent 659f288 commit 09da789
Showing 1 changed file with 6 additions and 0 deletions.
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)

1 comment on commit 09da789

@darsh169
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please Review the fix

Please sign in to comment.