de.unihalle.informatik.MiToBo.segmentation.thresholds
Class ImgThreshNiblack

java.lang.Object
  extended by de.unihalle.informatik.Alida.operator.ALDOperator
      extended by de.unihalle.informatik.MiToBo.core.operator.MTBOperator
          extended by de.unihalle.informatik.MiToBo.segmentation.thresholds.ImgThreshNiblack
All Implemented Interfaces:
de.unihalle.informatik.Alida.datatypes.ALDConfigurationValidator, de.unihalle.informatik.Alida.operator.events.ALDOperatorExecutionProgressEventListener, EventListener

@ALDAOperator(genericExecutionMode=ALL)
public class ImgThreshNiblack
extends MTBOperator

Image binarization based on local Niblack thresholding.

The implementation is based upon the following publications:

  • W. Niblack, An Introduction to Digital Image Processing, pp. 115-116, Prentice Hall, 1986.
  • G. Leedham, C. Yan, et al., Comparison of some thresholding algorithms for text/background segmentation in difficult document images,
    Proc. of the Seventh International Conference on Document Analysis and Recognition. Vol. 2. 2003
  • Z. Zhang, C.L. Tan, Recovery of Distorted Document Images from Bound Values, Proc. of 6th International Conference on Document Analysis and Recognition, pp. 429-433, 2001.
  • This class implements various versions of the Niblack thresholding approach. It calculates local thresholds according to the given input parameters and applies them to the given image. As result a binary image is returned.

    Provided methods include conventional and enhanced Niblack thresholding, either applied in a sliding window manner or maskwise. In the latter case the windows are not overlapping. The maskwise application has particularly profen suitable for granule detection.
    The operator allows for activation of an additional local variance check. If activated, only windows are thresholded where the variance exceeds a certain threshold. All other windows are assumed to contain more or less homogeneous intensities and are classified as background.

    In standard mode, as proposed by Niblack, the operator calculates a local threshold T based on the local mean m and standard deviation s in a local sliding window around pixel (x,y):

    %preamble{\usepackage{amssymb}}
    k is a scaling constant which has to be chosen depending on the application at hand. As stated above, this mode can be combined with additional variance checks.

    In additon to the standard version of the Niblack approach the operator also implements an enhanced version as proposed by Zhang et al:

    %preamble{\usepackage{amssymb}}
    This version can be selected in standard mode by setting the parameter R to a value different from -1. In the original paper default values of R = 100 and k = 0.1 are suggested. This mode can also be combined with local variance checks.

    Author:
    moeller

    Nested Class Summary
    static class ImgThreshNiblack.Mode
              Niblack processing mode.
     
    Nested classes/interfaces inherited from class de.unihalle.informatik.Alida.operator.ALDOperator
    de.unihalle.informatik.Alida.operator.ALDOperator.HidingMode
     
    Field Summary
     
    Fields inherited from class de.unihalle.informatik.Alida.operator.ALDOperator
    completeDAG, name, operatorExecutionEventlistenerList, portHashAccess, verbose, versionProvider
     
    Constructor Summary
    ImgThreshNiblack()
              Default constructor.
    ImgThreshNiblack(MTBImage _inImg, ImgThreshNiblack.Mode mode, double k, double R, int wSize, int vcNB, double vcThresh, MTBImageByte _mask)
              Constructor.
     
    Method Summary
     ij.ImagePlus applyNiblackThresholdWholeImage(ij.process.ImageProcessor ip, double k, double R, ij.ImagePlus _mask)
              Deprecated. 
     MTBImageByte getResultImage()
              Get the resulting thresholded image.
    protected  void operate()
               
     void setInputImage(MTBImage img)
              Set input image.
     
    Methods inherited from class de.unihalle.informatik.MiToBo.core.operator.MTBOperator
    readResolve
     
    Methods inherited from class de.unihalle.informatik.Alida.operator.ALDOperator
    addOperatorExecutionProgressEventListener, fieldContained, fireOperatorExecutionProgressEvent, getALDPortHashAccessKey, getConstructionMode, getHidingMode, getInInoutNames, getInInoutNames, getInNames, getInOutNames, getMissingRequiredInputs, getName, getNumParameters, getOutInoutNames, getOutNames, getParameter, getParameterDescriptor, getParameterNames, getSupplementalNames, getVerbose, getVersion, handleOperatorExecutionProgressEvent, isConfigured, print, print, print, printInterface, printInterface, readHistory, reinitializeParameterDescriptors, removeOperatorExecutionProgressEventListener, runOp, runOp, runOp, setConstructionMode, setHidingMode, setName, setParameter, setVerbose, toStringVerbose, unconfiguredItems, validate, validateCustom, validateGeneric, writeHistory, writeHistory, writeHistory
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Constructor Detail

    ImgThreshNiblack

    public ImgThreshNiblack()
                     throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
    Default constructor.

    Throws:
    de.unihalle.informatik.Alida.exceptions.ALDOperatorException

    ImgThreshNiblack

    public ImgThreshNiblack(MTBImage _inImg,
                            ImgThreshNiblack.Mode mode,
                            double k,
                            double R,
                            int wSize,
                            int vcNB,
                            double vcThresh,
                            MTBImageByte _mask)
                     throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
    Constructor. A new empty meta data object is initialized.

    Parameters:
    _inImg - Image to work on.
    mode - Mode for Niblack operator.
    k - Scaling factor for standard deviation.
    R - If unequal to -1, enhanced Niblack is applied.
    wSize - Size of sliding window for local thresholding.
    vcNB - Size of neighborhood for local variance check.
    vcThresh - Threshold for local variance check.
    _mask - Image mask for excluding image sections.
    Throws:
    de.unihalle.informatik.Alida.exceptions.ALDOperatorException
    Method Detail

    getResultImage

    public MTBImageByte getResultImage()
    Get the resulting thresholded image.

    Returns:
    Binary image.

    setInputImage

    public void setInputImage(MTBImage img)
    Set input image.

    Parameters:
    img - Image to process.

    operate

    protected void operate()
    Specified by:
    operate in class de.unihalle.informatik.Alida.operator.ALDOperator

    applyNiblackThresholdWholeImage

    @Deprecated
    public ij.ImagePlus applyNiblackThresholdWholeImage(ij.process.ImageProcessor ip,
                                                                   double k,
                                                                   double R,
                                                                   ij.ImagePlus _mask)
    Deprecated. 



    Copyright © 2010–2015 Martin Luther University Halle-Wittenberg. All rights reserved.