colour_checker_detection.detection.is_square#
- colour_checker_detection.detection.is_square(contour: ArrayLike, tolerance: float = 0.015) bool [source]#
Return if given contour is a square.
- Parameters:
contour (ArrayLike) – Shape to test whether it is a square.
tolerance (float) – Tolerance under which the contour is considered to be a square.
- Returns:
Whether given contour is a square.
- Return type:
Examples
>>> shape = np.array([[0, 0], [1, 0], [1, 1], [0, 1]]) >>> is_square(shape) True >>> shape = np.array([[0.5, 0], [1, 0], [1, 1], [0, 1]]) >>> is_square(shape) False