boofcv.alg.filter.binary.impl
Class BinaryThinning
- java.lang.Object
-
- boofcv.alg.filter.binary.impl.BinaryThinning
-
public class BinaryThinning extends java.lang.ObjectApplies binary thinning operators to the input image. Thinning discards most of objects foreground (value one) pixels and leaves behind a "skinny" object which still mostly describes the original object's shape. This implementation is known as the morphological thinning. It works by applying 8 masks to the image sequence. When a mask is applied pixels which need to be set to zero are recorded in a list. After the mask as been applied the pixels are modified, then the next mask is applied. This cycle is repeated until the image no longer changes. Based off the description in [1] using masks from [2]. The masks in those two sources are very similar but there is a one pixel difference which appears to create a smoother image in a couple of test cases.- Rafael C. Gonzalez and Richard E. Woods, "Digital Image Processing" 2nd Ed. 2001.
- http://homepages.inf.ed.ac.uk/rbf/HIPR2/thin.htm, October 31, 2015
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description classBinaryThinning.Mask0classBinaryThinning.Mask1classBinaryThinning.Mask2classBinaryThinning.Mask3classBinaryThinning.Mask4classBinaryThinning.Mask5classBinaryThinning.Mask6classBinaryThinning.Mask7
-
Field Summary
Fields Modifier and Type Field and Description static byte[]mask0static byte[]mask1static byte[]mask2static byte[]mask3static byte[]mask4static byte[]mask5static byte[]mask6static byte[]mask7
-
Constructor Summary
Constructors Constructor and Description BinaryThinning()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidapply(GrayU8 binary, int maxLoops)Applies the thinning algorithm.
-
-
-
Field Detail
-
mask0
public static byte[] mask0
-
mask1
public static byte[] mask1
-
mask2
public static byte[] mask2
-
mask3
public static byte[] mask3
-
mask4
public static byte[] mask4
-
mask5
public static byte[] mask5
-
mask6
public static byte[] mask6
-
mask7
public static byte[] mask7
-
-
Method Detail
-
apply
public void apply(GrayU8 binary, int maxLoops)
Applies the thinning algorithm. Runs for the specified number of loops or until no change is detected.- Parameters:
binary- Input binary image which is to be thinned. This is modifiedmaxLoops- Maximum number of thinning loops. Set to -1 to run until the image is no longer modified.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG