I'm having some trouble achieving something apparently simple. I want to randomly distribute all the pixels in each row of a given matrix and get a « noisy » version of an image or video. To put it in simple words : is it possible to make something similar to noise but with a given number of predetermined cell values ? Like a puzzle-matrix in which each cell is a movable piece ? (The « only rows » option is just to give the result some consistancy compared to the original)
To be more explicit, here's a patch showing the two roads I've tried to go so far. Both are very straight forward but none is satisfying. Route one works well but takes loooots of time analysing the incoming matrix pixel by pixel. So definitely not realtime instant result…
Route two uses jit.iter and works fine with a simple tiny 1 char matrix but it's another story when it comes to image-size data…
I feel like I'm using my computer like a 19th century steam engine with these examples. There must be some more clever solution out there.
One last thing : I checked the jit.sprinkle object and its gl.pix equivalent. They give interesting results but somehow, I can't tweak them to get something looking as random as I want.
Any hint ?