How to recreate the math behind photoshop curves

Basically, what I want to do is understand how to calculate the values along a 'curve' as represented here in the photoshop curves box:

Photoshop Curves

So, given N points with x between 0 and 1 and y between 0 and 1 - we'll create a curve that passes through all these points. Given this curve, I'd like to be able to calculate all values of the curve for any given X.

In other words, I'd like to modify values of color just like the curves box does, but programmatically.

I've read that these are "catmull-rom splines" -- but all I see is a function that relies upon a parametric T -- I want to be able to look up for values of x. I'd like to do this in C if possible

12
задан sotangochips 5 December 2010 в 01:01
поделиться