Class UniformityParamCalculator
- java.lang.Object
-
- edu.gsu.cs.dmlab.imageproc.imageparam.UniformityParamCalculator
-
- All Implemented Interfaces:
IParamCalculator
public class UniformityParamCalculator extends Object implements IParamCalculator
This class is designed to compute the uniformity of each patch of the givenBufferedImage
, based on the following formula:
U = SUM{(p(z_i))^2}
where:- p: the histogram of this patch.
- z_i: the intensity value of the i-th pixel in this patch.
- p(z_i): The frequency of the intensity z_i in the histogram of this patch whose uniformity parameter is being calculated.
- Author:
- Azim Ahmadzadeh, Data Mining Lab, Georgia State University
-
-
Constructor Summary
Constructors Constructor Description UniformityParamCalculator(IMeasures.PatchSize patchSize, int numberOfBins, double minPixelValue, double maxPixelValue)
UniformityParamCalculator(IMeasures.PatchSize patchSize, int indexOfNumberOfBins, int factor)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double[][]
calculateParameter(double[][] image)
This polymorphic method is designed to compute any of the 10 parameters at a time.void
setMaxPixelVal(double maxPixelVal)
void
setMinPixelVal(double minPixelVal)
-
-
-
Constructor Detail
-
UniformityParamCalculator
public UniformityParamCalculator(IMeasures.PatchSize patchSize, int numberOfBins, double minPixelValue, double maxPixelValue)
- Parameters:
patchSize
- size of each patch of the image the parameter should be calculated on.numberOfBins
- is used to get the histogram of colors based on which the probability should be calculated. A good choice could be one tenth of the sample size (i.e., 0.01*(maxPixelVal - minPixelVal).minPixelValue
- is the minimum intensity value of a pixel. For JPEG formats, it is 0, and for FITS files it is also 0, given that the data is cleaned and negative noises are removed.maxPixelValue
- is the maximum intensity value of a pixel. For JPEG formats, it is 255, and for FITS files it is 16383 (2^14).
Note: In case different mins and maxes are needed for different wavebands, use the provided setters where the methodcalculateParameter
is called. If this is the case, Use the other constructor which uses the index of nOfBins instead of nOfBins.
-
UniformityParamCalculator
public UniformityParamCalculator(IMeasures.PatchSize patchSize, int indexOfNumberOfBins, int factor)
- Parameters:
patchSize
- size of each patch of the image the parameter should be calculated on.indexOfNumberOfBins
- For the cases where the number of bins depends on the waveband, this argument allows to assign the number of bins in a generic way. This requires a prior knowledge about the minPixelVal and maxPixelVal. This can be achieved by calling the provided setters where the methodcalculateParameter
should be called.factor
- is a scalar by which the bin width of the color histogram will be divided. This is done by multiplying the max color intensity when nOfBins is to be generated (see,findNOfBinsForIndex_Bounded
in this method). In other words, with factor = 1 for min=0 and max=44, the number of bins that will be tried are {2,4,6, ..., 44} while for factor=10, for the same range, the set will be changed to {20, 41, ..., 440}. Set this to 1, if it should be ineffective.
-
-
Method Detail
-
calculateParameter
public double[][] calculateParameter(double[][] image)
Description copied from interface:IParamCalculator
This polymorphic method is designed to compute any of the 10 parameters at a time. It iterates over the given image, patch by patch, and then in every patch, pixel by pixel, to compute the parameter value for each patch.
Note: In all the classes, matrices are read and write, row by row.
Note: It is required that each class works independently, meaning that they must rely on their own computations. Therefore, some calculations (e.g. mean intensity value) might be calculated several times for different parameters (e.g. once for skewness and another time for std. deviation).
Note: No fixed range for the color intensity values of the given images is assumed. (colors do not have to be within the range [0,255].)- Specified by:
calculateParameter
in interfaceIParamCalculator
- Parameters:
image
- a 2D array representing the input image for which the parameter should be computed.- Returns:
- a 2D matrix whose each entry corresponds to the calculated parameter for one particular patch of the image.
-
setMinPixelVal
public void setMinPixelVal(double minPixelVal)
-
setMaxPixelVal
public void setMaxPixelVal(double maxPixelVal)
-
-