|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.openimaj.image.feature.local.detector.mser.gui.ImageUtils
public class ImageUtils
Some useful image utility functions.
Nested Class Summary | |
---|---|
static class |
ImageUtils.ImagePanel
Draws an image scaled to the size of the component. |
Constructor Summary | |
---|---|
ImageUtils()
|
Method Summary | |
---|---|
static BufferedImage |
convertToGreyscale(BufferedImage img)
Converts the given image to a greyscale buffered image. |
static BufferedImage |
copyImage(BufferedImage source)
Creates a copy of a BufferedImage |
static void |
displayImage(BufferedImage img)
Displays the give image in a window. |
static byte[][] |
getGrayscaleData(BufferedImage img)
Returns grey-scale image data (0-255) for the given image. |
static BufferedImage |
getScaledInstance(BufferedImage img,
int targetWidthIn,
int targetHeightIn,
Object hint,
boolean higherQuality,
boolean keepAspect)
Convenience method that returns a scaled instance of the provided BufferedImage . |
static BufferedImage |
invertImage(BufferedImage img,
boolean newImage)
Inverts the given image. |
static BufferedImage |
loadImage(File f)
Load an image from the given file. |
static BufferedImage |
loadImage(InputStream in)
Load an image from the given input stream |
static void |
saveImage(OutputStream out,
BufferedImage image,
String formatName)
Writes the given image to the given output stream in the given format. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ImageUtils()
Method Detail |
---|
public static byte[][] getGrayscaleData(BufferedImage img)
img
- The image to return the greyscale data for.
public static BufferedImage convertToGreyscale(BufferedImage img)
img
- A colour image
public static BufferedImage copyImage(BufferedImage source)
source
- The image to copy
public static BufferedImage loadImage(File f)
f
- The file to load the image from
public static BufferedImage loadImage(InputStream in)
in
- The InputStream to load the image from
public static void saveImage(OutputStream out, BufferedImage image, String formatName)
out
- The output stream to write toimage
- The image to writeformatName
- The format to write the image inpublic static BufferedImage getScaledInstance(BufferedImage img, int targetWidthIn, int targetHeightIn, Object hint, boolean higherQuality, boolean keepAspect)
BufferedImage
.
From http://today.java.net/pub/a/today/2007/04/03/perils-of-image-getscaledinstance.html
img
- the original image to be scaledtargetWidthIn
- the desired width of the scaled instance,
in pixelstargetHeightIn
- the desired height of the scaled instance,
in pixelshint
- one of the rendering hints that corresponds to
RenderingHints.KEY_INTERPOLATION
(e.g.
RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR
,
RenderingHints.VALUE_INTERPOLATION_BILINEAR
,
RenderingHints.VALUE_INTERPOLATION_BICUBIC
)higherQuality
- if true, this method will use a multi-step
scaling technique that provides higher quality than the usual
one-step technique (only useful in downscaling cases, where
targetWidth
or targetHeight
is
smaller than the original dimensions, and generally only when
the BILINEAR
hint is specified)keepAspect
- if TRUE will make image fit within targetWidthIn x targetHeightIn
BufferedImage
public static BufferedImage invertImage(BufferedImage img, boolean newImage)
img
- The image to invertnewImage
- Whether to return a new image or invert the given image.
public static void displayImage(BufferedImage img)
img
- The image to display
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |