public static PlotModel StairStepSeriesDashedVertical()
        {
            var model = new PlotModel("StairStepSeries", "With dashed vertical lines");
            var s1 = new StairStepSeries("sin(x)")
            {
                Color = OxyColors.SkyBlue,
                VerticalLineStyle = LineStyle.Dash,
                MarkerType = MarkerType.None
            };
            for (double x = 0; x < Math.PI * 2; x += 0.5)
                s1.Points.Add(new DataPoint(x, Math.Sin(x)));
            model.Series.Add(s1);

            return model;
        }
        public static PlotModel StairStepSeriesThinVertical()
        {
            var model = new PlotModel("StairStepSeries", "With thin vertical lines");
            var s1 = new StairStepSeries("sin(x)")
            {
                Color = OxyColors.SkyBlue,
                StrokeThickness = 3,
                VerticalStrokeThickness = 0.4,
                MarkerType = MarkerType.None
            };
            for (double x = 0; x < Math.PI * 2; x += 0.5)
                s1.Points.Add(new DataPoint(x, Math.Sin(x)));
            model.Series.Add(s1);

            return model;
        }
        protected override PlotModel createModel(List<DataPoint> points)
        {
            var plotModel = new PlotModel();
            var functionSeries = new StairStepSeries();
            var categoryAxis = new CategoryAxis();

            categoryAxis.Position = AxisPosition.Left;
            categoryAxis.AxislineStyle = LineStyle.Solid;
            categoryAxis.MinorStep = 1;
            categoryAxis.TickStyle = TickStyle.None;
            categoryAxis.Labels.AddRange(Labels);
            plotModel.Axes.Add(categoryAxis);
            functionSeries.Points.AddRange(points);
            plotModel.Series.Add(functionSeries);
            plotModel.Title = Title;
            Points = functionSeries.Points;
            return plotModel;
        }
        public static PlotModel StairStepSeries()
        {
            var model = new PlotModel("StairStepSeries") { LegendSymbolLength = 24 };
            var s1 = new StairStepSeries("sin(x)")
                         {
                             Color = OxyColors.SkyBlue,
                             MarkerType = MarkerType.Circle,
                             MarkerSize = 6,
                             MarkerStroke = OxyColors.White,
                             MarkerFill = OxyColors.SkyBlue,
                             MarkerStrokeThickness = 1.5
                         };
            for (double x = 0; x < Math.PI * 2; x += 0.5)
                s1.Points.Add(new DataPoint(x, Math.Sin(x)));
            model.Series.Add(s1);

            return model;
        }
Ejemplo n.º 5
0
        public void AddSetpointLine(string title)
        {
            var setpoints = new StairStepSeries {
                Title = title,
                DataFieldX = "X",
                DataFieldY = "Y",
                Color = OxyColors.Red,
                MarkerType = MarkerType.None,
                MarkerSize = 2,
                MarkerStroke = OxyColors.Black,
                MarkerFill = OxyColors.Black,
                MarkerStrokeThickness = 1.5
            };

            this.setpoints.Add(title, 0);
            this.SetpointLines.Add(setpoints);
            this.Series.Add(setpoints);
        }
        private void StartFCH_Click(object sender, RoutedEventArgs e)
        {
            double fuzzifier = double.Parse(FuzzifierTextBox.Text);
            int clusterNum = int.Parse(ClusterNumTextBox.Text);

            CalcHistogram();

            labHist = labHist.Normalize(2);

            FuzzyCMeans fcm = new FuzzyCMeans(labHist, fuzzifier, clusterNum);

            fcm.run();

            /*
            for (int x = 0; x < clusterNum; x++)
            {
                double sum = 0.0;
                for (int y = 0; y < (int)Math.Pow(Division, 3.0); y++)
                {
                    sum += fcm.U[x, y];
                }
                //Console.WriteLine(sum);
            }*/

            double[] FCH = new double[clusterNum];

            for (int x = 0; x < clusterNum; x++)
            {
                double sum = 0.0;
                for (int y = 0; y < (int)Math.Pow(Division, 3.0); y++)
                {
                    sum += fcm.U[y, x] * rgbHist[y];
                }
                FCH[x] = sum;
            }

            // グラフの作成
            var graphStep = new StairStepSeries()
            {
                Color = OxyColors.Red,
                VerticalLineStyle = LineStyle.None,
                MarkerType = MarkerType.None
            };

            for (int x = 0; x < FCH.Count(); x++)
            {
                graphStep.Points.Add(new DataPoint(x, FCH[x]));
            }

            FCHHist.Series.Clear();
            FCHHist.Series.Add(graphStep);
            FCHHist.InvalidatePlot(true);

            FCH.ToList().ForEach(x => { Console.WriteLine(x); });
        }
        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;
        }
        private void InitializeGraph()
        {
            PlotModel plot = new PlotModel();

            OxyPlot.Axes.LinearAxis costAxis = new OxyPlot.Axes.LinearAxis(AxisPosition.Left);
            costAxis.Key = "cost";
            OxyPlot.Axes.LinearAxis progressionAxis = new OxyPlot.Axes.LinearAxis(AxisPosition.Right);
            progressionAxis.Key = "progression";

            plot.Axes.Add(costAxis); 
            plot.Axes.Add(progressionAxis);
            plot.Axes.Add(new OxyPlot.Axes.LinearAxis(AxisPosition.Bottom));

            OxyPlot.Series.ScatterSeries costSeries = new OxyPlot.Series.ScatterSeries();
            costSeries.YAxisKey = "cost";
            OxyPlot.Series.StairStepSeries progressionSeries = new OxyPlot.Series.StairStepSeries(OxyColor.FromRgb(0, 255, 0), LINES_THICKNESS, "Poprawa");
            progressionSeries.YAxisKey = "progression";
            OxyPlot.Series.StairStepSeries regressionSeries = new OxyPlot.Series.StairStepSeries(OxyColor.FromRgb(255, 0, 0), LINES_THICKNESS, "Pogorszenie");
            regressionSeries.YAxisKey = "progression";

            plot.Series.Add(costSeries);
            plot.Series.Add(progressionSeries);
            plot.Series.Add(regressionSeries);

            VM.GraphPlotModel = plot;
        }