public class KMeansImageClustering extends ImageProcessingTask
Changes
Thread.State, Thread.UncaughtExceptionHandler
Modifier and Type | Field and Description |
---|---|
private int[] |
aPixel |
private int[] |
clusterAssignmentCount |
private float[][] |
clusterCenters |
private double |
epsilon |
private boolean |
finished |
private int |
height |
private int[] |
inputData |
private int |
iteration |
private int |
maxIterations |
private int |
numBands |
private int |
numClusters |
private short[][] |
outputData |
private long |
position |
private javax.media.jai.TiledImage |
pOutput |
private double |
sumOfDistances |
private int |
width |
isCancelable, parentTask, virtual
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
Constructor and Description |
---|
KMeansImageClustering(javax.media.jai.PlanarImage pInput,
int numClusters,
int maxIterations,
double epsilon,
char initMode)
The constructor for the class, which sets the input image, the number of
desired clusters, the maximum number of iterations, a value that will be
used to decide whether the convergence has stopped and the initial
clusters centers initialization mode.
|
Modifier and Type | Method and Description |
---|---|
private short |
getClassFor(int[] pixel)
This auxiliary method gets the class for a pixel vector.
|
float[][] |
getClusterCenters()
This method returns the cluster centers.
|
private double[] |
getExtrema(javax.media.jai.PlanarImage image)
This method returns a two-element array with the minimum and maximum
values found in a PlanarImage.
|
String |
getInfo()
This method returns some information about the task (its progress).
|
javax.media.jai.TiledImage |
getOutput()
This method returns the output image.
|
long |
getPosition()
This method returns a measure of the progress of the algorithm.
|
long |
getSize()
This method returns the estimated size (steps) for this task.
|
boolean |
isFinished()
This method returns true if the clustering has finished.
|
void |
run()
This method performs the bulk of the processing.
|
addProgressListener, fireProgressChanged, getParentTask, getPcs, getProgressListeners, isCancelable, isCancelled, isVirtual, setCancelable, setParentTask, setPcs, setVirtual
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
private javax.media.jai.TiledImage pOutput
private int width
private int height
private int numBands
private int maxIterations
private int numClusters
private int iteration
private double sumOfDistances
private double epsilon
private boolean finished
private long position
private float[][] clusterCenters
private int[] clusterAssignmentCount
private int[] inputData
private int[] aPixel
private short[][] outputData
public KMeansImageClustering(javax.media.jai.PlanarImage pInput, int numClusters, int maxIterations, double epsilon, char initMode)
pInput
- the input planar image.numClusters
- the desired number of clusters.maxIterations
- the maximum number of iterations.epsilon
- a small value used to verify if clustering has converged.initMode
- the initialization mode: 'R' for random values, 'S' for evenly
spaced values, 'D' for randomly sampled data values.private double[] getExtrema(javax.media.jai.PlanarImage image)
image
- the input PlanarImage.public void run()
run
in interface Runnable
run
in class ImageProcessingTask
private short getClassFor(int[] pixel)
public javax.media.jai.TiledImage getOutput()
public long getSize()
getSize
in class ImageProcessingTask
public long getPosition()
getPosition
in class ImageProcessingTask
public boolean isFinished()
isFinished
in class ImageProcessingTask
public String getInfo()
public float[][] getClusterCenters()
Copyright © 2009–2016 Helmut Ahammer, Philipp Kainz. All rights reserved.