Open abdallahabusedo opened 3 years ago
I just read your code and try it on this image I notice that there a line did not remove so I try to fix the code to make it like this
def eraseLine(thickness, startLine, image, picWidth): #doesn't erase line, but make them white topLine = startLine botLine = startLine + thickness -1 for col in range(picWidth): if image.item(topLine,col) == 0 or image.item(botLine,col) == 0: if image.item(topLine-1, col) == 255 and image.item(botLine+1,col) == 255: for j in range(thickness): image.itemset((topLine+j,col),255) elif image.item(topLine - 1, col) == 255 and image.item(botLine+1,col) == 0: thick = thickness+1 if thick < 1: thick = 1 for j in range(int(thick)): image.itemset((topLine + j, col),255) elif image.item(topLine - 1, col) == 0 and image.item(botLine+1,col) == 255: thick = thickness+1 if thick < 1: thick = 1 for j in range(int(thick)): image.itemset((botLine - j, col),255) return image
and I fix it
this is the photo after fixing this is the result before fixing the code
I just read your code and try it on this image I notice that there a line did not remove so I try to fix the code to make it like this
and I fix it