This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Interpreting the parameters and scale of the Bézier curves?

Tags: None
(comma "," separated)
TheDiveO
Registered Member
Posts
595
Karma
3
OS
For some background research on GoPro's Protune I want to better understand the tonal curves I use when working in Kdenlive with HD Hero footage shot in Protune. What currently leaves me dazzled is the correct interpretation of the parameters of the Bézier curve effect in Kdenlive/MLT. Yes, this is a special question, but I hope that some Kdenlive expert here can help me out with an explanation.

The Bézier curve I'm working with is bent like an S-shape. The interesting part of the effect's parameters is as follows:
Code: Select all
<parameter default="-1;-1#0;0#0,1;0,1|0,9;0,9#1;1#2;2" depends="Channel" type="bezier_spline" value="-1,414;-1,73159e-16#0;0#0,387;0|0,619;1#1;1#2,41421;1" name="Bézier spline"/>


The UI displays these values for the handles:
  • p0, handle 1: X=-1.414 Y=0
  • p1, handle 2: X=0.387 Y=0
  • p2, handle 1: X=0.619 Y=1
  • p3, handle 2: X=2 Y=1

I have to admit that I'm dazzled by the coordinate space these points are placed in and thus how to correctly interpret it. In particular, the points p0 to p3 aren't symmetrical to the origin or at least the in the X axis. Instead, the curve runs from X=-1.414 to X=2. When I'm plotting a cubic Bézier curve (Wikipedia) using the points displayed in the effect settings then I'm getting an S-like shape ... but it isn't symmetrial in itself.

Can someone here please enlighten me how to correctly interpret the coordinate system used by the Bézier curve effect and how to properly (re) calculate the correct Bézier curve as Kdenlive/MLT does. My intent is to cross-check the Protune effect curve I once found in an old posting with the curve data that GoPro's David Newman was very kind to publish on his blog.
User avatar
ttguy
Moderator
Posts
1152
Karma
6
OS
TheDiveO
Registered Member
Posts
595
Karma
3
OS
Thanks for the link ... but even after reading it multiple times I still have no clue how to correctly interpret these values. :(
TheDiveO
Registered Member
Posts
595
Karma
3
OS
I finally took a look at the source code of the frei0r.curves effect. In it I could see that when the value string value="-1,414;-1,73159e-16#0;0#0,387;0|0,619;1#1;1#2,41421;1" is decomposed into its elements p00 (handle1), p01 (point), p02 (handle2) and p10 (handle1), p11 (point), p12 (handle2). The mapping of this points to the Bézier curve points P0..P3 is as follows: P0=p01 P1=p02 P2=p10 P3=p11 (source code lines 629+). The curve calculation doesn't use p00 and p12. Who could have deduced this from the documentation? xD

Finally, I was stricken by the blindingly un-obvious: when the tonal curve consists of multiple segments then each intermediate point has a left and right handle, that is, handle1 and handle2. For the overall start and end of the tonal curve the first left handle and the final right handle are not further considered. When manipulating handles, Kdenlive ensures that both handles connect to the intermediate point with the same slope so there's no break in the curve.

So I finally could reproduce my Kdenlive Protune effect curve and compare it with the formula I got from GoPro's David Newman. Case solved. ;D
User avatar
ttguy
Moderator
Posts
1152
Karma
6
OS
Hey Divo,
This sounds great.
Sounds like you understand how to use this stuff with respect to a real life example with a GoPro . But it is all techno babble to me. Do you reckon you could write up an explaination of all this for our manual and put it on http://userbase.kde.org/Kdenlive/Manual ... ier_Curves. Because I would love to know what you know.
TheDiveO
Registered Member
Posts
595
Karma
3
OS
At the moment I try to get a few more pieces into place. If that is done, yes, I can work on some Kdenlive doc.


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], q.ignora, watchstar