def compute_separators_morph(binary, scale, sepwiden=10, maxcolseps=2): """Finds vertical black lines corresponding to column separators.""" d0 = int(max(5, scale/4)) d1 = int(max(5, scale)) + sepwiden thick = morph.r_dilation(binary, (d0, d1)) vert = morph.rb_opening(thick, (10*scale, 1)) vert = morph.r_erosion(vert, (d0//2, sepwiden)) vert = morph.select_regions(vert, sl.dim1, min=3, nbest=2*maxcolseps) vert = morph.select_regions(vert, sl.dim0, min=20*scale, nbest=maxcolseps) return vert
def compute_separators_morph(binary: np.array, scale: float, sepwiden: int = 10, maxcolseps: int = 2) -> np.array: """Finds vertical black lines corresponding to column separators.""" logger.debug(u'Finding vertical black column lines') d0 = int(max(5, scale/4)) d1 = int(max(5, scale)) + sepwiden thick = morph.r_dilation(binary, (d0, d1)) vert = morph.rb_opening(thick, (10*scale, 1)) vert = morph.r_erosion(vert, (d0//2, sepwiden)) vert = morph.select_regions(vert, sl.dim1, min=3, nbest=2*maxcolseps) vert = morph.select_regions(vert, sl.dim0, min=20*scale, nbest=maxcolseps) return vert
def compute_separators_morph(binary: np.array, scale: float, sepwiden: int = 10, maxcolseps: int = 2) -> np.array: """Finds vertical black lines corresponding to column separators.""" logger.debug('Finding vertical black column lines') d0 = int(max(5, scale / 4)) d1 = int(max(5, scale)) + sepwiden thick = morph.r_dilation(binary, (d0, d1)) vert = morph.rb_opening(thick, (10 * scale, 1)) vert = morph.r_erosion(vert, (d0 // 2, sepwiden)) vert = morph.select_regions(vert, sl.dim1, min=3, nbest=2 * maxcolseps) vert = morph.select_regions(vert, sl.dim0, min=20 * scale, nbest=maxcolseps) return vert