For example: at x = Pij = 0.1, the four values (corresponding to probability of 0, 1, 2, and 3 photons incident on that pixel) are P0 = e-0.1 (= 0.9048), P1 = 0.1 P0 (= 0.09048), P2 = 0.01 P0/2 (=0.0045242), and P3 = 0.001 P0/6 (= 0.0001508).
For a given framek, find a random number R equally distributed between 0 and 1. For each pixel
- If R <>0, then number of photons for that pixel = 0.
- If (P0 + P1) > R > P0, then number of photons = 1; and if (P0+P1+P2) > R > (P0 +P1) then number of photons is 2; and so on.
For the next frame, compute a new random number R and repeat the above steps again...