So far, we have seen some contour properties derived from image moments (for example, centroid, area, roundness, or eccentricity, among others). Additionally, OpenCV provides some interesting functionality related to contours that can be also used to further describe contours.
In contours_functionality.py, we mainly use five OpenCV functions related to contours and one function that computes the extreme points of a given contour.
Before describing what each of these functions computes, it is preferable to show the output of this script, because the resulting image can help us understand each of the aforementioned functions:
cv2.boundingRect() returns the minimal bounding rectangle enclosing all the points of the contour:
x, y, w, h = cv2.boundingRect(contours[0])
cv2.minAreaRect() returns the minimal rotated (if necessary) rectangle enclosing...