Package 

Class AdaptiveMap


  • 
    public class AdaptiveMap
    
                        

    Image adaptive mapping methods.

    • Method Summary

      Modifier and Type Method Description
      static Pix backgroundNormMorph(Pix pixs) Normalizes an image's background using default parameters.
      static Pix backgroundNormMorph(Pix pixs, int normReduction, int normSize, int normBgValue) Normalizes an image's background to a specified value.
      static Pix pixContrastNorm(Pix pixs) Adaptively attempts to expand the contrast to the full dynamic range ineach tile using default parameters.
      static Pix pixContrastNorm(Pix pixs, int sizeX, int sizeY, int minDiff, int smoothX, int smoothY) Adaptively attempts to expand the contrast to the full dynamic range ineach tile.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • backgroundNormMorph

         static Pix backgroundNormMorph(Pix pixs)

        Normalizes an image's background using default parameters.

        Parameters:
        pixs - A source pix image.
      • backgroundNormMorph

         static Pix backgroundNormMorph(Pix pixs, int normReduction, int normSize, int normBgValue)

        Normalizes an image's background to a specified value.

        Notes:

        • This is a top-level interface for normalizing the image intensity bymapping the image so that the background is near the input value 'bgval'.
        • The input image is either grayscale or rgb.
        • For each component in the input image, the background value isestimated using a grayscale closing; hence the 'Morph' in the functionname.
        • An optional binary mask can be specified, with the foreground pixelstypically over image regions. The resulting background map values will bedetermined by surrounding pixels that are not under the mask foreground.The origin (0,0) of this mask is assumed to be aligned with the origin ofthe input image. This binary mask must not fully cover pixs, because thenthere will be no pixels in the input image available to compute thebackground.
        • The map is computed at reduced size (given by 'reduction') from theinput pixs and optional pixim. At this scale, pixs is closed to removethe background, using a square Sel of odd dimension. The product ofreduction * size should be large enough to remove most of the textforeground.
        • No convolutional smoothing needs to be done on the map beforeinverting it.
        • A 'bgval' target background value for the normalized image. Thisshould be at least 128. If set too close to 255, some clipping will occurin the result.
        Parameters:
        pixs - A source pix image.
        normReduction - Reduction at which morphological closings are done.
        normSize - Size of square Sel for the closing.
        normBgValue - Target background value.
      • pixContrastNorm

         static Pix pixContrastNorm(Pix pixs)

        Adaptively attempts to expand the contrast to the full dynamic range ineach tile using default parameters.

        Parameters:
        pixs - A source pix image
      • pixContrastNorm

         static Pix pixContrastNorm(Pix pixs, int sizeX, int sizeY, int minDiff, int smoothX, int smoothY)

        Adaptively attempts to expand the contrast to the full dynamic range ineach tile.

        Notes:

        • If the contrast in a tile is smaller than minDiff, it uses the minand max pixel values from neighboring tiles. It also can useconvolution to smooth the min and max values from neighboring tiles.After all that processing, it is possible that the actual pixel valuesin the tile are outside the computed [min ... max] range for localcontrast normalization. Such pixels are taken to be at either 0 (ifbelow the min) or 255 (if above the max).
        • sizeX and sizeY give the tile size; they are typically at least 20.
        • minDiff is used to eliminate results for tiles where it is likelythat either fg or bg is missing. A value around 50 or more isreasonable.
        • The full width and height of the convolution kernel are (2 * smoothx+ 1) and (2 * smoothy + 1). Some smoothing is typically useful, and welimit the smoothing half-widths to the range from 0 to 8. Use 0 for nosmoothing.
        • A linear TRC (gamma = 1.0) is applied to increase the contrast ineach tile. The result can subsequently be globally corrected, byapplying pixGammaTRC() with arbitrary values of gamma and the 0 and 255points of the mapping.
        Parameters:
        pixs - A source pix image
        sizeX - Tile width
        sizeY - Tile height
        minDiff - Minimum difference to accept as valid
        smoothX - Half-width of convolution kernel applied to min and maxarrays
        smoothY - Half-height of convolution kernel applied to min and maxarrays