Hi there! i have to create a class that tests my morph method. My method morphs one image to another in "k" steps. i was just hoping if someone could check over my method and also give me any pointers on how to create a testMorphing class that morphs one image to another using 3 steps (so startPicture -> p1 -> p2 -> p3 -> endPicture) and also how i can change if i need to do it in 9 steps?

this is my morph method:

PHP Code:
public void morphStage(Picture startPicture, Picture endPicture, int numStages, int k)
 {
   
   Pixel[] pixelArrayStart = startPicture.getPixels(); 
   Pixel[] pixelArrayEnd = endPicture.getPixels();
   Pixel[][][] pixelRGB = null;
   Pixel pixelObjStart = null;
   Pixel pixelObjEnd = null;
   Pixel pixelObjNew = null;
   
//Colour Values for Start Picture
   int redValueStart = 0;
   int greenValueStart = 0;
   int blueValueStart = 0;
//Colour Values for End Picture
   int redValueEnd = 0;
   int greenValueEnd = 0;
   int blueValueEnd = 0;
//Colour Values for Intermediate Picture
   int redValue = 0;
   int greenValue = 0;
   int blueValue = 0;
   
   for(int y = 0; y < getHeight(); ) //loops through columns 
   {
     for(int x =0; x < getWidth(); ) //loops through rows 
       
     {
       
//Gets the Start pixel and the color of the pixel
       pixelObjStart = this.getPixel(x,y);
       redValueStart = pixelObjStart.getRed();
       greenValueStart = pixelObjStart.getGreen();
       blueValueStart = pixelObjStart.getBlue();

//Gets the End pixel and the color of the pixel
       pixelObjEnd = this.getPixel(x,y);
       redValueEnd = pixelObjEnd.getRed();
       greenValueEnd = pixelObjEnd.getGreen();
       blueValueEnd = pixelObjEnd.getBlue();
       
       
       for(int i = 0; i < pixelArrayStart.length; ) //Morhphing loop
       {
         pixelObjStart = pixelArrayStart[i];
         redValue = redValueStart +((redValueEnd - redValueStart)/(numStages + 1))*k; 
         greenValue = greenValueStart +((greenValueEnd - greenValueStart)/(numStages + 1))*k; 
         blueValue = blueValueStart +((blueValueEnd - blueValueStart)/(numStages + 1))*k; 
         
         //set red, green, blue values to start picture
         pixelObjNew.setRed(redValue);
         pixelObjNew.setGreen(greenValue);
         pixelObjNew.setBlue(blueValue);
         
         
         x++;
         y++;
         i++;
       }
     }
   }
 }

then this is what i have so far for my testMorphing class!

PHP Code:
public class TestMorphing
 {
     public static void main(String[] args)
    {
       //choose two pictures and create two picture objects
      String flower1 = FileChooser.pickAFile();
      Picture startPicture = new Picture(flower1);
      int startWidth = startPicture.getWidth();
      int startHeight = startPicture.getHeight();
      
      String flower2 = FileChooser.pickAFile();
      Picture endPicture = new Picture(flower2);
      int endWidth = endPicture.getWidth();
      int endHeight = endPicture.getHeight();
      
      if(startWidth != endWidth || startHeight != endHeight)
      {
        SimpleOutput.showInformation("Sorry, your files are not of the same size!");
      }
      else
      {
        int rate = SimpleInput.getIntNumber("Enter Number of Stages: ");
        
        //morph picture
        Picture intermediate = new Picture(startWidth, startHeight);
        intermediate.morphStage(startPicture, endPicture, 3, 1);
      }
    }
 }
**ANY KIND OF HELP IS GREATLY APPRECIATED!**
Thanks in advance!