Results 1 to 6 of 6
  1. #1
    WhopperMan is offline Member
    Join Date
    Oct 2010
    Posts
    4
    Rep Power
    0

    Default Need help with method morphStage, please help!

    For my assignment I have to take the pixels of two existing pictures and create 3 intermediate pictures. This is what I have so far, but I have no clue how I am supposed to get both the startValue and the endValue, I also feel like im missing something else. Thanks for your help.

    Java Code:
    public void morphStage(Picture startPicture, Picture endPicture, int numStages, int k)
    {
      Pixel pixelObj = null;
      Color colorObj = null;
      int redStartValue = 0;
      int greenStartValue = 0;
      int blueStartValue = 0;
      int redEndValue = 0;
      int greenEndValue = 0;
      int blueEndValue = 0;
      int redValue = 0;
      int greenValue = 0;
      int blueValue = 0;
      Pixel[] pixelArray = this.getPixels();
     
    for (int y = 0; y < this.getHeight(); y++) 
    {  
    for (int x = 0; x < this.getWidth(); x++) 
    {
      pixelObj = this.getPixel(x,y);
      redStartValue = pixelObj.getRed(); 
      greenStartValue = pixelObj.getGreen();
      blueStartValue = pixelObj.getBlue();
      redValue = (redStartValue + ((redEndValue - redStartValue) / (numStages + 1)) * k);
      pixelObj.setRed(redValue);
      greenValue = (greenStartValue + ((greenEndValue - greenStartValue) / (numStages + 1)) * k); 
      pixelObj.setGreen(greenValue);
      blueValue = (blueStartValue + ((blueEndValue - blueStartValue) / (numStages + 1)) * k);
      pixelObj.setBlue(blueValue);
    }
    }
    }
    Last edited by Eranga; 11-14-2010 at 03:03 PM. Reason: code tags added

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    What you want to define by start and end values. Why don't you grad the details of a pixel in RGB?

  3. #3
    WhopperMan is offline Member
    Join Date
    Oct 2010
    Posts
    4
    Rep Power
    0

    Default

    To be honest, I don't know what you mean. I'm not really good with terminology.
    I just want to know how I can get values for both startValues and endValues, which would be two different pictures.

  4. #4
    WhopperMan is offline Member
    Join Date
    Oct 2010
    Posts
    4
    Rep Power
    0

    Default

    Anything??

  5. #5
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    Quote Originally Posted by WhopperMan View Post
    To be honest, I don't know what you mean. I'm not really good with terminology.
    I just want to know how I can get values for both startValues and endValues, which would be two different pictures.
    Okay, what you mean by startValue and endValue? Can you elaborate more about it?

  6. #6
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,244
    Rep Power
    19

    Default

    Your code uses Picture and Pixel classes which are not part of the standard JDK and about which we know nothing except the names. If you wrote those classes, post the code here. If you got them from somewhere else, that's the place to ask for help.

    db

Similar Threads

  1. Thread problem, calling method in run method
    By majk in forum Threads and Synchronization
    Replies: 4
    Last Post: 09-27-2010, 11:40 AM
  2. Replies: 2
    Last Post: 03-26-2010, 05:12 PM
  3. ArrayLists compareTo method, equals method
    By random0munky in forum New To Java
    Replies: 2
    Last Post: 10-26-2009, 07:20 PM
  4. Replies: 29
    Last Post: 09-25-2008, 07:55 PM
  5. cannot call private method from static method
    By jon80 in forum New To Java
    Replies: 3
    Last Post: 05-07-2008, 08:37 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •