I have two pictures. I only want to keep pictures that "display" randomness. Is there a way to distinguish more random from less? In these plots, time is the vertical axis. So, the second plot has a slight repeating pattern, while the first plot is "random". Does not have to be "perfectly random" I just want to be able to separate or quantify it from the picture that has somewhat repeating pixels against time. My first guess is to get a column vector of greyscale pixel values and determine if there some repeating pattern. But I don’t know if I’m headed down a rabbit hole.


Not Random

  • 2
    $\begingroup$ Welcome to CV Chris Bolig! Can you edit your question to articulate randomness of what? E.g., color? size of perturbations? Shape or pattern? Number of shapes or patterns? Etc. "Randomness" like "greenness" is always an attribute of something, never a thing manifesting on its own. $\endgroup$ – Alexis Mar 9 at 1:16
  • $\begingroup$ There is no sure way. Imagine a prng generated image, you’ll never be able to detect that it can be encoded with one number, a seed. $\endgroup$ – Aksakal Mar 9 at 3:22
  • $\begingroup$ I would think of looking at correlation between neighbouring pixels, possibly using a power spectrum and auto-correlation function $\endgroup$ – innisfree Mar 9 at 15:27

As I read your question, the first thing that came to mind for me is that, in some sense, "randomness" is synonymous with, or encoded by, entropy.

So, here is some person's blog post about the "entropy of images" which might give you a direction, as the author walks through the development. A similar idea that is for time series is approximate entropy, and there's even a Python implementation; however, you'd have to turn your 2-D image into a "1-D image" along the lines of a time series...

In either case, the image with higher entropy has "more randomness" in the sense that entropy measures

average level of "information", "surprise", or "uncertainty" inherent in the variable's possible outcomes

from Wikipedia's entry on entropy in information theory. One final way I'll mention thinking about the "randomness" of your images is to think about how much either image can be compressed (from here):

you can imagine a simple image having little information (low entropy) can be encoded with fewer bytes of data while completely random images (like white noise) cannot be compressed much, if at all.

I hope that this helps!


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.