rmalayter

Newbies
  • Content Count

    4
  • Joined

  • Last visited

Community Reputation

0
  1. Dammit, now that I am in the office I cannot reproduce. I did use a screenshot-to-PNG for the images, but made sure that zoom was set to 100% in paint.net first. Maybe I have some weird monitor scaling going on with my laptop when it is undocked. Have to mess with the icky HP display driver to make sure that isn't the case. I have seen scatterplots from "synthetic" data generated by poor RNGs that clearly show diagonal or rectangular regularites, and that's what I guessed was happening here. But I am flummoxed as to why I cannot reproduce today, as was able to do so repeatedly yesterday while my machine was undocked. So... nevermind. Thank you all for your help, and I promise to have a dead-bang, 100% repro case if I bring this one up again.
  2. The "squares" pattern is quite visible at 100% pixel-for-pixel zoom, even outside of paint.NET in a browser, using this second test image I posted previously above: http://forums.getpaint.net/uploads/monthly_01_2014/post-134862-0-38051500-1389670699.png So it is not a problem with any resizing algorithm in Paint.NET or elsewhere. To reproduce in Paint.NET v3.5.11, start with an 800x600 canvas, fill with black, then go to Effects->Noise->Add Noise. Choose intensity = 64, saturation = 100, coverage = 100. I haven't tried on another machine yet, but it certainly looks like you are using a fixed seed for the random number generator, as it is reproducible for me when I re-use the same settings. Assuming this portion of the code is still the same as the previous open-source v3.36 code, you are indeed using System.Random with a timestamp-based seed in this filter. This construction looks to me like it would always produce very non-random output. System.Random is known to have a short period and decidedly non-random output, see this MSFT bug for example.
  3. Sorry, I had to crop and it wasn't as clear after that. See teh following two attachments, one showing the add noise command, and then the same image after contrast adjustment showing the "pattern" more clearly. The size of the "squares" appears to be about 75 pixels on a side with this example.
  4. While usinng the Effects->Noise->Add Noise function, I was surprised to see a clear pattern of "squares" emerge from the noise. This is clearly the result of using a "bad" pseudo-random number generator (PRNG), such as System.Random, which is a simple linear generator. While I haven't looked at the source yet, I assume System.Random is being used. A switch to a better PRNG would prevent any strange effects, and probably improve the appearance and performance of all filters and functions which utilize random numbers. Switching to a cryptographic RNG such asSecurity.Cryptography.RandomNumberGenerator is probably overkill and too slow for an imaging application, but that can be used to seed a more traditional (fast) PRNG. There are many non-cryptographic RNGs with much better performance and distribution than System.Random if one is willing to pull in a small external library. The most popular "good" non-cryptographic RNG is "Mersenne Twister", with free C# implementations available all over the place. Wikipedia directs us to http://archive.msdn.microsoft.com/MersenneTwister for C# implementations, but Google shows many others with various licenses. See attached PNG of noise being applied to a black background where you can see the "pattern of squares", especially near the top center of the image. It is most visible as bands of "more noise" running vertically down the image at regularly spaced intervals. This is in my experience a clear sign of a simple linear RNG being used. Problem image generated with Add Noise effect on v3.5.11, Windows 7 x64, all framework and OS patches through 1/13/2014.