Histogram equalization of image processing

Source: Internet
Author: User

Histogram equalization of image processing

Basic Idea :

Histogram equalization is a common image enhancement method in image processing, and the main advantage of histogram equalization is

It can reduce the image noise and enhance the local display of the image. For common RGB images, histogram equalization

Can be processed on three color channels respectively, the basic histogram equalization formula is:

Where NJ represents the number of pixels of the gray level RK, L for the total number of gray in the image, for RGB, L

The value range is [0~255] with a total gray level of 256. and R represents the histogram data for the input image. According to the loss

The gray value SK calculates the pixel value of the output pixel and completes the pixel processing after the histogram equalization.

Program Effect:


Source code:

Package com.gloomyfish.filter.study;

Import Java.awt.image.BufferedImage;  public class Histogramefilter extends abstractbufferedimageop{@Override public bufferedimage filter (BufferedImage src,
        BufferedImage dest) {int width = src.getwidth ();

        int height = src.getheight ();

        if (dest = = null) Dest = createcompatibledestimage (src, null);
        int[] Inpixels = new Int[width*height];
        int[] Outpixels = new Int[width*height];
        getRGB (SRC, 0, 0, width, height, inpixels); int[][] Rgbhis = new int[3][256]; RGB int[][] newrgbhis = new int[3][256];
        		After him for (int i=0; i<3; i++) {for (int j=0; j<256; J + +) {Rgbhis[i][j] = 0;
        	NEWRGBHIS[I][J] = 0;
        } int index = 0;
        int totalpixelnumber = height * width;
        	for (int row=0; row 
Reprint Please be sure to indicate 



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.