Development of the ocr part of AOI
Samo Penic
2018-11-17 cf921b251d8664900bc7c5b3068bcd7b0ce2b2b7
commit | author | age
e555c0 1 from Ocr import Paper
02e0f7 2 from sklearn.externals import joblib
e555c0 3
e2fa6a 4 from glob import glob
762a5e 5
d5c694 6 settings = {"sid_mask": "64xx0xxx", "answer_treshold": 0.25}
0436f6 7 classifier = joblib.load("filename.joblib")
e555c0 8
6fde5f 9 #p = Paper(filename="testpage300dpi_scan1.png")
82ec6d 10 #p=Paper(filename='sizif111.tif', sid_classifier=classifier, settings={"sid_mask": "11xx0xxx", "answer_treshold": 0.25})
e2fa6a 11 #p=Paper(filename='processed_scans/20141016095134535_0006.tif', sid_classifier=classifier, settings=settings)
d5c694 12 #p = Paper(filename="processed_scans/20151111080408825_0001.tif",sid_classifier=classifier,settings=settings,)
SP 13 #p=Paper(filename='processed_scans/20151028145444607_0028.tif', sid_classifier=classifier, settings=settings)
14 pa = [
15     "processed_scans/20141016095134535_0006.tif",
16     "processed_scans/20141016095134535_0028.tif",
17     "processed_scans/20141016095134535_0028.tif",
18     "processed_scans/20141016095134535_0037.tif",
19     "processed_scans/20141021095744144_0005.tif",
20     "processed_scans/20141021095744144_0009.tif",
21     "processed_scans/20141028095553745_0018.tif",
cf921b 22     "processed_scans/20151013180545275_0011.tif",
SP 23     "processed_scans/20160408140801098_0004.tif"
d5c694 24 ]
cf921b 25 p=Paper(filename=pa[8], sid_classifier=classifier, settings=settings)
02e0f7 26
0436f6 27 # print(p.QRData)
SP 28 # print(p.errors)
e555c0 29
0436f6 30 # print(p.getSkewAngle())
SP 31 # print(p.locateUpMarkers())
32 # print(p.locateRightMarkers())
33 # print(p.answerMatrix)
34 # p.get_enhanced_sid()
35
36
37 print(p.get_paper_ocr_data())
6fde5f 38 exit(0)
d5c694 39 filelist = glob("processed_scans/*.tif")
SP 40 for f in sorted(filelist):
41     print("processing: {}".format(f))
42     print(
43         f,
44         Paper(
45             filename=f, sid_classifier=classifier, settings=settings
46         ).get_paper_ocr_data(),
47     )