Blobs.plot_centroid#
- Blobs.plot_centroid(*args: Any, label: bool = False, text_style: dict[str, Any] | None = None, **kwargs: Any) None[source][source]#
Plot the centroid of blobs using Matplotlib
- Parameters:
label (bool) – add a sequential numeric label to each point, defaults to False
text_style – Matplotlib text options for the label, such as
dict(color="white", fontsize=12), defaults to Noneargs – optional marker, such as
'bx', which setsmarkerinkwargskwargs – other arguments passed to
plot_point
Changed in version 2.5.0: Added
text_style.Plot the major and minor axes of a blob or blobs on the current Matplotlib axes.
If no marker style is given then it will be an overlaid “o” and “x” in blue.
Examples
>>> from machinevisiontoolbox import Image >>> im = Image.Read("sharks.png") >>> blobs = im.blobs() >>> blobs.plot_centroid(label=True) # default blue "o" and "x" with blob id for all blobs >>> # >>> blobs[0].plot_centroid() # default blue "o" and "x" >>> blobs[1].plot_centroid('rd', label=True) # red diamond with label >>> blobs[2].plot_centroid(marker="x", color="red") # red "x" >>> blobs[3].plot_centroid(marker="P", markeredgecolor="lightsteelblue", markerfacecolor="w", fillstyle="full")
(
Source code,png,hires.png,pdf)
See also
plot_boxplot_perimeterplot_point