|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.ObjectHTPprocessor
public class HTPprocessor
HTPprocessor
Contains all methods which are used for the image classification process.
| Constructor Summary | |
|---|---|
HTPprocessor()
|
|
| Method Summary | |
|---|---|
boolean |
allPixelsOnTheCircleAroundXYAreInTheSameClass(int[][] CLASSES,
int radius,
int x,
int y)
Tests whether all pixel on a circle around point (x,y) with given radius are of the same class. |
void |
classifyByColorRange(ij.ImagePlus img,
int[][] CLASSES,
java.util.ArrayList<int[]> colorRanges,
int classNumber)
Wrapper for the method classifyByColorRange. |
void |
classifyByColorRange(ij.ImagePlus img,
int[][] CLASSES,
java.util.Hashtable<java.lang.String,java.util.ArrayList<int[]>> color2class,
java.util.Hashtable<java.lang.String,java.lang.Integer> class2number,
java.lang.String[] allowedClasses,
java.util.Hashtable<java.lang.String,java.lang.String> currentRegion)
Classifies the image according to given colour regions. |
void |
classifyByColorRange(ij.ImagePlus img,
int[][] CLASSES,
int[] colorRange,
int classNumber)
Classifies all pixel of the image according to the given colour range, marked as classified in the CLASSES classification array for a specified class. |
double |
EuclideanDistance_PixelToClass_HSV(ij.ImagePlus imgRGB,
int x1,
int y1,
int[] colorRange)
Calculates the Euclidean distance of a pixel to the specified HSV colour range. |
double |
EuclideanDistance_PixelToClass_RGBHSV(ij.ImagePlus imgRGB,
int x,
int y,
int[] colorRange)
Calculates the Euclidean distance of a pixel to the specified RGB and HSV colour range. |
double |
EuclideanDistance_PixelToPixel_RGBHSV(ij.ImagePlus imgRGB,
int x1,
int y1,
int x2,
int y2)
Calculates the Euclidean distance between two pixels. |
void |
fillSingleHoles(int[][] CLASSES)
Wrapper for the method fillSingleHoles. |
void |
fillSingleHoles(int[][] CLASSES,
int radius)
Classifies a pixel (x,y) if all neighbours on a circle around (x,y) are in the same class. |
ij.ImagePlus |
getEmptyImageCopy(ij.ImagePlus img)
Returns a new, empty image of identical dimensions. |
ij.ImagePlus |
getImageCopy(ij.ImagePlus img)
Returns a copy of the image. |
ij.ImagePlus |
getImageCopyHSV(ij.ImagePlus img)
Creates the HSV copy of an RGB image. |
boolean |
pixelIsInHSVRange(ij.ImagePlus img,
int col,
int row,
int[] range)
Checks whether the HSV colour values of a pixel are within a certain colour range. |
boolean |
pixelIsInRange(ij.ImagePlus img,
int col,
int row,
int[] range)
Checks whether the colour values of a pixel are within a certain colour range. |
boolean |
pixelIsInRGBHSVRange(ij.ImagePlus img,
int col,
int row,
int[] range)
Checks whether the RGB and HSV coulor values of a pixel are within a certain colour range. |
boolean |
pixelIsInRGBRange(ij.ImagePlus img,
int col,
int row,
int[] range)
Checks whether the RGB colour values of a pixel are within a certain colour range. |
void |
removeNonConnectedClassClusters(int[][] CLASSES,
int classNumber,
int radiusOne,
int radiusTwo)
Removes non-connected cluster of a specified class depending on two specified circumcircle. |
void |
removeSinglePixels(int[][] CLASSES,
int threshold)
Removes pixel which neighbourhood of 8 pixel does not contain at least the given number of pixel in the same class. |
void |
RGBSimilarity(ij.ImagePlus img,
int[][] CLASSES)
Classifies the remaining pixel according to their local neighbourhood and the Euclidean distance to those neighbours. |
int |
RGBtoHSV(int RGB)
Provides RGB to HSV conversion for a single RGB value. |
int[] |
RGBtoHSV(int[] RGB)
Provides RGB to HSV conversion for a RGB array. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public HTPprocessor()
| Method Detail |
|---|
public int[] RGBtoHSV(int[] RGB)
RGB - An Array of RGB colour values.
Array of HSV colour values.public int RGBtoHSV(int RGB)
RGB - A single RGB colour values.
public boolean pixelIsInRange(ij.ImagePlus img,
int col,
int row,
int[] range)
img - An ImagePlus object containing the original image.col - The column which defines the position of an pixel in the image.row - The row which defines the position of an pixel in the image.range - An Array containing the minimal and maximal colour values for RGB and HSV.
public boolean pixelIsInRGBRange(ij.ImagePlus img,
int col,
int row,
int[] range)
img - An ImagePlus object containing the original image.col - The column which defines the position of an pixel in the image.row - The row which defines the position of an pixel in the image.range - An Array containing the minimal and maximal colour values for RGB.
public boolean pixelIsInRGBHSVRange(ij.ImagePlus img,
int col,
int row,
int[] range)
img - An ImagePlus object containing the original image.col - The column which defines the position of an pixel in the image.row - The row which defines the position of an pixel in the image.range - An Array containing the minimal and maximal colour values for RGB and HSV.
public boolean pixelIsInHSVRange(ij.ImagePlus img,
int col,
int row,
int[] range)
img - An ImagePlus object containing the original image.col - The column which defines the position of an pixel in the image.row - The row which defines the position of an pixel in the image.range - An Array containing the minimal and maximal colour values for HSV.
public ij.ImagePlus getImageCopy(ij.ImagePlus img)
img - An ImagePlus object.
ImagePlus object.public ij.ImagePlus getEmptyImageCopy(ij.ImagePlus img)
img - An ImagePlus object.
ImagePlus object.public ij.ImagePlus getImageCopyHSV(ij.ImagePlus img)
img - An ImagePlus object.
ImagePlus object in HSV.
public double EuclideanDistance_PixelToClass_RGBHSV(ij.ImagePlus imgRGB,
int x,
int y,
int[] colorRange)
imgRGB - An ImagePlus object of RGB colour values.x - The column which defines the position of an pixel in the image.y - The row which defines the position of an pixel in the image.colorRange - An Array containing the minimal and maximal colour values for RGB and HSV.
public double EuclideanDistance_PixelToClass_HSV(ij.ImagePlus imgRGB,
int x1,
int y1,
int[] colorRange)
imgRGB - An ImagePlus object of RGB colour values.x - The column which defines the position of an pixel in the image.y - The row which defines the position of an pixel in the image.colorRange - An Array containing the minimal and maximal colour values for HSV.
public double EuclideanDistance_PixelToPixel_RGBHSV(ij.ImagePlus imgRGB,
int x1,
int y1,
int x2,
int y2)
imgRGB - An ImagePlus object of RGB colour values.x1 - The column which defines the position of an pixel in the image.y1 - The row which defines the position of an pixel in the image.x2 - The column which defines the position of another pixel in the image.y2 - The row which defines the position of another pixel in the image.
public void RGBSimilarity(ij.ImagePlus img,
int[][] CLASSES)
img - An ImagePlus object.CLASSES - A 2-dimensional Array containing the colour classification information for each pixel in the image.
forall pixels p
if (p is already classified) continue;
forall neighbours n of p, that are at worst "searchRadius" away
keep track of the number of occurences of each class;
remember the neighbour with the lowest RGBHSV distance to p,
but never choose plant over anything else;
endfor;
if ( most frequent neighbour class == plant &&
class with smallest RGB distance == plant &&
smallest RGB distance <= 150 ) classify p as "plant";
else if ( class with smallest RGB distance != plant )
classify p as smallest-RGB-distance-class;
endfor;
Future improvement is to fine tune the decision process (e.g. consider the most frequent neighbour).public void fillSingleHoles(int[][] CLASSES)
CLASSES - A 2-dimensional Array containing the colour classification information for each pixel in the image.
public void fillSingleHoles(int[][] CLASSES,
int radius)
CLASSES - A 2-dimensional Array containing the colour classification information for each pixel in the image.radius - An Integer which defines a radius of a circle.
forall pixels p
if (p is already classified) continue;
if (all pixel on the circle around p are of the same class)
classify p accordingly;
endfor;
public boolean allPixelsOnTheCircleAroundXYAreInTheSameClass(int[][] CLASSES,
int radius,
int x,
int y)
CLASSES - A 2-dimensional Array containing the colour classification information for each pixel in the image.radius - An Integer which defines a radius of a circle.x - The column which defines the position of an pixel in the image.y - The row which defines the position of an pixel in the image.
public void removeSinglePixels(int[][] CLASSES,
int threshold)
CLASSES - A 2-dimensional Array containing the colour classification information for each pixel in the image.threshold - Defines the allowed number of neighbours to keep this pixel classified.
public void removeNonConnectedClassClusters(int[][] CLASSES,
int classNumber,
int radiusOne,
int radiusTwo)
CLASSES - A 2-dimensional Array containing the colour classification information for each pixel in the image.classNumber - An Integer containing the number of the class.radiusOne - An Integer which defines a radius of a circle.radiusTwo - An Integer which defines a radius of another circle.
public void classifyByColorRange(ij.ImagePlus img,
int[][] CLASSES,
int[] colorRange,
int classNumber)
img - An ImagePlus object.CLASSES - A 2-dimensional Array containing the colour classification information for each pixel in the image.colorRange - An Array containing the minimal and maximal colour values for RGB and HSV.classNumber - An Integer containing the number of the class.
public void classifyByColorRange(ij.ImagePlus img,
int[][] CLASSES,
java.util.ArrayList<int[]> colorRanges,
int classNumber)
img - An ImagePlus object.CLASSES - A 2-dimensional Array containing the colour classification information for each pixel in the image.colorRange - An ArrayList containing the minimal and maximal colour values for RGB and HSV of all color range arrays.classNumber - An Integer containing the number of the class.
public void classifyByColorRange(ij.ImagePlus img,
int[][] CLASSES,
java.util.Hashtable<java.lang.String,java.util.ArrayList<int[]>> color2class,
java.util.Hashtable<java.lang.String,java.lang.Integer> class2number,
java.lang.String[] allowedClasses,
java.util.Hashtable<java.lang.String,java.lang.String> currentRegion)
img - An ImagePlus object.CLASSES - A 2-dimensional Array containing the colour classification information for each pixel in the image.color2class - A Hashtable of colour values for each class.class2number - A Hashtable of numbers for each class.allowedClasses - A Array of classes to be classified (if null all classes are classified).currentRegion - A Hashtable to limit the classification process to the given region (if null whole image is classified).
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||