| | |
| | | "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) |
| | |
| | | |
| | | 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): |
| | |
| | | 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) |
| | |
| | | # 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)) |
| | |
| | | |
| | | 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 |