ocrd_cis/ocropy/ocrolib/morph.py
def find_contours(image):
    """Find hull polygons around connected fg components.
    
    Return a list of contours, each a tuple of:
    - coordinates (as a list of y,x tuples)
    - area
    """
    # skimage.measure.find_contours is not only slow but impractical:
    # - interrupts hull polygon when it intersects the margins (!)
    # - uses 0.5-based coordinates (i.e. center of pixel instead of top/left)
    contours, _ = cv2.findContours(image.astype(uint8),
                                   cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
    # convert to y,x tuples
    return [(contour[:,0,::-1], cv2.contourArea(contour))
            for contour in contours]
Find hull polygons around connected fg components.
    
    Return a list of contours, each a tuple of:
    - coordinates (as a list of y,x tuples)
    - area
    
Find hull polygons around connected fg components.
Return a list of contours, each a tuple of:
coordinates (as a list of y,x tuples)
area
Find hull polygons around connected fg components . Return a list of contours each a tuple of : coordinates ( as a list of y x tuples ) area
def find_contours(image):
    contours, _ = cv2.findContours(image.astype(uint8),
                                   cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
    return [(contour[:,0,::-1], cv2.contourArea(contour))
            for contour in contours]
def find_contours ( image ) : contours , _ = cv2 . findContours ( image . astype ( uint8 ) , cv2 . RETR_EXTERNAL , cv2 . CHAIN_APPROX_SIMPLE ) return [ ( contour [ : , 0 , : : - 1 ] , cv2 . contourArea ( contour ) ) for contour in contours ]
Find hull polygons around connected fg components.
Find hull polygons around connected fg components .
"""Find hull polygons around connected fg components.
    
    Return a list of contours, each a tuple of:
    - coordinates (as a list of y,x tuples)
    - area
    """ # skimage.measure.find_contours is not only slow but impractical: # - interrupts hull polygon when it intersects the margins (!) # - uses 0.5-based coordinates (i.e. center of pixel instead of top/left) # convert to y,x tuples
image