Classification of similar color histograms

How do I distinguish between colors that have similar histograms as in the example above?
The picture on the left changes color from top to bottom and the picture on the right changes color from the border to the inside.
I wonder if I can calculate the pixel-specific difference value.

You cannot.
What is it for?

Of course if you have got both original image a difference will do the job

stretch contrast.

think in luma and chroma.

shrink the picture.

borrow from video compression. DCT should be able to represent the first one’s vertical gradient and the second one’s square-radial gradient.

I didn’t understand what it means to use dct.

you could split the image into smaller patches, take histograms of those and concat the partial histos to a larger feature vector (like done in the LBPH face reco)

Do you have an example code or tell me more easily?