Barebone tools for interactive image scribbles on python
- numpy
- matplotlib
- skimage
Run the annotation tools:
from scarabocchi.scarabocchi import scribbles_tools2d
from skimage.data import astronaut
# Simple annotator example
annotator = scribbles_tools2d(img=astronaut(), figsize=(10, 10))
- Paint scribbles by mouse click and move on the image.
- Use digits or up-down arrows to select new labels.
- remove scribble with r.
- new random color map with t.
The annotator object contains all labels information:
- a label mask with same spatial dimension as the initial image.
annotator.mask
- a dictionary with all annotation information and pixel-wise segmentation for each object.
# Example for segment "1"
annotation = annotator.labels["1"]
# Scribbles
annotation.xdata, annotation.ydata
# Object segmentation
annotation.xsegdata, annotation.ysegdata
Segmentation is performed with a simple seeded watershed, for custom segmentation algorithm just override the following method:
annotator.update_segmentation()
To get scarabocchi works on jupyter notebooks to use the following magic commands
%matplotlib notebook