Development of the ocr part of AOI
Samo Penic
2018-11-21 9c222b2a0b151e7219e30f0145aa92872890d838
aoi_ocr/sid_process.py
@@ -17,14 +17,14 @@
def find_biggest_blob(image, original_image,sid_mask):
    if sid_mask[0] == "1":
        move_left = 45
        move_left = 35
    elif sid_mask[0] == "x":
        move_left = 55
        move_left = 40
    else:
        move_left = 0
       # Remove noise
    image2 = cv2.morphologyEx(
        original_image, cv2.MORPH_OPEN, kernel(2, 2), iterations=7
        original_image, cv2.MORPH_OPEN, kernel(2, 2), iterations=3
    )
    # find biggest block of pixels
    image1 = cv2.morphologyEx(image2, cv2.MORPH_DILATE, kernel(5, 25), iterations=4)
@@ -186,14 +186,14 @@
    sid_err = []
    image = 255 - image
    image_original = image.copy()
    image = img_as_ubyte(image > 100)
    image = img_as_ubyte(image > 70)
    cv2.imwrite("/tmp/enSID0.png", image)
    # Remove noise
    image = cv2.morphologyEx(image, cv2.MORPH_OPEN, kernel(2, 2), iterations=3)
    #image = cv2.morphologyEx(image, cv2.MORPH_OPEN, kernel(2, 2), iterations=3)
    # Closing. Connect non connected parts
    image = cv2.morphologyEx(image, cv2.MORPH_CLOSE, kernel(5, 3), iterations=4)
    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)