Quick line remover cleanup.
Title^^^^ Signed-off-by: Ethan Wellenreiter <ewellenreiter@gmail.com>
This commit is contained in:
parent
d83ba20d9a
commit
b32da17431
@ -595,43 +595,6 @@ def removeLinesFromText(image):
|
||||
return image
|
||||
|
||||
|
||||
|
||||
colourimage = cv2.cvtColor(image, cv2.COLOR_GRAY2BGR)
|
||||
imgcopy = image.copy()
|
||||
|
||||
|
||||
for i in range(0,7):
|
||||
imgcopy = fillLines(imgcopy)
|
||||
|
||||
return imgcopy
|
||||
|
||||
# maxgap = int(min(image.shape[0], image.shape[1])/20)
|
||||
edges = cv2.Canny(imgcopy, 0, 500, 3)
|
||||
# return edges
|
||||
maxgap = int(min(imgcopy.shape[0], imgcopy.shape[1])/30)
|
||||
# print(maxgap)
|
||||
minlength = int(min(imgcopy.shape[0], imgcopy.shape[1])/2)
|
||||
linesP = cv2.HoughLinesP(edges, 1, np.pi / 180, 50, None, minlength, maxgap)
|
||||
|
||||
# print(len(linesP))
|
||||
# print(linesP)
|
||||
# mask = np.zeros(colourimage.shape, dtype=np.uint8)
|
||||
|
||||
|
||||
for line in linesP:
|
||||
l = line[0]
|
||||
# colourimage = cv2.line(colourimage, (l[0], l[1]), (l[2], l[3]), (0,255,0), thickness=20)
|
||||
image = cv2.line(image, (l[0], l[1]), (l[2], l[3]), 255, thickness=20)
|
||||
# mask = cv2.line(mask, (l[0], l[1]), (l[2], l[3]), (255,255,255), thickness=3)
|
||||
|
||||
# kernel = cv2.getStructuringElement(cv2.MORPH_CROSS, (4, 4))
|
||||
# image = 255-cv2.morphologyEx(255-image, cv2.MORPH_OPEN, kernel)
|
||||
# kernel = cv2.getStructuringElement(cv2.MORPH_RECT, (3, 3))
|
||||
# image = 255-cv2.morphologyEx(255-image, cv2.MORPH_DILATE, kernel)
|
||||
|
||||
# return colourimage
|
||||
return image
|
||||
|
||||
|
||||
def cropclarifying(image):
|
||||
whitedbackground = whiteoutbackground(image)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user