colour_checker_detection.detection.contour_centroid#

colour_checker_detection.detection.contour_centroid(contour: ArrayLike) Tuple[float, float][source]#

Return the centroid of given contour.

Parameters:

contour (ArrayLike) – Contour to return the centroid of.

Returns:

Contour centroid.

Return type:

np.ndarray

Notes

  • A tuple class is returned instead of a ndarray class for convenience with OpenCV.

Examples

>>> contour = np.array([[0, 0], [1, 0], [1, 1], [0, 1]])
>>> contour_centroid(contour)  
(0.5, 0.5)