Reunion
November 15th, 2003, 11:03 PM
Hello, all.
Does anyone know the algorithm of the "add noise filter" (like in Photoshop)? I need a formula with descriptions.
PS. I cannot work with GDI+
Thankyou in advance.
galathaea
November 16th, 2003, 10:18 AM
The algorithm to use depends on your noise model. Are you interested in a particular type of noise (white noise, pink noise, etc.) or does that not matter? The choice of model affects the noise distribution, correlations, frequency fall-off, and other characteristics that highly affect the visual form. If it doesn't really matter, a simple algorithm would be to specify a number N for which to check a random number between 0 and N-1 for 0 (so that N would represent the "amount" to add noise to) and then randomly change the pixels where a match comes about with a different random color. More complex routines might look to the original color of the pixels changed and make adjustments based on it (and possibly surrounding pixels) to make the noise more visually believable, or may choose to build randomness with certain distribution qualities. Unfortunately, I do not know the particular algorithm chosen by photoshop, but if you give some more information on your needs, perhaps we might be able to give more specific recommendations.
yiannakop
November 18th, 2003, 09:54 AM
If you need to add white noise (using C++) you can use rand() which generates numbers with white distribution. Of course, you'll have to make some kind of normalization, depending on the range of your image's values. Generally, a good idea is to see how Matlab creates different kinds of noise (white, normal, salt&pepper etc).