|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbr.usp.ime.klava.segmentit.util.ImageUtils
public class ImageUtils
Auxiliary class for image transformations.
Constructor Summary | |
---|---|
ImageUtils()
|
Method Summary | |
---|---|
static java.awt.image.BufferedImage |
getBoundaryImage(java.awt.image.BufferedImage input,
java.awt.Color borderColor)
Returns an image containing the boundary of the given input
image. |
static java.awt.Color |
getColor(int x,
int y,
java.awt.image.BufferedImage image)
Returns the Color of the pixel of at (x ,
y ) in the image . |
static java.awt.image.BufferedImage |
getFrame(int width,
int height,
java.awt.Color color)
Returns an image with a frame (first and last line and columns of pixels) painted |
static java.awt.image.BufferedImage |
getImageWithoutColor(java.awt.image.BufferedImage input,
java.awt.Color color)
Returns a new BufferedImage , removing color from
input . |
static java.awt.image.BufferedImage |
getNormalizedPotency(java.awt.image.BufferedImage image,
double alpha)
Return an image where the gray level of each output pixel is
given by the equation:
output = round(input^alpha * 255^(1-alpha)) ,
where round(x) returns the integer most close to
x and input is the gray level of the
corresponding pixel in the input image. |
static java.awt.image.BufferedImage |
getOuterBoundaryImage(java.awt.image.BufferedImage input,
java.awt.Color color)
Returns an image containing the outer boundary of the given input image. |
static java.awt.image.BufferedImage |
getScaledInstance(java.awt.image.BufferedImage input,
double scale)
Returns an scaled version of the input image. |
static java.awt.Color |
infersPartitionLinesColor(java.awt.image.BufferedImage image)
Infers the partition lines color of image . |
static java.awt.image.BufferedImage |
threshold(java.awt.image.BufferedImage image,
int level,
java.awt.Color color,
java.awt.Color backgroundColor)
Returns the threshold of image . |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ImageUtils()
Method Detail |
---|
public static java.awt.image.BufferedImage threshold(java.awt.image.BufferedImage image, int level, java.awt.Color color, java.awt.Color backgroundColor) throws ColorImageException
image
.
image
- the input imagelevel
- the gray level used as threshold levelcolor
- the color to paint the pixels that have gray level less than
or equal to level
backgroundColor
- the color to paint the pixels that have gray level greater
than level
, if null
they will be
transparent
image
ColorImageException
- if image
if not a gray level imagepublic static java.awt.image.BufferedImage getFrame(int width, int height, java.awt.Color color)
width
- the width of the frameheight
- the height of the framecolor
- the Color
of the frame
width x height
pixels colored in
color
public static java.awt.image.BufferedImage getScaledInstance(java.awt.image.BufferedImage input, double scale)
input
image.
input
- a BufferedImage
scale
- a scale factor for the desired output image
input
image (with its width
and height multiplied by scale
)public static java.awt.image.BufferedImage getOuterBoundaryImage(java.awt.image.BufferedImage input, java.awt.Color color)
input
image. Consider as foreground any pixels painted (with
any color) and as background any transparent pixels.
input
- the image whose outer boundary is wantedcolor
- the color used to paint the outer boundary
input
painted in color
public static java.awt.image.BufferedImage getBoundaryImage(java.awt.image.BufferedImage input, java.awt.Color borderColor)
input
image. The boundary pixels are the ones that have any neighbor of another
color.
input
- the image whose outer boundary is wantedborderColor
- the Color
to paint the border pixels
input
public static java.awt.image.BufferedImage getNormalizedPotency(java.awt.image.BufferedImage image, double alpha) throws ColorImageException
output
pixel is
given by the equation:
output = round(input^alpha * 255^(1-alpha))
,
where round(x)
returns the integer most close to
x
and input
is the gray level of the
corresponding pixel in the input image.
The parameter alpha
controls the brightness of the output
image:
alpha = 1
, the output image is the same as the input
image;alpha
in the interval ]0;1[
, the output
image is brighter than the input image;alpha
in the interval ]1;+Infinity)
,
the output image is darker than the input image.The gray levels of the output image are always in the interval [0;255], for input images whose gray levels are in the same interval.
image
- the gray level input imagealpha
- controls the brightness of the output image
alpha
ColorImageException
- if image
is not a gray level imagepublic static java.awt.Color getColor(int x, int y, java.awt.image.BufferedImage image)
Color
of the pixel of at (x
,
y
) in the image
.
x
- the x-coordinate of a pixely
- the y-coordinate of a pixelimage
-
Color
of the pixel of at (x
,
y
), null
if it is a transparent pixelpublic static java.awt.Color infersPartitionLinesColor(java.awt.image.BufferedImage image)
image
. If image
is
binary, returns the less used Color
in image
. Otherwise,
returns null
.
image
- a BufferedImage
image
public static java.awt.image.BufferedImage getImageWithoutColor(java.awt.image.BufferedImage input, java.awt.Color color)
BufferedImage
, removing color
from
input
.
input
- a BufferedImage
color
- a Color
BufferedImage
, removing color
from
input
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |