Closed masc4ii closed 5 years ago
Oh, ugly artifacts indeed.
Cosine interpolation... in da house!
Does it work? Wanna try :P
It is just GUI only for now. I'm gonna keep tinkering tonight.
BTW that cosine interpolation can be useful for gradation curves?
Not really. Gradation curve needs cubic interpolation (mathematical derivation != 0 in each point) and for HSL curves mathematical derivation needs to be 0 in each point, and lines in between have to be independant. That's the reason for 2 different interpolation methods.
Thanks for info :)
Now you can test. It is not ready yet. See commit for some more comments... Quality is a bit better now, because I change luma level in dependency to saturation. This brings less artifacts... Therefor there seems to be a problem, when raising luma for a color now... brings colorful artifacts. Funny.
Change new code in raw_processing.c to this, to get HueVsSat:
//Testcode for HueVs...
if( processing->hue_vs_luma_used )
{
for (uint16_t * pix = img; pix < img_end; pix += 3)
{
float hsl[3];
rgb_to_hsl( pix, hsl );
uint16_t hue = (uint16_t)hsl[0];
hsl[1] += processing->hue_vs_luma[hue];//*hsl[1]*2.0;
if( hsl[1] < 0.0 ) hsl[1] = 0.0;
if( hsl[1] > 1.0 ) hsl[1] = 1.0;
hsl_to_rgb( hsl, pix );
}
}
Artifacts are very ugly, all over the image ugly dots dots dots :astonished:
I only get dots on moiree artifacts. No idea how to filter them. In past I had exactly the same with the vibrance slider but got it fixed (there was a wrong condition in "current saturation" (before applying) calculation). Here there is different code... have to look into that. Maybe these rgb2hsl and hsl2rgb functions are not correct (copied from somewhere).
Well, I have to correct myself. It gets more ugly with noisier images. Other than that with good image it does the job.
I HATED!!! color noise since my 1st VHS camera ;)
Another example. Look at water surface.
Japp, right. In the end it is very similar as the old vibrance problem. In the first version where this was included, it looked the same.
We could try to make thing like this:
When staying over created point on a Hue vs Luma curve rotate mouse wheel or click and hold right mouse button and then drag the mouse pointer. This will change 3rd dimension of this point which can be the Saturation. This means we could have 3d curve Hue vs Lightness vs Saturation. Interpolate these points for example with 3D Hermite Interpolation:
/*
Tension: 1 is high, 0 normal, -1 is low
Bias: 0 is even,
positive is towards first segment,
negative towards the other
*/
double HermiteInterpolate(
double y0,double y1,
double y2,double y3,
double mu,
double tension,
double bias)
{
double m0,m1,mu2,mu3;
double a0,a1,a2,a3;
mu2 = mu * mu;
mu3 = mu2 * mu;
m0 = (y1-y0)*(1+bias)*(1-tension)/2;
m0 += (y2-y1)*(1-bias)*(1-tension)/2;
m1 = (y2-y1)*(1+bias)*(1-tension)/2;
m1 += (y3-y2)*(1-bias)*(1-tension)/2;
a0 = 2*mu3 - 3*mu2 + 1;
a1 = mu3 - 2*mu2 + mu;
a2 = mu3 - mu2;
a3 = -2*mu3 + 3*mu2;
return(a0*y1+a1*m0+a2*m1+a3*y2);
}
Editing directly like with 3D Lut.
I planned to edit hue and saturation with further diagrams. HueVsSaturation is done now. And HueVsLuma works better now too (at least for my testclips). Try out.
Adobe seems to have the same problems and uses a blur on the edited areas (see the sky):
H vs S Works great!
Did you also blur H vs L processed areas? It looks lot more better.
No, I tried some different math... I now multiply instead of add/subtract, so it works in relation what was before -> artifacts are not amplified.
Do not get the meaning of "in relation what was before", but it really helps a lot :)
Before:
hsl[2] += processing->hue_vs_luma[hue] * sat * 2;
Now:
hsl[2] *= 1.0 + (processing->hue_vs_luma[hue] * sat * 2);
Hue vs. Hue working... yeay. Now doing this into receipt...
Btw: should we create a new tab "HSL" for these 3 curves, or is it okay in Processing tab?
Now we have full receipt support for HSL curves.
I think it deserves separate section. It is more on color correction side.
Overall... GREAT job MAN! 😁
So I'll add a new Groupbox for it. In Processing tab there are too many elements now, I think too.
When mouse leaves area accidentally the point deleted and annoying behavior happens.
I just wanna ask you to disable deleting point when mouse leaves the working area in all 3 editors. Just do nothing and leave the dragged point at the edge of the area where mouse crossed the border. I think it will be more comfortable.
When mouse leaves area accidentally the point deleted and annoying behavior happens.
I just wanna ask you to disable deleting point when mouse leaves the working area in all 3 editors. Just do nothing and leave the dragged point at the edge of the area where mouse crossed the border. I think it will be more comfortable.
Done.
And HSL Groupbox: also done.
Cool! Thanks! I'm out of reach of any PC now... will check it tomorrow at work.
It just fu..n works! Thanks!
In Lightroom there are these HSL sliders. I tried to create something, what is able to do the same, but what is easier to use. Here the example for Hue vs. Luma, I also got it drawn for Hue vs. Saturation:
I tried to implement also the processing functions (as prototype). But here I got problems. I found RGB2HSL and HSL2RGB here (and changed it to 16bit RGB): https://www.programmingalgorithms.com/algorithm/hsl-to-rgb?lang=C%2B%2B https://www.programmingalgorithms.com/algorithm/rgb-to-hsl The conversion works so far - that means, converting and converting back brings the same picture like without conversion. But if I try to select some pixels by Hue value and change their Luma or Saturation strange things happen.
Testcode for lowering the luma by 20% between red and yellow:
Or lower luma from cyan to violett by 20%:
In both pics, see the mountains... I'll need some help here! :-) Someone likes to help?
Edit: Doing some smoother functions (a triangle, before it was just a square) and it looks better. But is it good to multiply something onto the luma? See all the artifacts everywhere in the sky and on the buildings: