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.
-
3$\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$– AlexisCommented Mar 9, 2021 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$– AksakalCommented Mar 9, 2021 at 3:22
-
$\begingroup$ I would think of looking at correlation between neighbouring pixels, possibly using a power spectrum and auto-correlation function $\endgroup$– innisfreeCommented Mar 9, 2021 at 15:27
-
1$\begingroup$ It seems likely stats.stackexchange.com/questions/17109 addresses many of the issues in which you are interested. $\endgroup$– whuber ♦Commented Mar 6, 2022 at 17:18
1 Answer
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!
-
$\begingroup$ You might want to look at the apparent duplicate I referenced in a comment to the question. $\endgroup$– whuber ♦Commented Jul 29, 2022 at 21:36