# How to find f given that f(some_image) = processed_image

I have a before/after image pair with pixel transformations only (for example, grayscale, or a hue shift. No blur, border, sharpen, etc.). I'm trying to find a function such that for every pixel (r, g, b) in the original image, f(r, g, b) = (r', g', b'), (r', g', b') being the pixel in the "after" image.

I was thinking about a polyfit function, but I couldn't find one that works in 3D.

I'd appreciate any help with this, or another method of achieving what I need.