|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.unihalle.informatik.Alida.operator.ALDOperator
de.unihalle.informatik.MiToBo.core.operator.MTBOperator
de.unihalle.informatik.MiToBo.morphology.DistanceTransform
@ALDAOperator(genericExecutionMode=ALL, level=APPLICATION) public class DistanceTransform
Class to calculate a distance map / field from a binary image using the Champfer-algorithm from G. Borgefors, “Distance transformations in digital images,” Computer Vision, Graphics, and Image Processing, vol. 34, pp. 344–371, 1986. Several distance metrics (Euclide, Chessboard, Cityblock) and the foreground (0 for black and 1 for white) can be specified. A 8-way neighborhood is used. The distance field is created as MTBImage or as a two dimensional double array. First dimension specifies the y-coordinate of the field, and the second dimension specifies the x-coordinate of the field.
Nested Class Summary | |
---|---|
static class |
DistanceTransform.DistanceMetric
Several distance metrics. |
static class |
DistanceTransform.ForegroundColor
Color of binary image foreground. |
Nested classes/interfaces inherited from class de.unihalle.informatik.Alida.operator.ALDOperator |
---|
de.unihalle.informatik.Alida.operator.ALDOperator.HidingMode |
Field Summary | |
---|---|
private MTBImage |
distanceImg
The distance field as MTBImage. |
private double[][] |
distanceMap
The distance field as two-dimensional double array. |
private DistanceTransform.DistanceMetric |
distanceMetric
|
private DistanceTransform.ForegroundColor |
foreground
Foreground color of the foreground object. |
private int |
height
Width and height of the given image. |
private MTBImageByte |
inputImage
|
private int |
width
Width and height of the given image. |
Fields inherited from class de.unihalle.informatik.Alida.operator.ALDOperator |
---|
completeDAG, name, portHashAccess, verbose, versionProvider |
Constructor Summary | |
---|---|
DistanceTransform()
Standard constructor. |
|
DistanceTransform(MTBImageByte image,
DistanceTransform.DistanceMetric dm,
DistanceTransform.ForegroundColor fg)
Constructor to create a new DistanceTransform object. |
Method Summary | |
---|---|
private void |
calcDM()
Method to calculate the distance map of the given binary image using the Chamfer-algorithm. |
MTBImage |
getDistanceImage()
Get the calculated distance map image. |
double[][] |
getDistanceMap()
Get the calculated distance map. |
DistanceTransform.DistanceMetric |
getDistMetric()
Get the used distance metric. |
DistanceTransform.ForegroundColor |
getForeground()
Get the used foreground color. |
int |
getHeight()
Get image height. |
MTBImageByte |
getInImg()
Get the input image. |
int |
getWidth()
Get image width. |
protected void |
operate()
|
void |
setDistMetric(DistanceTransform.DistanceMetric metric)
Set the distance metric. |
void |
setForeground(DistanceTransform.ForegroundColor fColor)
Set the foreground color. |
void |
setHeight(int height)
Set image height. |
void |
setInImg(MTBImageByte inImg)
Set the input image. |
void |
setWidth(int width)
Set image width. |
Methods inherited from class de.unihalle.informatik.MiToBo.core.operator.MTBOperator |
---|
readResolve |
Methods inherited from class de.unihalle.informatik.Alida.operator.ALDOperator |
---|
deserializeFromXmlFile, fieldContained, getALDPortHashAccessKey, getConstructionMode, getInInoutNames, getInInoutNames, getInNames, getInOutNames, getMissingRequiredInputs, getName, getNumParameters, getOutInoutNames, getOutNames, getParameter, getParameterDescriptor, getParameterNames, getSupplementalNames, getVerbose, getVersion, isConfigured, parametersToXmlObject, print, print, print, printInterface, printInterface, readHistory, reinitializeParameterDescriptors, runOp, runOp, runOp, serializeToXmlFile, setConstructionMode, setName, setParameter, setParametersFromXml, setParametersFromXml, setVerbose, toStringVerbose, unconfiguredItems, validate, validateCustom, validateGeneric, writeHistory, writeHistory, writeHistory, writeParametersToXml |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
@Parameter(label="Distance Map Image", direction=OUT, description="Image of the distance map.") private transient MTBImage distanceImg
@Parameter(label="Distance Map", direction=OUT, description="2D distance map array.") private double[][] distanceMap
@Parameter(label="Distance Metric", direction=IN, required=true, description="Used distance metric", mode=STANDARD, dataIOOrder=1) private DistanceTransform.DistanceMetric distanceMetric
@Parameter(label="Foreground Color", required=true, direction=IN, description="Color of foreground.", mode=STANDARD, dataIOOrder=2) private DistanceTransform.ForegroundColor foreground
private int height
@Parameter(label="Binary Input Image", required=true, direction=IN, description="Binary input image.", mode=STANDARD, dataIOOrder=0) private transient MTBImageByte inputImage
private int width
Constructor Detail |
---|
public DistanceTransform() throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
public DistanceTransform(MTBImageByte image, DistanceTransform.DistanceMetric dm, DistanceTransform.ForegroundColor fg) throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
image
- the input image to calculate the distance map on itdm
- the distance metricfg
- set foreground white or black
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Method Detail |
---|
private void calcDM()
public MTBImage getDistanceImage()
public double[][] getDistanceMap()
public DistanceTransform.DistanceMetric getDistMetric()
public DistanceTransform.ForegroundColor getForeground()
public int getHeight()
public MTBImageByte getInImg()
public int getWidth()
protected void operate() throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
operate
in class de.unihalle.informatik.Alida.operator.ALDOperator
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
public void setDistMetric(DistanceTransform.DistanceMetric metric)
public void setForeground(DistanceTransform.ForegroundColor fColor)
public void setHeight(int height)
public void setInImg(MTBImageByte inImg)
public void setWidth(int width)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |