I'm writing a patch right now to detect the most common color in a matrix, and then use that as an input value. I located a thread from five years ago
by a poster who wanted to do something similar, but the patch posted in that thread does not seem to work, and the problem appeared unsolved.
An example of how I'd like it to work. If I had a matrix of a variety of RGB color values, I wouldn't just want to take the average of them and output that as the value, I'd instead want to bin similar values together and then perform a count to see which bin had the highest frequency. If I could output the top 5 colors by frequency, that would be even better.
I've been exploring jit.rgb2hsl, jit.histogram, and jit.3m but none of these seem to do what I want. Is it possible, or possible to approximate this function?