Development of the ocr part of AOI
Samo Penic
2018-12-01 93d924e090664ca7e88f0f166a7e334e0945746d
Did less noise removal.
2 files modified
12 ■■■■ changed files
aoiOcr.py 6 ●●●● patch | view | raw | blame | history
aoi_ocr/sid_process.py 6 ●●●● patch | view | raw | blame | history
aoiOcr.py
@@ -28,7 +28,7 @@
    "processed_scans/20160510075445995_0026.tif",
]
# p=Paper(filename=pa[9], sid_classifier=classifier, settings=settings)
p = Paper(filename="sizif-test000.tif", sid_classifier=classifier, settings=settings)
p = Paper(filename="test3011/sizif000.tif", sid_classifier=classifier, settings=settings)
# print(p.QRData)
# print(p.errors)
@@ -42,8 +42,8 @@
print(p.get_paper_ocr_data())
exit(0)
filelist = glob("processed_scans/*.tif")
#exit(0)
filelist = glob("test3011/*.tif")
wrong_sid = 0
total = 0
for f in sorted(filelist):
aoi_ocr/sid_process.py
@@ -191,7 +191,7 @@
    cv2.imwrite("/tmp/enSID0.png", image)
    # Remove noise
    image = cv2.morphologyEx(image, cv2.MORPH_OPEN, kernel(3, 3), iterations=4)
    image = cv2.morphologyEx(image, cv2.MORPH_OPEN, kernel(3, 3), iterations=2)
    # Closing. Connect non connected parts
    image = cv2.morphologyEx(image, cv2.MORPH_CLOSE, kernel(5, 1), iterations=4)
@@ -199,7 +199,7 @@
    # Again noise removal after closing
    #image = cv2.morphologyEx(image, cv2.MORPH_OPEN, kernel(8, 8), iterations=1)
    # don't do too much noise removal.
    image = cv2.morphologyEx(image, cv2.MORPH_OPEN, kernel(3, 3), iterations=2)
    #image = cv2.morphologyEx(image, cv2.MORPH_OPEN, kernel(3, 3), iterations=2)
    # Skeletonization
    #image = img_as_ubyte(morphology.skeletonize(image > 128))
@@ -228,5 +228,5 @@
    if not sid_compare(sid_no, sid_mask):
        sid_err = ["Wrong SID!"]
    cv2.imwrite("/tmp/SID_"+sid_no+".png", image)
    return sid_no, sid_err, sid_warn