All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class image.ImageProc

java.lang.Object
   |
   +----image.ImageProc

public class ImageProc
extends Object
Some common image processing functions

Author:
Di Zhong (Columbia University)

Constructor Index

 o ImageProc()

Method Index

 o averageSmooth(float[][], int)
Smooth image by taking average over a window
 o dilation(boolean[][], float)
Morphological operation: dilation.
 o erosion(boolean[][], float)
Morphological operation: erosion.
 o fitline(int, int[], int[], Point, Point)
FitLine from sample points
 o gaussianSmooth(float[][], float)
Gaussian smooth, note original image array will be over written
 o gaussianSmooth0(float[][], float)
Gaussian smooth, return smoothed image
 o getCenter(boolean[][])
Compute the centroid of a given mask
 o luv2rgb(float, float, float)
Convert L*u*v* to RGB
 o medianfilter(float[][][])
Median filtering (3x3 window)
 o palette(float[][][], int, float[])
Build quantization table (color palette) using kmeans clustering
 o perimeter(Polygon)
Compute the perimeter of a given polygon
 o quantize(float[][][], float[][], float[])
Quantize an image given a quantization table (color palette)
 o rgb2luv(int, int, int, float[])
Convert RGB to L*u*v*

Constructors

 o ImageProc
 public ImageProc()

Methods

 o fitline
 public static final void fitline(int npoints,
                                  int xpoints[],
                                  int ypoints[],
                                  Point endpt0,
                                  Point endpt1)
FitLine from sample points

Parameters:
npoints - number of sample points
xpoints - x-coordinates
ypoints - y-coordinates
eddpt0 - output, one end point
eddpt1 - output, another end point
See Also:
fitpolys
 o rgb2luv
 public static final void rgb2luv(int r,
                                  int g,
                                  int b,
                                  float luv[])
Convert RGB to L*u*v*

Parameters:
r - red value(0-255)
g - green value(0-255)
b - blue value(0-255)
luv - output L*u*v* triple (i.e. float[3])
 o luv2rgb
 public static final int[] luv2rgb(float l,
                                   float u,
                                   float v)
Convert L*u*v* to RGB

Parameters:
l - L* value
u - u* value
v - v* value
 o medianfilter
 public static final float[][][] medianfilter(float input[][][])
Median filtering (3x3 window)

Parameters:
input - input image (float, 3 channels)
 o palette
 public static final float[][] palette(float img[][][],
                                       int ncolors,
                                       float w[])
Build quantization table (color palette) using kmeans clustering

Parameters:
img - image array (three channels)
ncolors - number of colors
w - weighting of three color channels
 o quantize
 public static final void quantize(float img[][][],
                                   float clrs[][],
                                   float w[])
Quantize an image given a quantization table (color palette)

Parameters:
img - image array (three channels), it will be overwritten
clrs - color palette
w - weighting of three color channels
See Also:
palette
 o gaussianSmooth
 public static final void gaussianSmooth(float img[][],
                                         float sigma)
Gaussian smooth, note original image array will be over written

Parameters:
img - two dimensional image array (gray level)
sigma - smooth coefficient
 o gaussianSmooth0
 public static final float[][] gaussianSmooth0(float img[][],
                                               float sigma)
Gaussian smooth, return smoothed image

Parameters:
img - two dimensional image array (gray level)
sigma - smooth coefficient
 o averageSmooth
 public static final float[][] averageSmooth(float img[][],
                                             int rad)
Smooth image by taking average over a window

Parameters:
img - 2D float array of a gray-level image
rad - radius of averaging widow
 o erosion
 public static boolean[][] erosion(boolean mask[][],
                                   float rad)
Morphological operation: erosion. Return result mask array (return null if there is no pixel masked after erosison)

Parameters:
mask - 2D binary mask
rad - radius of erosion operator
 o dilation
 public static boolean[][] dilation(boolean mask[][],
                                    float rad)
Morphological operation: dilation. Return result mask array. Note, return mask has the same size as original one. If expanded mask is desierd, add margin before dilation

Parameters:
mask - 2D binary mask
rad - radius of dilation operator
 o perimeter
 public static float perimeter(Polygon p)
Compute the perimeter of a given polygon

Parameters:
p - polygon
 o getCenter
 public static Point getCenter(boolean p[][])
Compute the centroid of a given mask

Parameters:
p - 2-d binary mask

All Packages  Class Hierarchy  This Package  Previous  Next  Index