public class ConvertBufferedImage
extends java.lang.Object
BufferedImage.| Constructor and Description |
|---|
ConvertBufferedImage() |
| Modifier and Type | Method and Description |
|---|---|
static java.awt.image.BufferedImage |
checkCopy(java.awt.image.BufferedImage original,
java.awt.image.BufferedImage output)
Copies the original image into the output image.
|
static java.awt.image.BufferedImage |
checkDeclare(java.awt.image.BufferedImage template,
java.awt.image.BufferedImage target) |
static java.awt.image.BufferedImage |
checkDeclare(int width,
int height,
java.awt.image.BufferedImage image,
int type)
If the provided image does not have the same shape and same type a new one is declared and returned.
|
static java.awt.image.BufferedImage |
checkInputs(boofcv.struct.image.ImageBase src,
java.awt.image.BufferedImage dst)
If null the dst is declared, otherwise it checks to see if the 'dst' as the same shape as 'src'.
|
static <T extends boofcv.struct.image.ImageBase<T>> |
convertFrom(java.awt.image.BufferedImage src,
boolean orderRgb,
boofcv.struct.image.ImageType<T> imageType)
Converts a buffered image into an image of the specified type.
|
static <T extends boofcv.struct.image.ImageBase<T>> |
convertFrom(java.awt.image.BufferedImage src,
boolean orderRgb,
T output) |
static <T extends boofcv.struct.image.ImageBase> |
convertFrom(java.awt.image.BufferedImage src,
java.lang.Class type,
boolean orderRgb) |
static boofcv.struct.image.GrayF32 |
convertFrom(java.awt.image.BufferedImage src,
boofcv.struct.image.GrayF32 dst)
Converts the buffered image into an
GrayF32. |
static boofcv.struct.image.GrayU8 |
convertFrom(java.awt.image.BufferedImage src,
boofcv.struct.image.GrayU8 dst)
Converts the buffered image into an
GrayU8. |
static <T extends boofcv.struct.image.ImageBase<T>> |
convertFrom(java.awt.image.BufferedImage src,
T dst,
boolean orderRgb)
Converts a buffered image into an image of the specified type.
|
static <T extends boofcv.struct.image.GrayI16<T>> |
convertFrom(java.awt.image.BufferedImage src,
T dst,
java.lang.Class<T> type)
Converts the buffered image into an
GrayI16. |
static void |
convertFromInterleaved(java.awt.image.BufferedImage src,
boofcv.struct.image.ImageInterleaved dst,
boolean orderRgb) |
static <T extends boofcv.struct.image.ImageGray<T>> |
convertFromPlanar(java.awt.image.BufferedImage src,
boofcv.struct.image.Planar<T> dst,
boolean orderRgb,
java.lang.Class<T> type)
Converts the buffered image into an
Planar image of the specified ype. |
static <T extends boofcv.struct.image.ImageGray<T>> |
convertFromSingle(java.awt.image.BufferedImage src,
T dst,
java.lang.Class<T> type)
Converts a buffered image into an image of the specified type.
|
static java.awt.image.BufferedImage |
convertTo_F32(boofcv.struct.image.Planar<boofcv.struct.image.GrayF32> src,
java.awt.image.BufferedImage dst,
boolean orderRgb)
Converts a
Planar GrayF32 into a BufferedImage. |
static java.awt.image.BufferedImage |
convertTo_U8(boofcv.struct.image.Planar<boofcv.struct.image.GrayU8> src,
java.awt.image.BufferedImage dst,
boolean orderRgb)
Converts a
Planar GrayU8 into a BufferedImage. |
static java.awt.image.BufferedImage |
convertTo(boofcv.struct.image.GrayF32 src,
java.awt.image.BufferedImage dst)
Converts the buffered image into an
GrayF32. |
static java.awt.image.BufferedImage |
convertTo(boofcv.struct.image.GrayI16 src,
java.awt.image.BufferedImage dst)
Converts a
GrayI16 into a BufferedImage. |
static java.awt.image.BufferedImage |
convertTo(boofcv.struct.image.GrayU8 src,
java.awt.image.BufferedImage dst)
Converts a
GrayU8 into a BufferedImage. |
static java.awt.image.BufferedImage |
convertTo(boofcv.struct.image.ImageBase src,
java.awt.image.BufferedImage dst,
boolean orderRgb)
Converts an image into a BufferedImage.
|
static java.awt.image.BufferedImage |
convertTo(boofcv.struct.image.InterleavedF32 src,
java.awt.image.BufferedImage dst,
boolean orderRgb) |
static java.awt.image.BufferedImage |
convertTo(boofcv.struct.image.InterleavedU8 src,
java.awt.image.BufferedImage dst,
boolean orderRgb) |
static java.awt.image.BufferedImage |
convertTo(javax.swing.JComponent comp,
java.awt.image.BufferedImage storage)
Draws the component into a BufferedImage.
|
static java.awt.image.BufferedImage |
extractBuffered(boofcv.struct.image.GrayU8 img)
Creates a new BufferedImage that internally uses the same data as the provided
GrayU8.
|
static java.awt.image.BufferedImage |
extractBuffered(boofcv.struct.image.InterleavedU8 img)
Creates a new BufferedImage that internally uses the same data as the provided
InterleavedU8. |
static boofcv.struct.image.GrayU8 |
extractGrayU8(java.awt.image.BufferedImage img)
For BufferedImage stored as a byte array internally it extracts an
image.
|
static boofcv.struct.image.InterleavedU8 |
extractInterleavedU8(java.awt.image.BufferedImage img)
For BufferedImage stored as a byte array internally it extracts an
interleaved image.
|
static boolean |
isKnownByteFormat(java.awt.image.BufferedImage image)
Checks to see if it is a known byte format
|
static boolean |
isSubImage(java.awt.image.BufferedImage img)
Checks to see if the input image is a subImage().
|
static void |
orderBandsBufferedFromRGB(java.awt.image.DataBufferByte buffer,
java.awt.image.WritableRaster raster,
int type)
The image the BufferedImage was created from had RGB or RGBA color order.
|
static void |
orderBandsBufferedFromRGB(java.awt.image.DataBufferInt buffer,
java.awt.image.WritableRaster raster,
int type)
The image the BufferedImage was created from had RGB or RGBA color order.
|
static <T extends boofcv.struct.image.ImageGray<T>> |
orderBandsBufferedFromRgb(boofcv.struct.image.Planar<T> image,
java.awt.image.BufferedImage input) |
static boofcv.struct.image.Planar |
orderBandsIntoBuffered(boofcv.struct.image.Planar src,
java.awt.image.BufferedImage dst)
Returns a new image with the color bands in the appropriate ordering.
|
static void |
orderBandsIntoRGB(boofcv.struct.image.ImageInterleaved image,
java.awt.image.BufferedImage input) |
static void |
orderBandsIntoRGB(boofcv.struct.image.InterleavedF32 image,
java.awt.image.BufferedImage input) |
static void |
orderBandsIntoRGB(boofcv.struct.image.InterleavedU8 image,
java.awt.image.BufferedImage input) |
static <T extends boofcv.struct.image.ImageGray<T>> |
orderBandsIntoRGB(boofcv.struct.image.Planar<T> image,
java.awt.image.BufferedImage input)
If a Planar was created from a BufferedImage its colors might not be in the expected order.
|
static java.awt.image.BufferedImage |
stripAlphaChannel(java.awt.image.BufferedImage image)
Returns an image which doesn't have an alpha channel.
|
public static java.awt.image.BufferedImage checkDeclare(int width,
int height,
java.awt.image.BufferedImage image,
int type)
public static java.awt.image.BufferedImage checkDeclare(java.awt.image.BufferedImage template,
java.awt.image.BufferedImage target)
public static java.awt.image.BufferedImage checkCopy(java.awt.image.BufferedImage original,
java.awt.image.BufferedImage output)
original - Original imageoutput - (Optional) Storage for copy.public static java.awt.image.BufferedImage stripAlphaChannel(java.awt.image.BufferedImage image)
image - Input imagepublic static boofcv.struct.image.InterleavedU8 extractInterleavedU8(java.awt.image.BufferedImage img)
img - Image whose internal data is extracted and wrapped.public static boofcv.struct.image.GrayU8 extractGrayU8(java.awt.image.BufferedImage img)
img - Image whose internal data is extracted and wrapped.public static java.awt.image.BufferedImage extractBuffered(boofcv.struct.image.InterleavedU8 img)
InterleavedU8. If 3 bands then the image will be of type TYPE_3BYTE_BGR
or if 1 band TYPE_BYTE_GRAY.img - Input image who's data will be wrapped by the returned BufferedImage.public static java.awt.image.BufferedImage extractBuffered(boofcv.struct.image.GrayU8 img)
Creates a new BufferedImage that internally uses the same data as the provided GrayU8. The returned BufferedImage will be of type TYPE_BYTE_GRAY.
NOTE: This only works on images which are not subimages!
img - Input image who's data will be wrapped by the returned BufferedImage.public static <T extends boofcv.struct.image.ImageBase<T>> void convertFrom(java.awt.image.BufferedImage src,
T dst,
boolean orderRgb)
src - Input BufferedImage which is to be converteddst - The image which it is being converted intoorderRgb - If applicable, should it adjust the ordering of each color band to maintain color consistencypublic static <T extends boofcv.struct.image.ImageBase<T>> T convertFrom(java.awt.image.BufferedImage src,
boolean orderRgb,
boofcv.struct.image.ImageType<T> imageType)
src - Input BufferedImage which is to be convertedorderRgb - If applicable, should it adjust the ordering of each color band to maintain color consistencyimageType - Type of image it is to be converted intopublic static <T extends boofcv.struct.image.ImageBase<T>> T convertFrom(java.awt.image.BufferedImage src,
boolean orderRgb,
T output)
public static <T extends boofcv.struct.image.ImageGray<T>> T convertFromSingle(java.awt.image.BufferedImage src,
T dst,
java.lang.Class<T> type)
public static boofcv.struct.image.GrayU8 convertFrom(java.awt.image.BufferedImage src,
boofcv.struct.image.GrayU8 dst)
GrayU8. If the buffered image
has multiple channels the intensities of each channel are averaged together.src - Input image.dst - Where the converted image is written to. If null a new unsigned image is created.public static <T extends boofcv.struct.image.GrayI16<T>> T convertFrom(java.awt.image.BufferedImage src,
T dst,
java.lang.Class<T> type)
GrayI16. If the buffered image
has multiple channels the intensities of each channel are averaged together.src - Input image.dst - Where the converted image is written to. If null a new unsigned image is created.public static boofcv.struct.image.GrayF32 convertFrom(java.awt.image.BufferedImage src,
boofcv.struct.image.GrayF32 dst)
GrayF32. If the buffered image
has multiple channels the intensities of each channel are averaged together.src - Input image.dst - Where the converted image is written to. If null a new unsigned image is created.public static <T extends boofcv.struct.image.ImageGray<T>> boofcv.struct.image.Planar<T> convertFromPlanar(java.awt.image.BufferedImage src,
boofcv.struct.image.Planar<T> dst,
boolean orderRgb,
java.lang.Class<T> type)
Planar image of the specified ype.src - Input image. Not modified.dst - Output. The converted image is written to. If null a new unsigned image is created.orderRgb - If applicable, should it adjust the ordering of each color band to maintain color consistency.
Most of the time you want this to be true.type - Which type of data structure is each band. (GrayU8 or GrayF32)public static <T extends boofcv.struct.image.ImageBase> T convertFrom(java.awt.image.BufferedImage src,
java.lang.Class type,
boolean orderRgb)
public static void convertFromInterleaved(java.awt.image.BufferedImage src,
boofcv.struct.image.ImageInterleaved dst,
boolean orderRgb)
public static java.awt.image.BufferedImage convertTo(boofcv.struct.image.ImageBase src,
java.awt.image.BufferedImage dst,
boolean orderRgb)
Converts an image into a BufferedImage. The best way to think of this function is that it's a mindless typecast. If you don't provide an output image then it will create one. However there isn't always a direct equivalent between a BoofCV image and BufferedImage internal type. A "reasonable" choice will be made, but for your application it might not be a good choice.
src - Input image. Pixels must have a value from 0 to 255.dst - Where the converted image is written to. If null a new image is created. See comment above about type.orderRgb - If applicable, should it change the order of the color bands (assumed RGB or ARGB) into the
order based on BufferedImage.TYPE. Most of the time you want this to be true.public static java.awt.image.BufferedImage convertTo(boofcv.struct.image.GrayU8 src,
java.awt.image.BufferedImage dst)
GrayU8 into a BufferedImage. If the buffered image
has multiple channels then the input image is copied into each channel.src - Input image.dst - Where the converted image is written to. If null a new image is created.public static java.awt.image.BufferedImage convertTo(boofcv.struct.image.GrayI16 src,
java.awt.image.BufferedImage dst)
GrayI16 into a BufferedImage. If the buffered image
has multiple channels then the input image is copied into each channel.src - Input image.dst - Where the converted image is written to. If null a new image is created.public static java.awt.image.BufferedImage convertTo(boofcv.struct.image.GrayF32 src,
java.awt.image.BufferedImage dst)
GrayF32. If the buffered image
has multiple channels then the input image is copied into each channel. The floating
point image is assumed to be between 0 and 255.src - Input image.dst - Where the converted image is written to. If null a new image is created.public static java.awt.image.BufferedImage convertTo_U8(boofcv.struct.image.Planar<boofcv.struct.image.GrayU8> src,
java.awt.image.BufferedImage dst,
boolean orderRgb)
Planar GrayU8 into a BufferedImage.src - Input image.dst - Where the converted image is written to. If null a new image is created.orderRgb - If applicable, should it change the order of the color bands (assumed RGB or ARGB) into the
order based on BufferedImage.TYPE. Most of the time you want this to be true.public static java.awt.image.BufferedImage convertTo_F32(boofcv.struct.image.Planar<boofcv.struct.image.GrayF32> src,
java.awt.image.BufferedImage dst,
boolean orderRgb)
Planar GrayF32 into a BufferedImage.src - Input image.dst - Where the converted image is written to. If null a new image is created.orderRgb - If applicable, should it change the order of the color bands (assumed RGB or ARGB) into the
order based on BufferedImage.TYPE. Most of the time you want this to be true.public static java.awt.image.BufferedImage convertTo(boofcv.struct.image.InterleavedU8 src,
java.awt.image.BufferedImage dst,
boolean orderRgb)
public static java.awt.image.BufferedImage convertTo(boofcv.struct.image.InterleavedF32 src,
java.awt.image.BufferedImage dst,
boolean orderRgb)
public static java.awt.image.BufferedImage checkInputs(boofcv.struct.image.ImageBase src,
java.awt.image.BufferedImage dst)
public static java.awt.image.BufferedImage convertTo(javax.swing.JComponent comp,
java.awt.image.BufferedImage storage)
comp - The component being drawn into an image.storage - if not null the component is drawn into it, if null a new BufferedImage is created.public static boofcv.struct.image.Planar orderBandsIntoBuffered(boofcv.struct.image.Planar src,
java.awt.image.BufferedImage dst)
public static void orderBandsBufferedFromRGB(java.awt.image.DataBufferByte buffer,
java.awt.image.WritableRaster raster,
int type)
public static void orderBandsBufferedFromRGB(java.awt.image.DataBufferInt buffer,
java.awt.image.WritableRaster raster,
int type)
public static <T extends boofcv.struct.image.ImageGray<T>> void orderBandsIntoRGB(boofcv.struct.image.Planar<T> image,
java.awt.image.BufferedImage input)
public static <T extends boofcv.struct.image.ImageGray<T>> void orderBandsBufferedFromRgb(boofcv.struct.image.Planar<T> image,
java.awt.image.BufferedImage input)
public static void orderBandsIntoRGB(boofcv.struct.image.ImageInterleaved image,
java.awt.image.BufferedImage input)
public static void orderBandsIntoRGB(boofcv.struct.image.InterleavedU8 image,
java.awt.image.BufferedImage input)
public static void orderBandsIntoRGB(boofcv.struct.image.InterleavedF32 image,
java.awt.image.BufferedImage input)
public static boolean isKnownByteFormat(java.awt.image.BufferedImage image)
public static boolean isSubImage(java.awt.image.BufferedImage img)
img -