public class ImageConversion extends Object
| Constructor and Description |
|---|
ImageConversion() |
| Modifier and Type | Method and Description |
|---|---|
static BufferedImage |
convertRenderedImage(RenderedImage img) |
static BufferedImage |
convertTo(RenderedImage src,
int imageType) |
static int |
convertToDataType(int cvType) |
static RenderedImage |
fixSignedShortDataBuffer(RenderedImage source)
Bug fix: CLibImageReader and J2KImageReaderCodecLib (imageio libs) do not handle negative values for short data.
|
static Rectangle |
getBounds(PlanarImage img) |
static byte[] |
getPackedBinaryData(Raster raster,
Rectangle rect)
For the case of binary data (
isBinary() returns true), return the binary data as a
packed byte array. |
static byte[] |
getUnpackedBinaryData(Raster raster,
Rectangle rect)
Returns the binary data unpacked into an array of bytes.
|
static boolean |
isBinary(SampleModel sm) |
static void |
releaseMat(org.opencv.core.Mat mat) |
static void |
releasePlanarImage(PlanarImage img) |
static void |
setPackedBinaryData(byte[] binaryDataArray,
WritableRaster raster,
Rectangle rect)
Sets the supplied
Raster's data from an array of packed binary data of the form returned by
getPackedBinaryData(). |
static void |
setUnpackedBinaryData(byte[] bdata,
WritableRaster raster,
Rectangle rect)
Copies data into the packed array of the
Raster from an array of unpacked data of the form returned
by getUnpackedBinaryData(). |
static BufferedImage |
toBufferedImage(org.opencv.core.Mat matrix)
Converts/writes a Mat into a BufferedImage.
|
static BufferedImage |
toBufferedImage(PlanarImage matrix) |
static ImageCV |
toMat(RenderedImage img) |
static ImageCV |
toMat(RenderedImage img,
Rectangle region) |
static ImageCV |
toMat(RenderedImage img,
Rectangle region,
boolean toBGR) |
public static BufferedImage toBufferedImage(org.opencv.core.Mat matrix)
matrix - the matpublic static BufferedImage toBufferedImage(PlanarImage matrix)
public static void releaseMat(org.opencv.core.Mat mat)
public static void releasePlanarImage(PlanarImage img)
public static int convertToDataType(int cvType)
public static ImageCV toMat(RenderedImage img)
public static ImageCV toMat(RenderedImage img, Rectangle region)
public static ImageCV toMat(RenderedImage img, Rectangle region, boolean toBGR)
public static Rectangle getBounds(PlanarImage img)
public static BufferedImage convertTo(RenderedImage src, int imageType)
public static boolean isBinary(SampleModel sm)
public static byte[] getPackedBinaryData(Raster raster, Rectangle rect)
isBinary() returns true), return the binary data as a
packed byte array. The data will be packed as eight bits per byte with no bit offset, i.e., the first bit in each
image line will be the left-most of the first byte of the line. The line stride in bytes will be
(int)((getWidth()+7)/8). The length of the returned array will be the line stride multiplied by
getHeight()raster - the Rasterrect - the Rectanglenull if the data are not
binary.IllegalArgumentException - if isBinary() returns false with the SampleModel of the
supplied Raster as argument.public static byte[] getUnpackedBinaryData(Raster raster, Rectangle rect)
Raster.raster - the Rasterrect - the Rectanglenull if the data are not
binary.IllegalArgumentException - if isBinary() returns false with the SampleModel of the
supplied Raster as argument.public static void setPackedBinaryData(byte[] binaryDataArray,
WritableRaster raster,
Rectangle rect)
Raster's data from an array of packed binary data of the form returned by
getPackedBinaryData().binaryDataArray - the byteraster - the WritableRasterrect - the RectangleIllegalArgumentException - if isBinary() returns false with the SampleModel of the
supplied Raster as argument.public static void setUnpackedBinaryData(byte[] bdata,
WritableRaster raster,
Rectangle rect)
Raster from an array of unpacked data of the form returned
by getUnpackedBinaryData().
If the data are binary, then the target bit will be set if and only if the corresponding byte is non-zero.
bdata - the byteraster - the WritableRasterrect - the RectangleIllegalArgumentException - if isBinary() returns false with the SampleModel of the
supplied Raster as argument.public static RenderedImage fixSignedShortDataBuffer(RenderedImage source)
source - the RenderedImagepublic static BufferedImage convertRenderedImage(RenderedImage img)
Copyright © 2020. All rights reserved.