title: Bradley Adaptive Thresholding -- Confused (questions)
body: <p>I have some questions, probably stupid, about the implementation of the adaptive thresholding by Bradley. I have read paper about it <a href="http://people.scs.carleton.ca:8008/~roth/iit-publications-iti/docs/gerh-50002.pdf" rel="nofollow">http://people.scs.carleton.ca:8008/~roth/iit-publications-iti/docs/gerh-50002.pdf</a> and I am a bit confused. Mainly about this statement:</p>
  
  <pre><code>if ((in[i,j]*count) ≤ (sum*(100−t)/100)) then
  </code></pre>
  
  <p>Let's assume that we have this input:</p>
  
  <pre><code>            width, i
              [0] [1] [2]
             +---+---+---+
  height [0] | 1 | 2 | 2 |
  j          +---+---+---+
         [1] | 3 | 4 | 3 |
             +---+---+---+
         [2] | 5 | 3 | 2 |
             +---+---+---+
  </code></pre>
  
  <p>and let's say that:</p>
  
  <pre><code>s = 2
  s/2 = 1
  t = 15
  i = 1
  j = 1 (we are at the center pixel)
  </code></pre>
  
  <p>So that means we have a window 3x3, right? Then:</p>
  
  <pre><code>x1 = 0, x2 = 2, y1 = 0, y2 = 2
  </code></pre>
  
  <p>What is <em>count</em> then? If it is number of pixels in the window, why it is 2*2=4, instead of 3*3=9 according to the algorithm? Further, why is the original value of the pixel multiplied by the count?</p>
  
  <p>The paper says that the value is compared to the average value of surrounding pixels, why it isn't</p>
  
  <pre><code>in[i,j] &lt;= (sum/count) * ((100 - t) / 100)
  </code></pre>
  
  <p>then?</p>
  
  <p>Can somebody please explain this to me? It is probably very stupid question but I can't figure it out.</p>