def reconstruction_by_dilation(im, LEN, DEG_NUM):
    imo = []
    for i in range(DEG_NUM):
        filtername = (str((i + 1)) + 'se.txt')
        se = np.loadtxt(('filters/images/filters/' + filtername))
        if (i == 0):
            se = np.reshape(se, (1, len(se)))
        if (i == 6):
            se = np.reshape(se, (len(se), 1))
        se = se.astype('uint8')
        imoi = cv2.erode(im, se)
        imoi = cv2.dilate(imoi, se)
        imo.append(imoi)
    imC = imo[0]
    for i in range((DEG_NUM - 1)):
        k = (i + 1)
        imC = np.maximum(imC, imo[k])
    imC2 = imreconstruct(imC, im)
    imC2 = mat2gray(imC2)
    return imC2
def reconstruction_by_dilation(im, LEN, DEG_NUM):
    imo = []
    for i in range(DEG_NUM):
        filtername = (str((i + 1)) + 'se.txt')
        se = np.loadtxt(('filters/images/filters/' + filtername))
        if (i == 0):
            se = np.reshape(se, (1, len(se)))
        if (i == 6):
            se = np.reshape(se, (len(se), 1))
        se = se.astype('uint8')
        imoi = cv2.erode(im, se)
        imoi = cv2.dilate(imoi, se)
        imo.append(imoi)
    imC = imo[0]
    for i in range((DEG_NUM - 1)):
        k = (i + 1)
        imC = np.maximum(imC, imo[k])
    imC2 = imreconstruct(imC, im)
    imC2 = mat2gray(imC2)
    return imC2