Results 1 to 13 of 13
  1. #1
    Join Date
    Oct 2009
    Posts
    25
    Rep Power
    0

    Default How to create a Warhol effect in an image.

    delete......
    Last edited by racewithferrari; 11-17-2009 at 07:26 PM.

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    You only need one copy of the array in your program, not 5. The first index to the array will be determined by the set number (mod 9) and the second index will be determined by the pixel's luminance.

  3. #3
    Join Date
    Nov 2009
    Posts
    4
    Rep Power
    0

    Default

    delete.....
    Last edited by porsche_guy_91; 11-17-2009 at 11:33 PM.

  4. #4
    Join Date
    Oct 2009
    Posts
    25
    Rep Power
    0

    Default

    delete.......
    Last edited by racewithferrari; 11-17-2009 at 07:25 PM.

  5. #5
    Join Date
    Nov 2009
    Posts
    4
    Rep Power
    0

    Default

    small world. thought i'd google the assignment cuz idk how to do it and this comes up. did you figure out how to do it yet?

  6. #6
    Join Date
    Nov 2009
    Posts
    4
    Rep Power
    0

    Default

    delete.....
    Last edited by porsche_guy_91; 11-17-2009 at 11:34 PM.

  7. #7
    Join Date
    Oct 2009
    Posts
    25
    Rep Power
    0

    Default

    delete.......
    Last edited by racewithferrari; 11-17-2009 at 07:25 PM.

  8. #8
    Join Date
    Nov 2009
    Posts
    4
    Rep Power
    0

    Default

    delete......
    Last edited by porsche_guy_91; 11-17-2009 at 01:17 AM.

  9. #9
    339cr22 is offline Member
    Join Date
    Nov 2009
    Posts
    1
    Rep Power
    0

    Default

    Better delete this b4 the professor googles the assignment and finds out

  10. #10
    chick is offline Member
    Join Date
    Mar 2010
    Posts
    17
    Rep Power
    0

    Default

    does anyone remember how to do this with an image, I have started to do a similar issue but cant finish it, here is my code: is it similar to the old code here, and can anyone help me work on it.

    Java Code:
     public void grayscalewithLuminance()
    {
      Pixel [] pixelArray = this.getPixels();
      Pixel pixel = null;
      int luminance = 0;
      double redValue = 0;
      double greenValue = 0;
      double blueValue = 0;
      
      //loop through all the pixels
      for (int i=0; i < pixelArray.length; i++)
      {
        
        //get the current pixel 
        pixel = pixelArray[i];
        
        //get the corrected red,green, and blue values
        redValue = pixel.getRed() * 0.299;
        greenValue = pixel.getGreen() * 0.587;
        blueValue = pixel.getBlue() * 0.114;
        
        //compute the intensity of the pixel (average value)
        luminance = (int) (redValue + greenValue + blueValue);
        
        //set the pixel color to the new color 
        pixel.setColor(new Color(luminance,luminance,luminance));
                       
     return newPicture;
      }
    }
    }

  11. #11
    chick is offline Member
    Join Date
    Mar 2010
    Posts
    17
    Rep Power
    0

    Default

    this is the other part to my code

    Java Code:
     public Picture componentLayout()
       {
       //Declare new picture
       Picture newPicture = new Picture(this.getWidth() * 2, this.getHeight()
    * 2);
       Pixel sourcePixel = null;
       Pixel targetPixel = null;
       int targetX = 0;
       int targetY = 0;
       // the redvalue of each pixel in the image
       int redValue=0;
       // The bluevalue of each pixel in the image
       int blueValue = 0;
       // the greenvalue of each pixel in the image
       int greenValue=0;
       Pixel pixelObj = null;
       Pixel[] pixelArray = this.getPixels();
       for (int index = 0; index < pixelArray.length; index++)
       {
         // Get the pixel at the current index from the array of pixels.
         pixelObj = pixelArray[index];
         // Get the blue value at the pixel.
         blueValue = pixelObj.getBlue();
         // Get the red value at the pixel.
         redValue = pixelObj.getRed();
         // Get the green value at the pixel
         greenValue = pixelObj.getGreen();
         int range = 0;
         //loops through x
         for (int x= 0; x < this.getWidth(); x++)
         {
           //loops through y
           for (int y = 0; y < this.getHeight(); y++)
           {
             //source pixels retrieved
             sourcePixel = this.getPixel(x,y);
             if (redValue > blueValue && redValue>greenValue)
             {
              targetX = this.getWidth()*2;
             }
    
    
           }
         }
    //return picture
         return newPicture;
       }
     }
    any help will be appreciated
    Moderator Edit: Code tag corrected
    Last edited by Fubarable; 04-13-2010 at 10:41 PM. Reason: Code tag corrected

  12. #12
    iluxa is offline Senior Member
    Join Date
    Mar 2010
    Posts
    266
    Rep Power
    5

    Default

    you borrowed two pieces of code from two different places... they don't really fit together at all :(

  13. #13
    chick is offline Member
    Join Date
    Mar 2010
    Posts
    17
    Rep Power
    0

    Default

    well my ultimate goal is to separate the pixels so the pixels with mostly gray are in the top left corner, the pixels with the most red are the in the top right, and the pixels with the most green in the bottom left, and most blue in the bottom right, I found the code for luminance and thought it would help with the ultimate goal, as well as figuring out the pixels with the max gray. any ideas on I can merge these to form my goal. I am getting soo frustrated with this.

Similar Threads

  1. Smoke Effect help
    By jammyjamsticy in forum AWT / Swing
    Replies: 1
    Last Post: 04-20-2009, 12:34 PM
  2. Text effect: rotation and transparent
    By Java Tip in forum java.awt
    Replies: 0
    Last Post: 06-21-2008, 08:49 PM
  3. Replies: 0
    Last Post: 03-31-2008, 10:06 AM
  4. Replies: 0
    Last Post: 09-28-2007, 12:45 PM
  5. shadow effect in swt-sash
    By Jack in forum SWT / JFace
    Replies: 2
    Last Post: 07-02-2007, 05:04 AM

Tags for this Thread

Posting Permissions

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