/// <summary> /// Implements filter rebuilding. /// </summary> protected override void Rebuild() { float s = (Intensity.log05 / (float)Math.Log(0.5 - value2gamma(shadows))); float l = (Intensity.log05 / (float)Math.Log(0.5 + value2gamma(lights))); this.values = Intensity.LogStretch(s, l, 256); }
/// <summary> /// Returns the correction mask. /// </summary> /// <param name="s">Shadows</param> /// <param name="l">Highlights</param> /// <param name="length">Length</param> /// <returns>Matrix</returns> public static float[,] LogStretch(float s, float l, int length) { float[,] table = new float[length, length]; float w, v; int x, y; for (x = 0; x < length; x++) { w = x / (float)length; for (y = 0; y < length; y++) { v = y / (float)length; table[x, y] = Intensity.LogStretch(w, v, s, l); } } return(table); }