@ALDAOperator(genericExecutionMode=ALL, level=APPLICATION, allowBatchMode=true) public class HistogramEqualization extends MTBOperator
Basically, the cumulative distribution of the normalized intensity histogram is calculated and used as transfer function to linearize the histogram. In theory this yields an entropy maximization, but due to discretization in practice the histogram entropy might at best remain constant and most of the time slightly decreases. Anyway, the contrast of the histogram and the underlying image is increased applying this approach.
Modifier and Type | Field and Description |
---|---|
protected MTBImage |
inImg
Input image to process.
|
protected double |
inputEntropy
Initial Shannon entropy of the input image.
|
private int |
maxVal
Maximal value of intensity range, depending on input image type.
|
protected double |
outputEntropy
Final Shannon entropy of the output image.
|
protected MTBImage |
resultImg
Result image with improved contrast.
|
Constructor and Description |
---|
HistogramEqualization()
Default constructor.
|
HistogramEqualization(MTBImage img)
Constructor with default image.
|
Modifier and Type | Method and Description |
---|---|
private static double |
calcEntropy(MTBImageHistogram histo)
Calculates the Shannon entropy for the given (normalized!)
|
private void |
equalizeImageHisto(MTBImage ip)
Apply histogram equalization to the given image.
|
MTBImage |
getResultImage()
Returns the result image.
|
private int[] |
getTransferFunktion(MTBImageHistogram histo)
Get the discrete transfer function for the histogram.
|
protected void |
operate()
This method does the actual work.
|
readResolve
addOperatorExecutionProgressEventListener, addParameter, addParameter, addParameterUnconditioned, fieldContained, fireOperatorExecutionProgressEvent, getALDPortHashAccessKey, getConstructionMode, getDocumentation, getHidingMode, getInactiveParameterNames, getInInoutNames, getInInoutNames, getInNames, getInOutNames, getMissingRequiredInputs, getName, getNumParameters, getOutInoutNames, getOutNames, getParameter, getParameterDescriptor, getParameterDescriptorUnconditioned, getParameterNames, getParameterUnconditioned, getSupplementalNames, getVerbose, getVersion, handleOperatorExecutionProgressEvent, hasInOutParameters, hasParameter, isAnnotatedParameter, isConfigured, print, print, print, printInterface, printInterface, readHistory, reinitializeParameterDescriptors, removeOperatorExecutionProgressEventListener, removeParameter, runOp, runOp, runOp, setConstructionMode, setConstructionMode, setConstructionMode, setHidingMode, setName, setParameter, setParameterUnconditioned, setVerbose, toStringVerbose, unconfiguredItems, validate, validateCustom, validateGeneric, writeHistory, writeHistory, writeHistory
@Parameter(label="Input Image", required=true, dataIOOrder=0, direction=IN, description="Input image.") protected MTBImage inImg
@Parameter(label="Result Image", dataIOOrder=0, direction=OUT, description="Result image.") protected MTBImage resultImg
@Parameter(label="Entropy of Input Image", dataIOOrder=1, direction=OUT, description="Input image entropy.") protected double inputEntropy
@Parameter(label="Entropy of Output Image", dataIOOrder=2, direction=OUT, description="Output image entropy.") protected double outputEntropy
private int maxVal
public HistogramEqualization() throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
- Thrown in case of failure.public HistogramEqualization(MTBImage img) throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
img
- Image to enhance.de.unihalle.informatik.Alida.exceptions.ALDOperatorException
- Thrown in case of failure.public MTBImage getResultImage()
protected void operate()
operate
in class de.unihalle.informatik.Alida.operator.ALDOperator
private void equalizeImageHisto(MTBImage ip)
ip
- Input image to normalize.private int[] getTransferFunktion(MTBImageHistogram histo)
histo
- (Normalized!) histogram to transfer.private static double calcEntropy(MTBImageHistogram histo)
histo
- Input histogram.Copyright © 2010–2020 Martin Luther University Halle-Wittenberg, Institute of Computer Science, Pattern Recognition and Bioinformatics. All rights reserved.