Home  >  Article  >  Java  >  Histogram equalization of java images

Histogram equalization of java images

黄舟
黄舟Original
2016-12-30 11:48:472416browse

Histogram equalization is to make the histogram of the image as average as possible, so that the probability of each 0-255 is equal. The formula is as follows:

Histogram equalization of java images

#This proof can be found in any image processing textbook. The implementation code is provided below:

public void histequalization(){
		toGray();
		double[] hist = math.Norm(hist());
		for (int y = 0; y < h; y++) {
                  for (int x = 0; x < w; x++) {
                   this.data[x + y * w] = (int)(math.sum(hist, this.data[x + y * w])*255); //上面公式           
                 }
              }
	}

The results are as follows:


Original picture:

Histogram equalization of java images

Histogram equalization of java images

# #After histogram equalization:

Histogram equalization of java images

Histogram equalization of java images

The above is the content of histogram equalization of java images. For more related content, please pay attention to PHP Chinese website (www.php.cn)!



Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:java image rotationNext article:java image rotation