OpenCV
4.8.0
Open Source Computer Vision
|
Prev Tutorial: Contour Features
Next Tutorial: Contours : More Functions
It is the ratio of width to height of bounding rect of the object.
\[Aspect \; Ratio = \frac{Width}{Height}\]
Extent is the ratio of contour area to bounding rectangle area.
\[Extent = \frac{Object \; Area}{Bounding \; Rectangle \; Area}\]
Solidity is the ratio of contour area to its convex hull area.
\[Solidity = \frac{Contour \; Area}{Convex \; Hull \; Area}\]
Equivalent Diameter is the diameter of the circle whose area is same as the contour area.
\[Equivalent \; Diameter = \sqrt{\frac{4 \times Contour \; Area}{\pi}}\]
Orientation is the angle at which object is directed. Following method also gives the Major Axis and Minor Axis lengths.
In some cases, we may need all the points which comprises that object.
We use the function: cv.transpose (src, dst)
src | input array. |
dst | output array of the same type as src. |
We use the function: cv.minMaxLoc(src, mask)
src | input single-channel array. |
mask | optional mask used to select a sub-array. |
Here, we can find the average color of an object. Or it can be average intensity of the object in grayscale mode. We again use the same mask to do it.
We use the function: cv.mean (src, mask)
src | input array that should have from 1 to 4 channels so that the result can be stored in Scalar. |
mask | optional operation mask. |