Как реализовать билинейную интерполяцию с использованием java? - PullRequest
0 голосов
/ 11 февраля 2020

Я пытаюсь изменить размер изображения с помощью билинейной интерполяции, но до сих пор я смог сделать только следующее до этого момента, и я не знаю, что делать дальше.

Я знаю, что мне нужно определить цвета для всех новых пикселей, но я не знаю, как установить новые пиксели в их новые цвета

public WritableImage resizeImage(WritableImage oldImage, float scaleX, float scaleY) {

    //Calculate the new width and height
    int newWidth =  (int) (oldImage.getWidth() * scaleX);
    int newHeight =  (int) (oldImage.getHeight() * scaleY);

    //Create a new image with the new width and height
    WritableImage newImage = new WritableImage(newWidth, newHeight);

    //create a pixel reader
    PixelWriter image_writer = newImage.getPixelWriter();

    for (int j = 0; j < newHeight; ++j) {
        for (int i = 0; i < newWidth; ++i) {
            float x = (float) (j * (newWidth/oldImage.getWidth()));
            float y = (float) (i * (newHeight/oldImage.getHeight()));



        }
    }
    return newImage;
}
...