Development of the ocr part of AOI
Samo Penic
2018-11-17 82ec6d384adcc4ca543661c8bb2cec38e836e91b
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",
82ec6d 22     "processed_scans/20151013180545275_0011.tif"
d5c694 23 ]
82ec6d 24 p=Paper(filename=pa[7], sid_classifier=classifier, settings=settings)
02e0f7 25
0436f6 26 # print(p.QRData)
SP 27 # print(p.errors)
e555c0 28
0436f6 29 # print(p.getSkewAngle())
SP 30 # print(p.locateUpMarkers())
31 # print(p.locateRightMarkers())
32 # print(p.answerMatrix)
33 # p.get_enhanced_sid()
34
35
36 print(p.get_paper_ocr_data())
6fde5f 37 exit(0)
d5c694 38 filelist = glob("processed_scans/*.tif")
SP 39 for f in sorted(filelist):
40     print("processing: {}".format(f))
41     print(
42         f,
43         Paper(
44             filename=f, sid_classifier=classifier, settings=settings
45         ).get_paper_ocr_data(),
46     )