SMIL 1.1.1
Loading...
Searching...
No Matches
example-intro-blobs.py
1import smilPython as sp
2
3im = sp.Image("balls.png")
4iml = sp.Image(im)
5
6# this is just a binary image - no need to segment
7sp.label(im, iml)
8iml.showLabel()
9
10# create blobs structure
11blobs = sp.computeBlobs(iml)
12
13# evaluate some measures :
14areas = sp.blobsArea(blobs)
15barys = sp.blobsBarycenter(im, blobs)
16
17# print areas and barycenters of each region
18print("{:3s} - {:>6s} - {:>13s}".format("ID", "Area", "Barycenter"))
19for k in blobs.keys():
20 bary = barys[k]
21 print("{:3d} - {:6.0f} - {:6.0f} {:6.0f}".format(k, areas[k], bary[0], bary[1]))
22