Expand description
Provides 2D geometry and image processing functions.
This includes:
- 2D vectors and related math
- 2D shapes and associated algorithms: Point, Line, Rect, RotatedRect, Polygon
- Rudimentary drawing functions
- Algorithms for finding the contours of connected components in an image (find_contours)
- Algorithms for simplifying polygons and finding various kinds of shape that contain a polygon: simplify_polygon, min_area_rect, convex_hull
Structs§
- Fill
Iter - Iterator over coordinates of pixels that fill a polygon. See
Polygon::fill_iter
for notes on how this iterator determines which pixels are inside the polygon. - Line
- A bounded line segment defined by a start and end point.
- Painter
- Painter is a context for drawing into an image tensor.
- Point
- A point defined by X and Y coordinates.
- Polygon
- Polygon shape defined by a list of vertices.
- Polygons
- A collection of polygons, where each polygon is defined by a slice of points.
- Rect
- Rectangle defined by left, top, right and bottom coordinates.
- Rotated
Rect - An oriented rectangle.
- Vec2
Enums§
- Retrieval
Mode - Specifies which contours to extract from a mask in
find_contours
.
Constants§
- IMAGENET_
MEAN - Standard ImageNet normalization mean values, for use with
normalize_image
. - IMAGENET_
STD_ DEV - Standard ImageNet normalization standard deviation values, for use with
normalize_image
.
Traits§
- Bounding
Rect - Trait for shapes which have a well-defined bounding rectangle.
- Coord
- Trait for types which can be used as coordinates of shapes.
Functions§
- bounding_
rect - Return the bounding rectangle of a collection of shapes.
- convex_
hull - Return the sorted subset of points from
poly
that form a convex hull containingpoly
. - draw_
line - Draw a non-antialiased line in an image.
- draw_
polygon - Draw the outline of a non anti-aliased polygon in an image.
- fill_
rect - Fill all points inside
rect
with the valuevalue
. - find_
contours - Find the contours of connected components in the binary image
mask
. - min_
area_ rect - Return the rotated rectangle with minimum area which contains
points
. - normalize_
image - Normalize the mean and standard deviation of all pixels in an image.
- simplify_
polygon - Return a simplified version of the polygon defined by
points
. - simplify_
polyline - Return a simplified version of the polyline defined by
points
. - stroke_
rect