Mahotas is not a package to generate images, but there are a few simple functions to draw lines and polygons on an image (the target image is known as the canvas in this documentation).
The simplest function is line: Give it two points and it draws a line between them. The implementation is simple, and in Python, so it will be slow for many complex usage.
The main purpose of these utilities is to aid debugging and visualisation. If you need to generate fancy graphs, look for packages such as matplotlib.
Convex hull functions are a more typical image processing feature. Mahotas has a simple one, called convexhull. Given a boolean image (or anything that will get interpreted as a boolean image), it finds the convex hull of all its on points.
The implementation is in C++, so it is fast.
A companion function fill_convexhull returns the convex hull as a binary image.
Draw a line
Parameters : | p0 : pair of integers
p1 : pair of integers
canvas : ndarray
color : integer, optional
|
---|
Draw a filled polygon in canvas
Parameters : | polygon : list of pairs
canvas : ndarray
color : integer, optional
|
---|
Compute the convex hull as a polygon
Parameters : | bwimg : ndarray
|
---|---|
Returns : | hull : ndarray
|
Compute the convex hull and return it as a binary mask
Parameters : | bwimage : input image (interpreted as boolean) |
---|---|
Returns : | hull : image of same size and dtype as bwimg with the hull filled in. |