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