Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Histogram equalization Help Please!

  1. #1
    Junior Member
    Join Date
    Apr 2013
    Posts
    17
    My Mood
    Confused
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Histogram equalization Help Please!

     BufferedImage equalizeimage= new BufferedImage(source.getWidth(), source.getHeight(), source.getType());
     
    int red;
    int blue;
    int green;
    int newRGB = 0;
     
     
            //to compute the number red, green,blue at each value
            for(int i=0; i<source.getWidth(); i++) {
                for(int j=0; j<source.getHeight(); j++) {
     
                             // Get pixels by R, G, B
     
                             red = new Color(source.getRGB (i, j)).getRed();
                             green = new Color(source.getRGB (i, j)).getGreen();
                             blue = new Color(source.getRGB (i, j)).getBlue();
     
                    //the number of red at value red increase 1
                    red = histEQ(0)[red]++; 
                    //the number of green at value green increase 1
                    green = histEQ(1)[green]++; 
                    //the number of blue at value blue increase 1
                    blue = histEQ(2)[blue]++;
     
                   newRGB = get.RGB(red, green, blue);
     
                    equalizeimage.setRGB(i, j, newRGB);
                }
            }
          return equalizeimage;
        }


    --- Update ---

    So my problem is that the "histEQ" is underlined with red and I'm not sure how to declare it or something. Does any one have any suggestions? Thanks
    Last edited by jps; May 12th, 2013 at 04:06 PM. Reason: fixed code tag


  2. #2
    Super Moderator jps's Avatar
    Join Date
    Jul 2012
    Posts
    2,642
    My Mood
    Daring
    Thanks
    90
    Thanked 263 Times in 232 Posts

    Default Re: Histogram equalization Help Please!

    Quote Originally Posted by dazzle1218 View Post
    [code=java]So my problem is that the "histEQ" is underlined with red and I'm not sure how to declare it or something. Does any one have any suggestions? Thanks
    Always include the full text of error messages (copy - paste) with the code so we can get any details which may be necessary.

    Variables must be declared before they are used. You declared red blue and greed. You also declared newRGB and i and j. What seems to be the problem with declaring histEQ?

Similar Threads

  1. Array Histogram
    By Thor in forum What's Wrong With My Code?
    Replies: 9
    Last Post: December 4th, 2012, 08:06 AM
  2. [SOLVED] Printing A Histogram...
    By Nuggets in forum What's Wrong With My Code?
    Replies: 9
    Last Post: March 18th, 2012, 02:11 PM
  3. [SOLVED] BufferReader, histogram
    By Nhedro in forum File I/O & Other I/O Streams
    Replies: 5
    Last Post: February 22nd, 2012, 09:39 AM
  4. Histogram Java Program
    By djl1990 in forum What's Wrong With My Code?
    Replies: 17
    Last Post: October 24th, 2011, 06:47 AM
  5. Printing a Histogram Help - Arrays
    By Mock26 in forum Collections and Generics
    Replies: 1
    Last Post: June 4th, 2009, 04:49 AM

Tags for this Thread