Results 1 to 6 of 6
- 11-14-2010, 02:47 PM #1
Member
- Join Date
- Oct 2010
- Posts
- 4
- Rep Power
- 0
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
- 11-14-2010, 03:05 PM #2
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
What you want to define by start and end values. Why don't you grad the details of a pixel in RGB?
- 11-14-2010, 03:58 PM #3
Member
- Join Date
- Oct 2010
- Posts
- 4
- Rep Power
- 0
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.
- 11-14-2010, 10:10 PM #4
Member
- Join Date
- Oct 2010
- Posts
- 4
- Rep Power
- 0
Anything??
- 11-15-2010, 01:56 AM #5
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
- 11-15-2010, 03:31 AM #6
Similar Threads
-
Thread problem, calling method in run method
By majk in forum Threads and SynchronizationReplies: 4Last Post: 09-27-2010, 11:40 AM -
method not abstract, does not override actionperformed method.
By Theman in forum New To JavaReplies: 2Last Post: 03-26-2010, 05:12 PM -
ArrayLists compareTo method, equals method
By random0munky in forum New To JavaReplies: 2Last Post: 10-26-2009, 07:20 PM -
Calling a method in a different class from within a method problem
By CirKuT in forum New To JavaReplies: 29Last Post: 09-25-2008, 07:55 PM -
cannot call private method from static method
By jon80 in forum New To JavaReplies: 3Last Post: 05-07-2008, 08:37 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks