1

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

Image showing intensities distributed in 4 bins

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 i.e 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.

Community
  • 1
  • 1
Navdeep Sony
  • 115
  • 1
  • 9
  • It's called *"Histogram Equalisation"* and is described with an example here... https://en.m.wikipedia.org/wiki/Histogram_equalization – Mark Setchell Jan 23 '16 at 10:48
  • Thanks @MarkSetchell for your reply. Yes its histogram equalization but is this step of making histogram flat as discussed in the abovesaid link included in the histeq() function of matlab? Because I have seen that the histograms that we get using imhist() are not that flat usually but I think this procedure can make histograms really flat, though I have not tried it. – Navdeep Sony Jan 24 '16 at 14:22
  • @rayryeng please have a look at the question once again. May be i was not able to clarify in the beginning but now I have added an example to it. – Navdeep Sony Jan 25 '16 at 18:08
  • This question is probably off-topic. Consider migration to another website... perhaps Signal Processing StackExchange: http://dsp.stackexchange.com. This only deals with conceptual ideas and nothing to do with programming. – rayryeng Jan 25 '16 at 18:09
  • @rayryeng you mean to say dsp.stackexchange.com deal with conceptual ideas? How do I migrate to other website as I am new here. Also are you not able to help? – Navdeep Sony Jan 25 '16 at 18:17
  • Yeah that website is primarily for signal processing questions. This falls into that category. I could answer, but I'm afraid it may be downvoted and potentially closed. – rayryeng Jan 25 '16 at 18:18
  • @rayryeng dont be afraid please. If guys like you are afraid then how can we beginners ever think of answering someone. Please try it. Also closing this question will have any impact on me and can it be closed because of your answer? – Navdeep Sony Jan 25 '16 at 18:23
  • @rayryeng please answer the question as no one is answering and I am stuck. With your help, I will be able to do it. – Navdeep Sony Jan 27 '16 at 03:22
  • Why is no one answering? Everyone busy or what? – Navdeep Sony Jan 27 '16 at 17:31
  • Either we are busy, it's a question that is too specialized... Or simply no one has an interest in your problem. I've been busy so I haven't replied. Take note that StackOverflow consists of mainly volunteers. Expecting a reply within a time frame is unfortunately not how we operate. – rayryeng Feb 01 '16 at 01:28

1 Answers1

1

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.