Mapping of intensity levels to create a flat histogram

Please refer the following link

distributing equal number of pixels in each intensity level

Here in the algorithm a parameter called "Priority" is associated with a pixel. On what basis do we assign priority to a pixel? For example let us suppose we have 25 pixels with intensity level 10 in a histogram. So which pixel will have what priority?How do we decide that. Is it on the basis of location of the pixel?

EDIT:

This question does not ask what is histogram equalization or how mapping is done so as to get an equalized image from an input image. In fact this question deals with the after processing once the output image (equalized image) has been obtained either manually or using histeq. The question is about how do we get a nearly flat histogram from the histogram which is not so flat such as we obtain a 64 bin histogram(flat) from 256 bin histogram(not so flat). How do we distribute the pixels to different bins so as to get a flat histogram. I came to know about the algorithm as discussed in the link(above) given by me but the term PRIORITY is not clear in it as to how do we calculate it. So basically the question is regarding getting 64 bin histogram from 256 bin histogram or getting a flat 256 bin histogram from a 256 bin histogram by redistribution of pixels to bins.

For example I got an image mapped into 4 bins as shown below

图像显示强度分布在4箱

As you can see there is some difference between the histograms, one generated by histeq and other one is manually created. The bin locations along with the number of pixels is as below:

For the histogram generated as a result of histeq( we can see uniform distribution of pixels here) following is the distribution

   Bin number  No. of pixels
       1             4207
      86             4146
     171             4314
     256             3965 

For the histogram generated as a result of manual equalization( we can see non-uniform distribution of pixels here) following is the distribution

  Bin number  No. of pixels
       1        2678
      86        5583
     171        5061
     256        3310

In my image there are a total of 16632 pixels, that needs to be divided equally into these 4 bins ie 4158 pixels per bin. Now how do i redistribute them to get a flat hsitogram such as we get in the case of histeq. The abovesaid link(given by me) refers to the algorithm about how to do it but it refers to the term priority which I am not able to understand. I just want to know what is the priority of a pixel and how do we calculate it.


You could sort the N pixels according to brightness. And map a pixels index I to a brightness B with the formula B = I / N. (brightness would then lie in 0..1)

(This will definitely produce some artifacts, but that's the answer, i guess. You can probably fix them somehow.)

PS - Also worth mentioning that "histogram equalization" does not produce a flat histogram, but a linear cumulative histogram.

链接地址: http://www.djcxy.com/p/89778.html

上一篇: 傅里叶变换用于光纤对准

下一篇: 强度等级的映射以创建平坦的直方图