Guest User

Untitled

a guest
Jan 17th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. def ocr_space_file(filename, overlay=True, api_key='мой API', language='eng'):
  2. ...обработка json
  3. f = open('Data.txt', 'w')
  4. for i in obj['ParsedResults']:
  5. ...
  6. f1 = ','.join(map(str, coords))
  7. f.write(f1 + 'n' )
  8. f.close()
  9. return r.content.decode()
  10.  
  11. test_file = ocr_space_file(filename='1my.png', language='eng')
  12.  
  13. imagePaths = [f for f in glob.glob('cropped_images/*.png')]
  14. save_path = 'Labeled_images/'
  15.  
  16. def ocr_all_screenshots():
  17.  
  18. for pic in imagePaths:
  19.  
  20. #src_fname, ext = os.path.splitext(pic) # split filename and extension
  21. # construct output filename, basename to remove input directory
  22. #save_fname = os.path.join(save_path, os.path.basename(src_fname) + '_labeled.png')
  23. os.chdir(save_path)
  24. ocr_space_file(pic)
  25.  
  26. ocr_all_screenshots()
Add Comment
Please, Sign In to add comment