public class CLImageConversion extends Object
Image
types
and CLImage2D
s for GPGPU acceleration.Modifier and Type | Method and Description |
---|---|
static com.nativelibs4java.opencl.CLImage2D |
convert(com.nativelibs4java.opencl.CLContext context,
FImage image)
Convert an
FImage to CLImage2D . |
static <I extends Image<?,I>> |
convert(com.nativelibs4java.opencl.CLContext context,
I image)
Convert an
Image to CLImage2D . |
static com.nativelibs4java.opencl.CLImage2D |
convert(com.nativelibs4java.opencl.CLContext context,
MBFImage image)
Convert an
MBFImage to an RGBA CLImage2D . |
static FImage |
convert(com.nativelibs4java.opencl.CLQueue queue,
com.nativelibs4java.opencl.CLEvent evt,
com.nativelibs4java.opencl.CLImage2D clImage,
FImage oiImage)
Convert a
CLImage2D to an FImage . |
static <I extends Image<?,I>> |
convert(com.nativelibs4java.opencl.CLQueue queue,
com.nativelibs4java.opencl.CLEvent evt,
com.nativelibs4java.opencl.CLImage2D clImage,
I oiImage)
Convert a
CLImage2D to an Image . |
static MBFImage |
convert(com.nativelibs4java.opencl.CLQueue queue,
com.nativelibs4java.opencl.CLEvent evt,
com.nativelibs4java.opencl.CLImage2D clImage,
MBFImage oiImage)
Convert a
CLImage2D to an MBFImage . |
static FImage |
convertFromFB(FloatBuffer fb,
int width,
int height,
FImage image)
Convert packed intensity pixels in a
FloatBuffer back into an
FImage . |
static MBFImage |
convertFromFB(FloatBuffer fb,
int width,
int height,
MBFImage image)
Convert packed RGBA pixels in a
FloatBuffer back into an
MBFImage . |
static FloatBuffer |
convertToFB(FImage image,
ByteOrder byteOrder)
Converts an FImage to a
FloatBuffer containing packed
intensity pixels. |
static FloatBuffer |
convertToFB(MBFImage image,
ByteOrder byteOrder)
Converts an
MBFImage to a FloatBuffer containing packed
RGBA pixels. |
public static FloatBuffer convertToFB(MBFImage image, ByteOrder byteOrder)
MBFImage
to a FloatBuffer
containing packed
RGBA pixels. If the byte order is BIG_ENDIAN then the data is
copied to a buffer on the Java heap which is then wrapped
by a FloatBuffer
. If the byte order is LITTLE_ENDIAN
then we allocate a direct buffer in system RAM and copy
the pixel values to that directly.image
- The image to convertbyteOrder
- the required byte order of the dataFloatBuffer
containing packed RGBA pixelspublic static FloatBuffer convertToFB(FImage image, ByteOrder byteOrder)
FloatBuffer
containing packed
intensity pixels. If the byte order is BIG_ENDIAN then the data is
copied to a buffer on the Java heap which is then wrapped
by a FloatBuffer
. If the byte order is LITTLE_ENDIAN
then we allocate a direct buffer in system RAM and copy
the pixel values to that directly.image
- The image to convertbyteOrder
- the required byte order of the dataFloatBuffer
containing packed intensity pixelspublic static com.nativelibs4java.opencl.CLImage2D convert(com.nativelibs4java.opencl.CLContext context, MBFImage image)
MBFImage
to an RGBA CLImage2D
.context
- the OpenCL contextimage
- the image to convertpublic static com.nativelibs4java.opencl.CLImage2D convert(com.nativelibs4java.opencl.CLContext context, FImage image)
FImage
to CLImage2D
.context
- the OpenCL contextimage
- the image to convertpublic static <I extends Image<?,I>> com.nativelibs4java.opencl.CLImage2D convert(com.nativelibs4java.opencl.CLContext context, I image)
Image
to CLImage2D
. MBFImage
s will
be converted to floating-point CLImageFormat.ChannelOrder.RGBA
CLImage2D
s.
FImage
s will be converted to either single band or RGBA floating-point
CLImage2D
s depending on the hardware. All other types of
image are converted by first converting to BufferedImage
s, and
will have 1-byte per band pixels (ARGB).I
- The type of image being convertedcontext
- the OpenCL contextimage
- the image to convertpublic static MBFImage convertFromFB(FloatBuffer fb, int width, int height, MBFImage image)
FloatBuffer
back into an
MBFImage
. The method takes the MBFImage
as an argument, and
will fill it accordingly. If the image argument is null, a new
MBFImage
with the RGBA ColourSpace
will be created.
If the given image is the wrong size, it will be resized. If the given
image has less than four bands, then only these bands will be filled.
Any bands above the fourth will be ignored.fb
- the FloatBuffer
containing the pixelswidth
- the widthheight
- the heightimage
- the image to write to or nullpublic static FImage convertFromFB(FloatBuffer fb, int width, int height, FImage image)
FloatBuffer
back into an
FImage
. The method takes the FImage
as an argument, and
will fill it accordingly. If the image argument is null, a new
FImage
will be created. If the given image is the wrong size,
it will be resized.fb
- the FloatBuffer
containing the pixelswidth
- the widthheight
- the heightimage
- the image to write to or nullpublic static MBFImage convert(com.nativelibs4java.opencl.CLQueue queue, com.nativelibs4java.opencl.CLEvent evt, com.nativelibs4java.opencl.CLImage2D clImage, MBFImage oiImage)
CLImage2D
to an MBFImage
.queue
- the CLQueue
evt
- event to wait forclImage
- the image to convertoiImage
- the output image (or null)public static FImage convert(com.nativelibs4java.opencl.CLQueue queue, com.nativelibs4java.opencl.CLEvent evt, com.nativelibs4java.opencl.CLImage2D clImage, FImage oiImage)
CLImage2D
to an FImage
.queue
- the CLQueue
evt
- event to wait forclImage
- the image to convertoiImage
- the output image (or null)public static <I extends Image<?,I>> I convert(com.nativelibs4java.opencl.CLQueue queue, com.nativelibs4java.opencl.CLEvent evt, com.nativelibs4java.opencl.CLImage2D clImage, I oiImage)
CLImage2D
to an Image
.I
- Type of imagequeue
- the CLQueue
evt
- event to wait forclImage
- the image to convertoiImage
- the output image (or null)