View Full Version : Local gradient based interpolation
mikenadia
22nd May 2009, 14:15
It is a Catmull-Rom interpolator with adaptive tension based on local gradient.
in point 1, LG1= 2*Max(P0,P1,P2) - 2* Min(P0,P1,P2) -ABS(P1-P0) -ABS(P2-P1) -ABS(P2-P0)
tangent in 1 is a1*(P2-P0) with a1 being a function of LG1.
I assume that we prefer a decreasing tension with increasing LG (otherwise adapt the formulas to your own making).
Tension will be allowed to fluctuate between Rmin (for big LG) to 0.5 (for LG=0). It could be a staircase function
or something like a1=Rmin + (0.5 - Rmin)exp(-k*LG1)
Similar formulas for point 2 (using P1,P2,P3).
The blending coefficients will have to be recomputed all the time but the radius is only 2.
rfmmars
22nd May 2009, 15:55
It is a Catmull-Rom interpolator with adaptive tension based on local gradient.
in point 1, LG1= 2*Max(P0,P1,P2) - 2* Min(P0,P1,P2) -ABS(P1-P0) -ABS(P2-P1) -ABS(P2-P0)
tangent in 1 is a1*(P2-P0) with a1 being a function of LG1.
I assume that we prefer a decreasing tension with increasing LG (otherwise adapt the formulas to your own making).
Tension will be allowed to fluctuate between Rmin (for big LG) to 0.5 (for LG=0). It could be a staircase function
or something like a1=Rmin + (0.5 - Rmin)exp(-k*LG1)
Similar formulas for point 2 (using P1,P2,P3).
The blending coefficients will have to be recomputed all the time but the radius is only 2.
Please explain in detail, too advanced for me.
Richard
photorecall.net
mikenadia
22nd May 2009, 22:38
I am going to try to be clearer.
Catmull-Rom is explained in http://www.cs.cmu.edu/~462/projects/assn2/assn2/catmullRom.pdf
In this paper, the tension is fixed. I just made it variable.
The idea behind it is that sometimes the Mitchell-Retravali filter is prefered to Catmull-Rom (tension=0.5). The Mitchell-Retravali is simply a weighted average of the Catmull-Rom and the cubic filter. It is explained in http://www.cs.cornell.edu/Courses/cs465/2004fa/cvs/readings/sampling-notes-v2.pdf (p7).
I just try to make things different using the area of the triangle PoP1P2 (LG/2) as a measurement of curvature and I assume that it may be an interesting variable for the "preferred" tension.
You just have to define your "tension" function with the variables you want to use ( and it is by far the most difficult thing ). The tension function I use has no merit. It is just an example.
This function (like Catmull-Rom but not Mitchell-Retravali) has local control (everything outside the interval P0P3 has no influence on the interpolation).
The spline36 model is based on the values of P(-2),P(-1),P(0),P(1), P(2), P(3).
This model will be based on P''(0),P(-1),P(0),P(1), P(2), P"(1).
Not a convolution kernel anymore ( still a weighted sum of P(-1),P(0),P(1), P(2) but the weights are not constant and depends upon P''(0) and P"(1)). If we take LG as a measure of abs(P''(x)), then the weights will depends only on P(-1),P(0),P(1), P(2).
Edit: As a first step, the system could be trained. By downscaling and upscaling back to the original size, we could try to find if there is a relationship between the "preferred" tension and some indicator that depends only on P0 P1 P2 P3 (LG, ....) and there must be one otherwise the default parameters in BiCubicResize will not be b = 1/3 and
c = 1/3. ( http://avisynth.org/mediawiki/Resize )
Edit2: Not gradient based. Only tension based but allow different formulas for n<0 and n>0 to keep symetry.
for n<=0. 2*P'(i)= ((1-t)*(P(i)-P(i-1)) + ((1+t)*(P(i+1)-P(i))
for n>0 . 2*P'(i)= ((1+t)*(P(i)-P(i-1)) + ((1-t)*(P(i+1)-P(i))
t could be positive or negative (no clue where the bias should be).
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.