public static void CreatePrevBand_V2G_Fomula(RGB_Double[] RGBvoltages, double[] Grays) { double[] Red_Voltages = new double[RGBvoltages.Length]; double[] Green_Voltages = new double[RGBvoltages.Length]; double[] Blue_Voltages = new double[RGBvoltages.Length]; double[] grays = new double[Grays.Length]; for (int i = 0; i < RGBvoltages.Length; i++) { Red_Voltages[i] = RGBvoltages[i].double_R; Green_Voltages[i] = RGBvoltages[i].double_G; Blue_Voltages[i] = RGBvoltages[i].double_B; grays[i] = Grays[i]; } PrevBand_V2G_Fomula[0] = SplineInterpolator.createMonotoneCubicSpline(Red_Voltages, grays); PrevBand_V2G_Fomula[1] = SplineInterpolator.createMonotoneCubicSpline(Green_Voltages, grays); PrevBand_V2G_Fomula[2] = SplineInterpolator.createMonotoneCubicSpline(Blue_Voltages, grays); }
public static void CreatePrevBand_G2V_Fomula(double[] Grays, RGB_Double[] RGBvoltages) { double[] Red_Voltages = new double[RGBvoltages.Length]; double[] Green_Voltages = new double[RGBvoltages.Length]; double[] Blue_Voltages = new double[RGBvoltages.Length]; double[] grays = new double[Grays.Length]; int index = 0; for (int i = RGBvoltages.Length - 1; i >= 0; i--) { Red_Voltages[index] = RGBvoltages[i].double_R; Green_Voltages[index] = RGBvoltages[i].double_G; Blue_Voltages[index] = RGBvoltages[i].double_B; grays[index] = Grays[i]; index++; } PrevBand_G2V_Fomula[0] = SplineInterpolator.createMonotoneCubicSpline(grays, Red_Voltages); PrevBand_G2V_Fomula[1] = SplineInterpolator.createMonotoneCubicSpline(grays, Green_Voltages); PrevBand_G2V_Fomula[2] = SplineInterpolator.createMonotoneCubicSpline(grays, Blue_Voltages); }