-
Notifications
You must be signed in to change notification settings - Fork 1
Computing Centerlines
Anchor based medial curve computation uses some measure to define an end point. AOF(Average Outward Flux) uses the average outward flux of the gradient field of signed distance function of an object. A negative value of flux, of the gradient field of signed (positive inside) distance function of and object is a good indicator of end (medial) points. To run medial thinning in order of the distance to the object surface with end points 'anchored' using negative AOF values, run the following command:
$ skeltool -priority distance -curve -input <path/to/input/image> -anchor aof -outputFolder <output/folder/name>
Medial curve of a simple dinosaur sample image can be computed as follows.
$ skeltool -priority distance -curve -input data/dinosaur.tif -smooth 0.2 -fillholes -anchor aof -outputFolder results
If everything runs without errors you should see dinosaur_distance_curve.tif
inside results
folder. In the above command, options -smooth
and -fillholes
are additional preprocessing steps that you may also want to run to get 'cleaner' skeletons.
For a more complex object, you may want to control the number of branches. Setting the threshold for AOF defined end point is a good way of doing this.
The default threshold value for aof is -30
. Below are some example of medial curves computed using aof
achnored end point for a few threshold values
AOF anchored medial curves using the default threshold value of -30
$ skeltool -priority distance -curve -input data/astropiece.tif -anchor aof -threshold -30 -outputFolder results
A larger threshold of -20
(closer to zero
) leads to many more branches.
$ skeltool -priority distance -curve -input data/astropiece.tif -anchor aof -threshold -20 -outputFolder results
A smaller threshold on aof value (-35
) can lead to a sparse skeleton as shown below.
$ skeltool -priority distance -curve -input data/astropiece.tif -anchor aof -threshold -35 -outputFolder results