Is there a way to measure each pixel's content in an image somehow?
I would want to start from e.g. making a measure of "color" that's a single real value, rather than a triplet. Then I could perhaps want to make a function that calculates the "change in" color between pixels adjacent to each other. So a derivative of some kind


Why would you need the color to be a single value for that? I'll do an analogy: To measure the distance between to cities, you don't need to map these two cities onto the real numbers; they still have coordinate vectors. All you do is map the difference vector onto a number. And for numbers, it's just the same: It's mathematically impossible to sensibly map them onto a single dimension and still preserve distance. So, you can't.

What you need is just some kind of a norm to map a color difference vector to a "perceptive difference". For many color systems, something like the squared sum of vector components would be a good start.