jview
Class JImageSuite

java.lang.Object
  extended by jview.JImageSuite

public class JImageSuite
extends Object

Manipulating buffered images with different filters. Static classes.


Nested Class Summary
static class JImageSuite.Blur
          Class that combines parameters for a blurring operation.
static class JImageSuite.Clouds
          This class allows test on a cloud image.
static interface JImageSuite.Convolving
          Indicates image manipulation based on convolve operations.
static class JImageSuite.Gauss
          Class that produces a truncated gaussian for image detection.
static class JImageSuite.Sharpen
          Class that combines parameters necessarry for a sharpness operation.
 
Constructor Summary
JImageSuite()
           
 
Method Summary
static BufferedImage brighten(BufferedImage src, double b)
          Brightens or darkens the image by applying an offset that shifts the pixel value supplied to the left or right.
static BufferedImage brighten(BufferedImage src, float[] mode, double bright, boolean insitu, RenderingHints hints)
          Brightens or darkens the image by applying an offset that shifts the pixel value supplied to the left or right.
static BufferedImage brighten(BufferedImage src, float m1, double bright)
          Brightens or darkens the image by applying an offset that shifts the pixel value supplied to the left or right.
static BufferedImage brighten(BufferedImage src, float m1, double bright, boolean insitu)
          Brightens or darkens the image by applying an offset that shifts the pixel value supplied to the left or right.
static BufferedImage brighten(BufferedImage src, float m1, double bright, boolean insitu, RenderingHints hints)
          Brightens or darkens the image by applying an offset that shifts the pixel value supplied to the left or right.
private static LookupTable cloudLookupTable(int gray)
           
static BufferedImage clouds(BufferedImage earth, int gray, RenderingHints hints)
          From an image showing clouds we construct an image with an alpha channel thus that the lands are black and fully translucent, while white colors above the specified threshold are rendered fully opaque in original color.
static BufferedImage colorize(BufferedImage fim, LookupTable lut)
          Colorizes the image.
static BufferedImage colorize(BufferedImage fim, LookupTable lut, RenderingHints hints)
          Colorizes the image.
static BufferedImage convolve(BufferedImage src, JImageSuite.Convolving op)
          Uses a convolving instance to create a convolved buffered image.
static BufferedImage convolve(BufferedImage src, JImageSuite.Convolving op, int edgeop, RenderingHints hints)
          Uses a convolving instance to create a convolved buffered image.
static BufferedImage darken(BufferedImage src, int[] threshold, boolean insitu, RenderingHints hints)
          Constructs an easy look-up table that blackens the sky by setting all pixels below a certain threashold exponentially tozero and leaving all other untouched.
static BufferedImage flatten(BufferedImage src, double contrast)
          Does flattening of an image.
static BufferedImage flatten(BufferedImage src, double contrast, JHistogram hist)
          Does flattening of an image.
static BufferedImage flatten(BufferedImage src, double contrast, JHistogram[] hist)
          Does flattening of an image.
static BufferedImage flatten(BufferedImage src, double contrast, JHistogram[] hist, boolean insitu)
          Does flattening of an image.
static BufferedImage flatten(BufferedImage src, double contrast, JHistogram[] hist, boolean insitu, RenderingHints hints)
          Does flattening of an image.
static BufferedImage flip(BufferedImage src, boolean xflip, boolean yflip)
          Does flipping of an image.
private static double getScaleFactor(double range, double fwhm, double c)
          We calculate a scaling factor for the given contrast, which must be in the range of -1 to +1.
private static BufferedImage imageOp(BufferedImage src, boolean insitu, BufferedImageOp op)
          Operation on the source image.
static BufferedImage invert(BufferedImage src)
          Inverts a buffered image.
static BufferedImage invert(BufferedImage src, boolean insitu)
          Inverts a buffered image.
static BufferedImage invert(BufferedImage src, boolean insitu, RenderingHints hints)
          Inverts a buffered image.
static BufferedImage optimalContrast(BufferedImage src, double[] median, double[] min, double[] max, boolean insitu, RenderingHints hints)
          Tries to construct an optimal look-up table for image enhancement.
static BufferedImage rescale(BufferedImage src, double bright, double contrast)
          Rescales the image in the sense that the image gets brighter according to the brightness parameter, zero meaning no change and +/-1 meaning maximum/minimum brightness.
