DECIMER/config.py
def delete_empty_borders(im):
    """This function takes a Pillow Image object, converts it to grayscale and
    deletes white space at the borders.
    ___
    im: PIL.Image
    ___
    output: PIL.Image
    """
    im = np.asarray(im.convert("L"))
    mask = im > 200
    rows = np.flatnonzero((~mask).sum(axis=1))
    cols = np.flatnonzero((~mask).sum(axis=0))
    crop = im[rows.min() : rows.max() + 1, cols.min() : cols.max() + 1]
    return Image.fromarray(crop)
This function takes a Pillow Image object, converts it to grayscale and
    deletes white space at the borders.
    ___
    im: PIL.Image
    ___
    output: PIL.Image
    
This function takes a Pillow Image object, converts it to grayscale and
deletes white space at the borders.
This function takes a Pillow Image object converts it to grayscale and deletes white space at the borders .
def delete_empty_borders(im):
    im = np.asarray(im.convert("L"))
    mask = im > 200
    rows = np.flatnonzero((~mask).sum(axis=1))
    cols = np.flatnonzero((~mask).sum(axis=0))
    crop = im[rows.min() : rows.max() + 1, cols.min() : cols.max() + 1]
    return Image.fromarray(crop)
def delete_empty_borders ( im ) : im = np . asarray ( im . convert ( "L" ) ) mask = im > 200 rows = np . flatnonzero ( ( ~ mask ) . sum ( axis = 1 ) ) cols = np . flatnonzero ( ( ~ mask ) . sum ( axis = 0 ) ) crop = im [ rows . min ( ) : rows . max ( ) + 1 , cols . min ( ) : cols . max ( ) + 1 ] return Image . fromarray ( crop )
This function takes a Pillow Image object, converts it to grayscale and
deletes white space at the borders.
This function takes a Pillow Image object converts it to grayscale and deletes white space at the borders .
"""This function takes a Pillow Image object, converts it to grayscale and
    deletes white space at the borders.
    ___
    im: PIL.Image
    ___
    output: PIL.Image
    """
im