|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectno.hiof.imagepr.filters.LocalHistogramFilter
This class contain two methods which filter an image using local histogram equalization. The difference between these two methods is that one method receives and returns an image, the other method receives and returns a matrix. If you call the matrix-method, the matrix should be the intensityvalues of an intensityimage or the V-values of a HSV-image. This is the most common way to filter images using local histogram equalization. Although you can also use the matrix-method to filter the R-, G- and B-components in a RGB-image or the H- and/or S-component of a HSV-image if that is what best serve your application.
The user has three option of how the edges should be handled (By "edges" it's ment the pixels in the input-image that are so close to the edges that the local-histogram-mask can't be placed so the pixel is in center of the mask):
This filter is implemented in a quite efficient way. This is done by just creating a new histogram for every row, not for every pixel. For all pixels, except for the first pixel on a row, the histogram is updated instead of recreated.
This gives the following estimate of how long time the filter will use to process the image: - If the edges are filtered (point 3 above): a(X * x * y) + b(X * Y * x) + c(64 * X * Y) - Otherwise (point 1 and 2 above): a((X - x) * x * y) + b((X - x) * (Y - y) * x) + c(64 * (X - x) * (Y - y)) X is the heigth of the image. Y is the width of the image. x is the heigth of the mask. y is the width of the mask. a, b and c are constants.
It's important to notice that this is only a rough estimate, and must of course be multiplied by a faktor that depends on your hardware and OS.
If the user wants to filter an intensityimage, the intensityvalues of the image are filtered using local histogram equalization. If the user wants to filter a colorimage, the image is convered into a HSV-image (if isn't a HSV-image already), then the V-component of the image are filtered using local histogram equalization.
Please notice that an LocalHistogramFilter-object only stores the filterparameters. It is not able to store the image itself.
Currently this filter can handle images of type IntensityImage, RGBImage, HSIImage and HSVImage. In all others cases the filter will return a null-pointer. The filter also return a null-pointer if the filtering-process for some reason failed.
Authors: Algoritm and testing by Øystein Igeland and Magnus Komperød. Implemented by Magnus Komperød.
| Field Summary | |
static int |
BLACK_EDGES
The edges will be croped when the image is filtered. |
static int |
CROP_EDGES
The edges will be croped when the image is filtered. |
static int |
DARK_GRAY_EDGES
The edges will be croped when the image is filtered. |
static int |
FILTER_EDGES
The edges will be filtered when the image is filtered. |
static int |
GRAY_EDGES
The edges will be croped when the image is filtered. |
static int |
LIGHT_GRAY_EDGES
The edges will be croped when the image is filtered. |
static int |
WHITE_EDGES
The edges will be croped when the image is filtered. |
| Constructor Summary | |
LocalHistogramFilter()
Constuctor that sets the filterparameters to the default values (maskHeight = maskWidth = 3 and edgeType = FILTER_EDGES) |
|
LocalHistogramFilter(int maskHeight,
int maskWidth,
int edgeType)
Constructor that sets the filterparameters to the values specified by the user. |
|
| Method Summary | |
no.hiof.imagepr.Image |
filter(no.hiof.imagepr.Image image)
Filter an image using local-histogram-equalization. |
short[][] |
filter(short[][] matrix)
Filter a matrix using local-histogram-equalization. |
int |
getEdgeType()
|
int |
getMaskHeight()
|
int |
getMaskWidth()
|
int |
setEdgeType(int type)
Sets the type of edge that the filtered image will get. |
int |
setFilterParam(int maskHeight,
int maskWidth,
int edgeType)
Update the filterparameters (maskHeight, maskWidth and edgeType) |
int |
setMaskHeight(int height)
Sets the maskheight. |
int |
setMaskWidth(int width)
Sets the maskwidth. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int CROP_EDGES
public static final int FILTER_EDGES
public static final int BLACK_EDGES
public static final int DARK_GRAY_EDGES
public static final int GRAY_EDGES
public static final int LIGHT_GRAY_EDGES
public static final int WHITE_EDGES
| Constructor Detail |
public LocalHistogramFilter()
public LocalHistogramFilter(int maskHeight,
int maskWidth,
int edgeType)
maskHeight - Must be an odd number, and equal to or greater than 3.maskWidth - Must be an odd number, and equal to or greater than 3.edgeType - Must be BLACK_EDGES, DARK_GARY_EDGES, GRAY_EDGES, LIGHT_GRAY_EDGES, WHITE_EGDES, FILTER_EDGES, CROP_EDGES or an integer in the range 0 - 255.| Method Detail |
public int setMaskHeight(int height)
height - Must be an odd number, and equal to or greater than 3.
public int setMaskWidth(int width)
width - Must be an odd number, and equal to or greater than 3.
public int setEdgeType(int type)
type - Must be BLACK_EDGES, DARK_GARY_EDGES, GRAY_EDGES, LIGHT_GRAY_EDGES, WHITE_EGDES, FILTER_EDGES, CROP_EDGES or an integer in the range 0 - 255.
public int setFilterParam(int maskHeight,
int maskWidth,
int edgeType)
maskHeight - Must be an odd number, and equal to or greater than 3.maskWidth - Must be an odd number, and equal to or greater than 3.edgeType - Must be BLACK_EDGES, DARK_GARY_EDGES, GRAY_EDGES, LIGHT_GRAY_EDGES, WHITE_EGDES, FILTER_EDGES, CROP_EDGES or an integer in the range 0 - 255.
public int getMaskHeight()
public int getMaskWidth()
public int getEdgeType()
public no.hiof.imagepr.Image filter(no.hiof.imagepr.Image image)
filter in interface no.hiof.imagepr.filters.ImageFilterimage - The image to be filtered (input-image).
public short[][] filter(short[][] matrix)
filter in interface no.hiof.imagepr.filters.ImageFiltermatrix - The matrix to be filtered. The matrix should be the intensityvalues of an intensityimage or the V-value of an HSV-image.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||