How to make a Color Tone Curve Filter C# with splines

1.1k views Asked by At

i'm looking for something like the 5/6th image, i can work on QT or C++, i already have the channels, but beyond of that i can't find how to do anything else...

http://www.mediachance.com/pseam/help/curves.html

Is there any algorithm or special conversion to make them work, i have been googling, but i can find a pseudoalgorithm for this, everything is too generic, for example this:

http://www.filterforge.com/more/help/Miscellaneous/ToneCurveExplained.html https://photo.stackexchange.com/questions/6549/how-exactly-do-rgb-curves-work-and-interact-w-each-other-in-photoshop

So if somebody at least know how do the curves interact with the rgb channels, would be nice to know or to share info :)

Anyway, what i'm actually trying is this, with this bezier curve:

x    y
0    0
127  178
255  255
float* arrayBezierY = new float[255];
    qDebug() << "Initializng Bezier Array";
    int counter = 0;
    for (float i = 0; i < 1; i += 1.0 / 255.0) {
        int xa = getPt(0, 127, i);
        int ya = getPt(0, 178, i);
        int xb = getPt(127, 255, i);
        int yb = getPt(178, 255, i);
        int x = getPt(xa, xb, i);
        int y = getPt(ya, yb, i);
        arrayBezierY[counter] = y;
        counter++;
    }

as in How do I implement a Bézier curve in C++?

finally i make the new filtered image pixel be pixel with QT (doesn't matter if it is with C++) as this:

newImage->setPixel(x, y, qRgb(arrayBezierY[qRed(line[x])], arrayBezierY[qGreen(line[x])], arrayBezierY[qBlue(line[x])]));

But i just get a distorsioned image with blue dots sometimes, and the curve is not even close tho those in Photoshop...

0

There are 0 answers