static BufferedImage rescale(BufferedImage src, double bright, double contrast, boolean insitu, RenderingHints hints)
          Rescales the image in the sense that the image gets brighter according to the brightness parameter, zero meaning no change and +/-1 meaning maximum/minimum brightness.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JImageSuite

public JImageSuite()
Method Detail

convolve

public static BufferedImage convolve(BufferedImage src,
                                     JImageSuite.Convolving op,
                                     int edgeop,
                                     RenderingHints hints)
Uses a convolving instance to create a convolved buffered image.


convolve

public static BufferedImage convolve(BufferedImage src,
                                     JImageSuite.Convolving op)
Uses a convolving instance to create a convolved buffered image.


invert

public static BufferedImage invert(BufferedImage src,
                                   boolean insitu,
                                   RenderingHints hints)
Inverts a buffered image. If insitu is specified, the operation is done in-situ, meaning that the old image is destroyed. The rendering hints can be null.


invert

public static BufferedImage invert(BufferedImage src,
                                   boolean insitu)
Inverts a buffered image. If insitu is specified, the operation is done in-situ, meaning that the old image is destroyed. The rendering hints can be null.


invert

public static BufferedImage invert(BufferedImage src)
Inverts a buffered image. If insitu is specified, the operation is done in-situ, meaning that the old image is destroyed. The rendering hints can be null.


colorize

public static BufferedImage colorize(BufferedImage fim,
                                     LookupTable lut)
Colorizes the image. The colors are generated from a look-up table. Color space conversion does not work properly for a gray-scaled image, thus, we do it the hard way. Note that we have to construct a buffered image with a specific type here, otherwise we are dead performancewise.

Returns:
A 3BYTE_BGR buffered image.

colorize

public static BufferedImage colorize(BufferedImage fim,
                                     LookupTable lut,
                                     RenderingHints hints)
Colorizes the image. The colors are generated from a look-up table. Color space conversion does not work properly for a gray-scaled image, thus, we do it the hard way. Note that we have to construct a buffered image with a specific type here, otherwise we are dead performancewise.

Returns:
A 3BYTE_BGR buffered image.

brighten

public static final BufferedImage brighten(BufferedImage src,
                                           double b)
Brightens or darkens the image by applying an offset that shifts the pixel value supplied to the left or right. The amount of shift is normalized such that a brightening level of +/-1 shift the supplied pixel value to maximum/minimum allowed. Values are clipped, as in a rescale operation. Normally, one will supply the mode/median/average of the pixel values as the brightening target and a brightening factor less than one.


brighten

public static final BufferedImage brighten(BufferedImage src,
                                           float m1,
                                           double bright,
                                           boolean insitu)
Brightens or darkens the image by applying an offset that shifts the pixel value supplied to the left or right. The amount of shift is normalized such that a brightening level of +/-1 shift the supplied pixel value to maximum/minimum allowed. Values are clipped, as in a rescale operation. Normally, one will supply the mode/median/average of the pixel values as the brightening target and a brightening factor less than one.


brighten

public static final BufferedImage brighten(BufferedImage src,
                                           float m1,
                                           double bright)
Brightens or darkens the image by applying an offset that shifts the pixel value supplied to the left or right. The amount of shift is normalized such that a brightening level of +/-1 shift the supplied pixel value to maximum/minimum allowed. Values are clipped, as in a rescale operation. Normally, one will supply the mode/median/average of the pixel values as the brightening target and a brightening factor less than one.


brighten

public static final BufferedImage brighten(BufferedImage src,
                                           float m1,
                                           double bright,
                                           boolean insitu,
                                           RenderingHints hints)
Brightens or darkens the image by applying an offset that shifts the pixel value supplied to the left or right. The amount of shift is normalized such that a brightening level of +/-1 shift the supplied pixel value to maximum/minimum allowed. Values are clipped, as in a rescale operation. Normally, one will supply the mode/median/average of the pixel values as the brightening target and a brightening factor less than one.


brighten

public static final BufferedImage brighten(BufferedImage src,
                                           float[] mode,
                                           double bright,
                                           boolean insitu,
                                           RenderingHints hints)
Brightens or darkens the image by applying an offset that shifts the pixel value supplied to the left or right. The amount of shift is normalized such that a brightening level of +/-1 shift the supplied pixel value to maximum/minimum allowed. Values are clipped, as in a rescale operation. Normally, one will supply the mode/median/average of the pixel values as the brightening target and a brightening factor less than one.


