|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.lang.Thread | +--MedianSmooth
Code for the median smoothing algorithm.
Fields inherited from class java.lang.Thread |
MAX_PRIORITY,
MIN_PRIORITY,
NORM_PRIORITY |
Constructor Summary | |
MedianSmooth()
Default no-args constructor. |
Method Summary | |
boolean |
emptyKernel(int[] kernel)
Returns true if the kernel consists of all 0s. |
int[][] |
generateInputArrays(int[] input,
int width,
int height)
Converts a 1D array to a 2D array. |
int[] |
generateOutputArray(int[][] outputArrays,
int width,
int height)
Converts a 2D array to a 1D array. |
int |
getMax(java.util.ArrayList values)
Gets the maximum value from a list. |
int |
getMedian(java.util.ArrayList values)
Gets the median value from an input list by removing half of the maximum values and then returning the remaining maximum value or the mean of the two maximum values (if even number of elements). |
int |
medianNeighbour(int[][] input,
int[][] kernel,
int w,
int h,
int x,
int y)
Takes a 2D input image array and a kernel and a pixel location and calculates the new pixel value by calculating the median of its neighbours. |
java.util.ArrayList |
removeMax(java.util.ArrayList values)
Removes a single occurence of the maximum value from a list. |
int[] |
smooth_image(int[] input,
int[] kernel,
int width,
int height,
int iterations)
Takes an image and a kernel and smoothes the image the specified number of iterations. |
int[][] |
smooth(int[][] input,
int[][] kernel,
int width,
int height,
int iterations)
Takes an image and a kernel and smoothes the image the specified number of iterations. |
int[] |
smoothImage(int[] input,
int width,
int height,
int[] kernel,
int kernelWidth,
int kernelHeight,
int iterations)
Takes an image and a kernel and smoothes the image the specified number of iterations. |
Methods inherited from class java.lang.Thread |
activeCount,
checkAccess,
countStackFrames,
currentThread,
destroy,
dumpStack,
enumerate,
getContextClassLoader,
getName,
getPriority,
getThreadGroup,
interrupt,
interrupted,
isAlive,
isDaemon,
isInterrupted,
join,
join,
join,
resume,
run,
setContextClassLoader,
setDaemon,
setName,
setPriority,
sleep,
sleep,
start,
stop,
stop,
suspend,
toString,
yield |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Constructor Detail |
public MedianSmooth()
Method Detail |
public int getMax(java.util.ArrayList values)
values
- the list of values to be checkedpublic java.util.ArrayList removeMax(java.util.ArrayList values)
values
- the input listpublic int getMedian(java.util.ArrayList values)
values
- the input listpublic int medianNeighbour(int[][] input, int[][] kernel, int w, int h, int x, int y)
input
- the 2D image arraykernel
- the kernel arrayw
- the width of the input imageh
- the height of the input imagex
- the x coordinate of the pixel at the centre of the neighbourhoody
- the y coordinate of the pixel at the centre of the neighbourhoodpublic int[][] generateInputArrays(int[] input, int width, int height)
input
- the 1D arraywidth
- of the imageheight
- of the imagepublic int[] generateOutputArray(int[][] outputArrays, int width, int height)
outputArrays
- the 2D arraywidth
- of the imageheight
- of the imagepublic boolean emptyKernel(int[] kernel)
kernel
- the array representing the kernelpublic int[][] smooth(int[][] input, int[][] kernel, int width, int height, int iterations)
input
- the input image arraykernel
- the kernel arraywidth
- of the imageheight
- of the imageiterations
- to be carried outpublic int[] smooth_image(int[] input, int[] kernel, int width, int height, int iterations)
input
- the input image arraykernel
- the kernel arraywidth
- of the imageheight
- of the imageiterations
- to be carried outpublic int[] smoothImage(int[] input, int width, int height, int[] kernel, int kernelWidth, int kernelHeight, int iterations)
input
- the input image arraykernel
- the kernel arraywidth
- of the imageheight
- of the imageiterations
- to be carried out
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |