ocvu.contour module¶
-
class
ocvu.contour.Contour(contour)[source]¶ Bases:
objectProvides a user-friendly object defining a contour in OpenCV. Adapted from: http://answers.opencv.org/question/6043/segmentation-and-contours/
-
approx¶ Lorem
-
area¶ Contour.area - Area bounded by the contour region
-
bounding_box¶ Lorem
-
centroid¶
-
diameter¶ EquivDiameter: diameter of circle with same area as region
-
draw(image, **kwargs)[source]¶ Draw contour.
kwargsare passed tocv2.rectanglemethod. Default color is green.
-
draw_approx(image, **kwargs)[source]¶ Draw approximated contour. kwargs are passed to cv2.rectangle method. Default color is red.
-
draw_bounding_box(image, **kwargs)[source]¶ Draw contour’s bounding box on image. kwargs are passed to cv2.rectangle method. Default color is white.
-
draw_centroid(image, radius=3, **kwargs)[source]¶ Draw contour’s centroid. kwargs are passed to cv2.circle method.
-
draw_ellipse(image, **kwargs)[source]¶ Draw contour’s ellipse. kwargs are passed to cv2.circle method.
-
draw_hull(image, **kwargs)[source]¶ Draw convex hull. kwargs are passed to cv2.rectangle method. Default color is blue.
-
ellipse¶ Fits an ellipse and returns the rotated rectangle in which the ellipse is inscribed.
The returned value is the tuple:
((x, y), (major_axis, minor_axis), angle)
-
hull¶ Lorem
-
moments¶ Lorem
-
perimeter¶ Lorem
-
position¶ Top left coordinate of the contour bounding box.
-