clouds

public static final BufferedImage clouds(BufferedImage earth,
                                         int gray,
                                         RenderingHints hints)
From an image showing clouds we construct an image with an alpha channel thus that the lands are black and fully translucent, while white colors above the specified threshold are rendered fully opaque in original color.


cloudLookupTable

private static LookupTable cloudLookupTable(int gray)

getScaleFactor

private static double getScaleFactor(double range,
                                     double fwhm,
                                     double c)
We calculate a scaling factor for the given contrast, which must be in the range of -1 to +1. The scaling factor accounts for the current range of gray levels by using the full-width half max of the original fits image scaling in a way that a contrast of one boost this range to 65535 and diminish it to zero for a contrast of -1. A contrast of zero returns a scaling factor of one.


flatten

public static final BufferedImage flatten(BufferedImage src,
                                          double contrast)
Does flattening of an image. Similar to contrast enhancement, as the histogram of the pixels gets flatter/steeper.


flatten

public static final BufferedImage flatten(BufferedImage src,
                                          double contrast,
                                          JHistogram hist)
Does flattening of an image. Similar to contrast enhancement, as the histogram of the pixels gets flatter/steeper. This method takes a single historgram for constructing the lookup table.


flatten

public static final BufferedImage flatten(BufferedImage src,
                                          double contrast,
                                          JHistogram[] hist)
Does flattening of an image. Similar to contrast enhancement, as the histogram of the pixels gets flatter/steeper. This method takes historgrams for constructing the lookup table.


flatten

public static final BufferedImage flatten(BufferedImage src,
                                          double contrast,
                                          JHistogram[] hist,
                                          boolean insitu)
Does flattening of an image. Similar to contrast enhancement, as the histogram of the pixels gets flatter/steeper. This method takes historgrams for constructing the lookup table.


flatten

public static final BufferedImage flatten(BufferedImage src,
                                          double contrast,
                                          JHistogram[] hist,
                                          boolean insitu,
                                          RenderingHints hints)
Does flattening of an image. Similar to contrast enhancement, as the histogram of the pixels gets flatter/steeper.


rescale

public static BufferedImage rescale(BufferedImage src,
                                    double bright,
                                    double contrast)
Rescales the image in the sense that the image gets brighter according to the brightness parameter, zero meaning no change and +/-1 meaning maximum/minimum brightness. The steepness parameter, also scaled between +/-1 means no contrast for -1, extreme contrast for +1.
The rescaling is done according to the formula:
       scale  = tan(pi/4*(1+contrast)),
offset = scale*2^n*bright.


rescale

public static BufferedImage rescale(BufferedImage src,
                                    double bright,
                                    double contrast,
                                    boolean insitu,
                                    RenderingHints hints)
Rescales the image in the sense that the image gets brighter according to the brightness parameter, zero meaning no change and +/-1 meaning maximum/minimum brightness. The steepness parameter, also scaled between +/-1 means no contrast for -1, extreme contrast for +1.
The rescaling is done according to the formula:
       scale  = tan(pi/4*(1+contrast)),
offset = scale*2^n*bright.


optimalContrast

public static BufferedImage optimalContrast(BufferedImage src,
                                            double[] median,
                                            double[] min,
                                            double[] max,
                                            boolean insitu,
                                            RenderingHints hints)
Tries to construct an optimal look-up table for image enhancement. Works best on sky images. The lookup-table is constructed to center on the median pixel value, has zero up to the minimum and 65535 from the maximum.


darken

public static BufferedImage darken(BufferedImage src,
                                   int[] threshold,
                                   boolean insitu,
                                   RenderingHints hints)
Constructs an easy look-up table that blackens the sky by setting all pixels below a certain threashold exponentially tozero and leaving all other untouched. In more detail this means, that values up to the threahold are damped with an exponential fit
       short=exp(ln(t+1)/t*x)-1
       


flip

public static final BufferedImage flip(BufferedImage src,
                                       boolean xflip,
                                       boolean yflip)
Does flipping of an image. No rendering hints are supported as flipping does not need interpolations. This transformation cannot take place in-situ, thus a new image is generated, unless both flipping parameters are false.


imageOp

private static BufferedImage imageOp(BufferedImage src,
                                     boolean insitu,
                                     BufferedImageOp op)
Operation on the source image. Performs in-situ operation if the supplied boolean is true.