Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def ocr_space_file(filename, overlay=True, api_key='мой API', language='eng'):
- ...обработка json
- f = open('Data.txt', 'w')
- for i in obj['ParsedResults']:
- ...
- f1 = ','.join(map(str, coords))
- f.write(f1 + 'n' )
- f.close()
- return r.content.decode()
- test_file = ocr_space_file(filename='1my.png', language='eng')
- imagePaths = [f for f in glob.glob('cropped_images/*.png')]
- save_path = 'Labeled_images/'
- def ocr_all_screenshots():
- for pic in imagePaths:
- #src_fname, ext = os.path.splitext(pic) # split filename and extension
- # construct output filename, basename to remove input directory
- #save_fname = os.path.join(save_path, os.path.basename(src_fname) + '_labeled.png')
- os.chdir(save_path)
- ocr_space_file(pic)
- ocr_all_screenshots()
Add Comment
Please, Sign In to add comment