How to find f given that f(some_image) = processed_image
Fit 3 polynoms (or any other model) using the individual channels of the output image: r' as a function of (r, g, b), g' as a function of (r, g, b), b' as a function of (r, g, b). I would also suggest not including in the data set all pixels with a 0 or 255 value (if your image is 8-bit) - these values might have been clipped.