my goal is to take in an array of floats, make an image, resize the image, then read out an array of floats from the resized image.
The data I'm feeding into the image itself doesn't correspond to a true graphic, but I'm trying to find a work-around for interpolating data when resizing a float array.
From the research I've done it seems like the steps involved are:
- Create a WritableRaster object and feed it the float array
- Send that WritableRaster object into a BufferedImage object
- Resize the BufferedImage object (using bilinear interpolation)
- Somehow get a float array from the BufferedImage
Help, tips, and example code would be greatly appreciated!!! My brains fried today.
If you convert the floats to integers, you can create a
BufferedImage
out of them directly with usingBufferedImage.setRGB(int, int, int, int, int[], int, int)
Use
BufferedImage.getScaledInstance()
to scale it, then use the corresponding getRGB() method to the above setRGB().