def main():
    
    input_img = 'images/smallRealBoard1.jpg'
    
    # List of contours, and image of edges
    initialContourList, listHierarchy, drawnEdges = FindContours.find_all_contours(input_img)
    
    finalContourList = FindContours.select_contours(initialContourList, listHierarchy)
    
    input_img = cv2.imread('images/smallRealBoard1.jpg', 0)
    
    finalImage = FindContours.display_drawn_contours(input_img,finalContourList)
    
    return finalContourList
Example #2
0
def find_contours(image):
    """
    Find contours on image
    Args:
        image: Image to find contours on
    Returns:
        finalContours:
        contourImage:
    """
    #findContours = FindContours()
    fd = FindContours()
    contours, hierarchy, edgeImage = fd.find_all_contours(image)
    finalContours = fd.select_contours(contours, hierarchy)

    contourImage = fd.display_drawn_contours(image,finalContours)

    return finalContours, contourImage
def test_simple_image():
    testimg = cv2.imread('test/simpleLaser.jpg',0)
    cnts, hierarchy, _ = FindContours.find_all_contours(testimg)
    finalCnts = FindContours.select_contours(cnts, hierarchy)
    assert len(finalCnts) == 7
def test_small_real_image():
    testimg = cv2.imread('test/smallRealBoard1.jpg',0)
    cnts, hierarchy, _ = FindContours.find_all_contours(testimg)
    finalCnts = FindContours.select_contours(cnts, hierarchy)
    assert len(finalCnts) == 11