ovl.target_filters.conditional_contour_filter module

ovl.target_filters.conditional_contour_filter.conditional_contour_filter(single_contour_filter)[source]

A contour_filter that turns a function that filters a single contour (and returns true if it has passed) to an iterative one that goes over a list

example:

@conditional_contour_filter
def area_filter(contour, minimum_area=50)
    return cv2.contourArea(contour) > minimum_area

This function can then be passed to a Vision object:

filters = [area_filter(min_area=60)] # sets the minimum area to 60 -> the first parameter passed
vision = Vision(..., target_filters=filters, ...)
Parameters:single_contour_filter – the function to turn into a contour filter, which loads the parameters to the filter

before running it on list of contour filters. :return: the argument loader that wraps the target function