private Vector<double> createRGBHist(List<Vector<double>> rgbList) { Vector<double> RGB = new DenseVector((int)Math.Pow(Division, 3.0)); foreach (var rgb in rgbList) { int index = color2Index(rgb[0]) * Division * Division + color2Index(rgb[1]) * Division + color2Index(rgb[2]); RGB[index]++; } // グラフの作成 var graphStep = new StairStepSeries() { Color = OxyColors.Red, VerticalLineStyle = LineStyle.None, MarkerType = MarkerType.None }; for (int x = 0; x < RGB.Count(); x++) { graphStep.Points.Add(new DataPoint(x, RGB[x])); } ColorHist.Series.Clear(); ColorHist.Series.Add(graphStep); ColorHist.InvalidatePlot(true); return RGB; }
private Vector<double> createLabHist(List<Vector<double>> rgbList) { Vector<double> Lab = new DenseVector((int)Math.Pow(Division, 3.0)); foreach (var rgb in rgbList) { Vector<double> LabVec = CIELab.XYZtoLab(XYZ.RGB2XYZ(rgb, "sRGB")); int index = color2Index(2.55 * LabVec[0]) * Division * Division + color2Index(1.3859 * LabVec[1] + 119.18) * Division + color2Index(1.2624 * LabVec[2] + 136.34); Lab[index]++; } // グラフの作成 var graphStep = new StairStepSeries() { Color = OxyColors.Red, VerticalLineStyle = LineStyle.None, MarkerType = MarkerType.None }; for (int x = 0; x < Lab.Count(); x++) { graphStep.Points.Add(new DataPoint(x, Lab[x])); } Console.WriteLine("----------------------------------------"); LabHist.Series.Clear(); LabHist.Series.Add(graphStep); LabHist.InvalidatePlot(true); return Lab; }