Distance transform documentation

This commit is contained in:
Astrash 2023-05-02 14:15:20 +10:00
parent 9fa5307a60
commit 58b743e6e8
2 changed files with 39 additions and 0 deletions

View File

@ -17,26 +17,52 @@ public class DistanceTransformNoiseSamplerTemplate implements ObjectTemplate<Noi
@Value("image")
private Image image;
/**
* The threshold value applied to the channel specified in the 'channel' parameter that splits
* the image into a binary image. This parameter is only used for cost functions that utilize
* a binary image.
*/
@Value("threshold")
@Default
private int threshold = 127;
/**
* If set to true, distances calculated will be clamped to stay above the largest
* distance calculated on the edges of the image. This ensures output values do not
* appear to be cut off at the image boundaries. It is recommended to leave padding
* around the image if this is in use, such that larger evaluated distances do not
* get cut out by smaller evaluated distances close to borders. Doing so will yield
* better results.
*/
@Value("clamp-to-max-edge")
@Default
private boolean clampToEdge = false;
/**
* The target channel to run distance calculations on.
*/
@Value("channel")
@Default
private Channel channel = Channel.GRAYSCALE;
/**
* The method of image processing applied to the specified image prior to calculating
* distances.
*/
@Value("cost-function")
@Default
private CostFunction costFunction = CostFunction.Channel;
/**
* Inverts the resulting binary image that may be used as a cost function.
*/
@Value("invert-threshold")
@Default
private boolean invertThreshold = false;
/**
* How the final distance calculation should be redistributed.
*/
@Value("normalization")
@Default
private Normalization normalization = Normalization.None;

View File

@ -201,8 +201,21 @@ public class DistanceTransform {
}
public enum Normalization {
/**
* Return the raw calculated distances.
*/
None,
/**
* Redistribute the output values to fit in the range [-1, 1]
*/
Linear,
/**
* Redistributes smoothly to the range [-1, 1], such that areas where distance = 0 stay 0.
* This is only really applicable to signed distance calculations, and will fall back to linear
* redistribution if the input range does not contain both positive and negative values.
*/
SmoothPreserveZero,
}