video699.screen.semantic_segmentation.postprocessing

Module Contents

video699.screen.semantic_segmentation.postprocessing.contour_approximation(contour, lower_bound, factors)

Approximates single contour into quadrangle. :param contour: A contour to approximate into quadrangle. :type contour: np.array :param lower_bound: A lower percentage of whole image area, under which a contour is discarded. :type lower_bound: int :param factors: A list of multipliers specifying the maximum Hausdorff distance between new approximated polygon and original

contour.
Returns:polygon – A polygon with specific requirements: not smaller proportion than lower_bound and 4 corner points - quadrangle.
Return type:np.array
video699.screen.semantic_segmentation.postprocessing.contours_approximation(contours, lower_bound, factors)

Multi-contour version of contour_approximation function. :param contours: The contours to approximate into quadrangles. :type contours: np.array :param lower_bound: A lower percentage of whole image area, under which a contours are discarded. :type lower_bound: int :param factors: A list of multipliers specifying the maximum Hausdorff distance between new approximated polygon and original

contour.
Returns:polygons – The polygons with specific requirements: not smaller proportion than lower_bound and 4 corner points.
Return type:np.array
video699.screen.semantic_segmentation.postprocessing.approximate(pred, post_processing_params)

Approximate predictions into quadrangles using methods parametrized by post_processing_params. :param pred: A semantic segmentation prediction: binary image in open-cv. :type pred: np.array :param post_processing_params: A dictionary of post-processing methods with parameters. :type post_processing_params: dict

Returns:quadrangles – The quadrangles estimated by post-processing methods.
Return type:array-like[GEOSConvexQuadrangle]
video699.screen.semantic_segmentation.postprocessing.approximate_baseline(pred, base_lower_bound, base_factors, **params)

Approximate predictions into quadrangles using baseline method. :param pred: A semantic segmentation prediction: binary image in open-cv. :type pred: np.array :param base_lower_bound: A lower percentage of whole image area, under which a contours are discarded. :type base_lower_bound: int :param base_factors:

A list of multipliers specifying the maximum Hausdorff distance between new approximated polygon and original
contour.
Parameters:params (dict) – A discarded parameters entered into function.
Returns:quadrangles – The quadrangle contours estimated by post-processing methods.
Return type:array-like
video699.screen.semantic_segmentation.postprocessing.approximate_erosion_dilation(pred, erosion_dilation_lower_bound, erosion_dilation_kernel_size, erosion_dilation_factors, **params)

Approximate predictions into quadrangles using morphological operators eroding and dilating. :param pred: A semantic segmentation prediction: binary image in open-cv. :type pred: np.array :param erosion_dilation_lower_bound: A lower percentage of whole image area, under which a contours are discarded. :type erosion_dilation_lower_bound: int :param erosion_dilation_kernel_size: A size of the structuring element in which we perform morphological operator. :type erosion_dilation_kernel_size: int :param erosion_dilation_factors:

A list of multipliers specifying the maximum Hausdorff distance between new approximated polygon and original
contour.
Parameters:params (dict) – A discarded parameters entered into function.
Returns:quadrangles – The quadrangle contours estimated by post-processing methods.
Return type:array-like
video699.screen.semantic_segmentation.postprocessing.approximate_ratio_split(quadrangles, ratio_split_lower_bound, **params)

Using quadrangle contours, check their width-height ratio and split if necessary. :param quadrangles: A quadrangle contour checked by some of the eroding-dilating or base method. :type quadrangles: array-like :param ratio_split_lower_bound: A ratio under this parameter is split byy a vertical line. :type ratio_split_lower_bound: float :param params: A discarded parameters entered into function. :type params: dict,

Returns:quadrangles – The quadrangle contours estimated by post-processing methods.
Return type:array-like