Double the dimensions of the image, placing the original pixels at the (even, even) coordinates. Interpolate the (odd, odd)-coordinate pixels from the 4 diagonal neighbors. Then, interpolate the (odd, even) and (even, odd) pixels (a checkerboard) from the orthogonal neighbors. Repeat, doubling the dimensions again.
Here are some experiments generating synthetic noise starting from a random black-and-white array and random gray scale array. It is also possible to start from the checkerboard stage.
Eventually gamma matters, but not taken into account for this.
Applying pnmdepth 2 or 3 yields abstract art.
1 comment :
If you like random images like that, you may enjoy playing with power-law spectrums and FFTs, which can give you some fun textures. Here is some code to do this sort of thing in Python+NumPy+PIL (the numerical computation library with the fast Fourier transform and the imaging library): code.
Here's what that code produces: img. You can get something closer to what you're trying for by changing (1 + r) to (1 + r)**2, or higher exponents (high frequency terms look more noisy) -- when it just goes like 1/r I believe it's what's called "brown noise", because I think when you go to a "power spectrum" you take the squared absolute value of the inverse FFT. You can also make the low frequencies more prominent by changing the 1 in the 1 + r to something else. :D
Post a Comment