ocrd_cis/ocropy/common.py
def borderclean(array, margin=4):
    """Remove components that are only contained within the margin.

    Given a grayscale-normalized image as Numpy array `array`,
    find and remove those black components that do not exceed
    the top/bottom margins.
    (This can be used to get rid of ascenders and descenders from
    neighbouring regions/lines, which cannot be found by resegment()
    within the region/line.

    This should happen before deskewing, because the latter increases
    the margins by an unpredictable amount.)

    Return a Numpy array (with 0 for black and 1 for white).
    """
    binary = np.array(array <= ocrolib.midrange(array), np.uint8)
    return np.maximum(borderclean_bin(binary, margin=margin), array)
Remove components that are only contained within the margin.

    Given a grayscale-normalized image as Numpy array `array`,
    find and remove those black components that do not exceed
    the top/bottom margins.
    (This can be used to get rid of ascenders and descenders from
    neighbouring regions/lines, which cannot be found by resegment()
    within the region/line.

    This should happen before deskewing, because the latter increases
    the margins by an unpredictable amount.)

    Return a Numpy array (with 0 for black and 1 for white).
    
Remove components that are only contained within the margin.
Given a grayscale-normalized image as Numpy array `array`,
find and remove those black components that do not exceed
the top/bottom margins.
(This can be used to get rid of ascenders and descenders from
neighbouring regions/lines, which cannot be found by resegment()
within the region/line.

This should happen before deskewing, because the latter increases
the margins by an unpredictable amount.)

Return a Numpy array (with 0 for black and 1 for white).
Remove components that are only contained within the margin . Given a grayscale - normalized image as Numpy array ` array ` find and remove those black components that do not exceed the top / bottom margins . ( This can be used to get rid of ascenders and descenders from neighbouring regions / lines which cannot be found by resegment () within the region / line . This should happen before deskewing because the latter increases the margins by an unpredictable amount . ) Return a Numpy array ( with 0 for black and 1 for white ) .
def borderclean(array, margin=4):
    binary = np.array(array <= ocrolib.midrange(array), np.uint8)
    return np.maximum(borderclean_bin(binary, margin=margin), array)
def borderclean ( array , margin = 4 ) : binary = np . array ( array <= ocrolib . midrange ( array ) , np . uint8 ) return np . maximum ( borderclean_bin ( binary , margin = margin ) , array )
Remove components that are only contained within the margin.
Remove components that are only contained within the margin .
"""Remove components that are only contained within the margin.

    Given a grayscale-normalized image as Numpy array `array`,
    find and remove those black components that do not exceed
    the top/bottom margins.
    (This can be used to get rid of ascenders and descenders from
    neighbouring regions/lines, which cannot be found by resegment()
    within the region/line.

    This should happen before deskewing, because the latter increases
    the margins by an unpredictable amount.)

    Return a Numpy array (with 0 for black and 1 for white).
    """
array
margin