Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8563527
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T16:58:48+00:00 2026-06-11T16:58:48+00:00

I’m working on a project in which I’m trying to use histogram equalization to

  • 0

I’m working on a project in which I’m trying to use histogram equalization to do something like going from this image

http://zerocool.is-a-geek.net/wp-content/uploads/2011/12/input-300×200.jpg

“http://zerocool.is-a-geek.net/wp-content/uploads/2011/12/hist_before.png”

to this image

http://zerocool.is-a-geek.net/wp-content/uploads/2011/12/output-300×200.jpg

“http://zerocool.is-a-geek.net/wp-content/uploads/2011/12/hist_after.png”

but I can’t seem to figure it out.

This is my enhanced image code which should implement the same type of adjustment..

public void EnhancedImage (File fileName) {

           double sumc = 0;
            for(int r = 0; r < array.length; r++){
                for(int c = 0; c < array[r].length; c++){ 
                    sumc = r+c;
                    if (sumc <= array[r][c]) {
                     sumc = array[r][c];
                    }
                        newc = Math.round(maxshade * ((double)sumc / pixtot));
                        array[r][c] = (int) (newc);
                        if (array[r][c] > 255) {
                            array[r][c] = 255;
                    }
                }

                }

The algorithm that i would like to use is below where maxShade is the maximum shade of the image (usually 255) sumc is the total number of pixels in the image with a value less than or equal to c and pixtot is the total number of pixels in the picture:

newc := round(maxShade * ((double)sumc / pixtot))

but im not sure if i did it right…currently my image just turns really dark.

Any help would be appreciated!! Thanks.

Also my pixtot routine:

 pixtot = 0;
           for(int y = 0; y < imageArray.length; y++)
                for(int x = 0; x < imageArray[0].length; x++)
                    pixtot = x+y;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T16:58:49+00:00Added an answer on June 11, 2026 at 4:58 pm

    Your problem is here:

    pixtot = x+y;
    

    First, you want +=, not =. Second, this is adding up the indexes of the pixels, not the value of the pixels. You want something like

    pixtot += imageArray[y][x];
    

    You make the same conceptual error with sumc.

    Edit:

    There’s lots of other problems with your code. If you want to stretch the dynamic range, you want to compute min and max, the minimum and maximum of all the pixel values, then compute each pixel value as value = maxshade * (value - min) / (max - min). That gives you a result pixel value of 0 if value==min and maxshade if value==max.

    This doesn’t really give you histogram equalization, however. For that you need to compute a histogram of the input pixel values and compute quantiles in that histogram to figure out the output values, it isn’t easy.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am trying to render a haml file in a javascript response like so:
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to select an H1 element which is the second-child in its group
I have a text area in my form which accepts all possible characters from
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.