I feel like I'm converting when I don't need to be, and that there is likely a much more direct path.
Input: A short lived org.bytedeco.javacv.Frame read from a FFmpegFrameGrabber.
Output: the image fully decoded and normalized in a very basic format of:
class DecodedImage(
internal val width: Int,
internal val height: Int,
private val red: IntArray = IntArray(width * height),
private val green: IntArray = IntArray(width * height),
private val blue: IntArray = IntArray(width * height),
)
Ints per channel per pixel are a lot, but I need them for some later summing.
Right now I'm using a Java2DFrameConverter to convert the Frame to a BufferedImage, then reading out pixels from the BufferedImage -> Raster -> dataBuffer.
That seems... excessive. Is there a more direct way of blowing out a Frame to a fully flattened DecodedImage? I poked around in the Java2DFrameConverter, and it handles a lot of image formats.
I feel like I'm converting when I don't need to be, and that there is likely a much more direct path.
Input: A short lived
org.bytedeco.javacv.Frame
read from a FFmpegFrameGrabber.Output: the image fully decoded and normalized in a very basic format of:
Ints per channel per pixel are a lot, but I need them for some later summing.
Right now I'm using a
Java2DFrameConverter
to convert theFrame
to aBufferedImage
, then reading out pixels from theBufferedImage
->Raster
->dataBuffer
.That seems... excessive. Is there a more direct way of blowing out a
Frame
to a fully flattenedDecodedImage
? I poked around in the Java2DFrameConverter, and it handles a lot of image formats.