I'm trying to produce a 2D matrix of uniformly distributed random noise in the range of [0, 1). This is easily accomplished with pseudo-random numbers. I'd like this noise to consist of only high frequencies, so I take the average of a 3x3 area around each sample and subtract it from the center value. This changes the range to (-8/9, 8/9) and makes the distribution anything but uniform. Here's a plot of the distribution over 10 million such samples:


I don't know how to characterize this distribution, much less how to reverse it. I'm hoping there's a simple formula that can be applied to simultaneously restore both the range and distribution of the values.

For context, here's a picture with the purely random noise on the left and the high-frequency version on the right. I was able to achieve the desired distribution by applying a histogram binning during the conversion to integer pixel values, but I need something that works in the real number domain.

2D noise comparison

  • $\begingroup$ I'm not sure why you'd want a uniform distribution, I find a normal distribution much better for dithering (think of dithering as analogous to filtering, the distribution of your noise is convolved with your image's histogram that it's added to). Your distribution looks like erf(3-x)+erf(3+x), which is what happens when a rectangle is convolved with a Gaussian function. As for mapping distributions you can go from uniform to any distribution you want by mapping it to the inverse function of the cumulative function, so maybe map simply to the cumulative function of your distribution. $\endgroup$ Feb 11, 2017 at 0:24
  • $\begingroup$ Basically fill a LUT with numbers from the long formula you get when you type integral of (erf(3-x)+erf(3+x)) (I'm not 100% sure about the 3 value, you'd have to try some fitting and scaling) in WolframAlpha, then plug your values as indexes into that LUT and if I'm not mistaken that should do the trick. Have you also considered the algorithms already in existence for generating graphical blue noise? $\endgroup$ Feb 11, 2017 at 0:38


You must log in to answer this question.

Browse other questions tagged .