public MinMaxRule(SetOfSigns _X, SetOfSigns _Y)
 {
     X = _X;
     Y = _Y;
     x0 = X[0];
     y0 = Y[0];
 }
 public LinRule(SetOfSigns[] imgs)
 {
     for (int i = 0; i < imgs.Count(); i++)
     {
         for (int j = i + 1; j < imgs.Count(); j++)
         {
             MinMaxRule rl = new MinMaxRule(imgs[i], imgs[j]);
             mxRuleList.Add(rl);
         }
     }
 }
示例#3
0
 private void Set2Button_Click(object sender, EventArgs e)
 {
     if (taskMod)
     {
         clearButton_Click(sender, e);
         taskMod = false;
         cellsize = 1;
     }
     if (imgs == null)
     {
         imgs = new PatternRecognitionLib.SetOfSigns[2];
     }
     if (imgs[1] == null)
     {
         imgs[1] = new PatternRecognitionLib.SetOfSigns();
     }
     ImgNum = 1;
     NumIdx = 1;
 }
示例#4
0
        public static void WriteTask(SetOfSigns[] imgs,int cellsize)
        {
            if (imgs != null)
            {
                SaveFileDialog sf = new SaveFileDialog();
                sf.Title = "Выберите файл";
                sf.Filter = "Текстовые файлы|*.txt";

                if (sf.ShowDialog() == DialogResult.OK)
                {
                    TextWriter tw = new StreamWriter(sf.FileName);
                    tw.WriteLine("//число образов");
                    tw.WriteLine(cellsize);
                    tw.WriteLine("//число образов");
                    tw.WriteLine(imgs.Count());
                    for (int i = 0; i < imgs.Count(); i++)
                    {
                        tw.WriteLine("//image" + (i + 1));
                        tw.WriteLine(imgs[i].ToString());
                    }
                    tw.Close();
                }
            }
        }
示例#5
0
        public static SetOfSigns[] ReadTask(out int cellsize)
        {
            SetOfSigns[] imgs;
            OpenFileDialog of = new OpenFileDialog();
            of.Title = "Выберите файл";
            of.Filter = "Текстовые файлы|*.txt";

            cellsize = 1;

            if (of.ShowDialog() == DialogResult.OK)
            {
                TextReader tr = new StreamReader(of.FileName);
                cellsize = Int32.Parse(NextString(tr));
                int n = Int32.Parse(NextString(tr));
                imgs = new SetOfSigns[n];
                for (int i = 0; i < n; i++)
                {
                    string tmp = NextString(tr);
                    string[] objs = tmp.Split(';');
                    imgs[i] = new SetOfSigns(objs.Count() - 1);
                    for (int j = 0; j < objs.Count() - 1; j++)
                    {
                        string[] coords = objs[j].Split(',');
                        float[] crds = new float[coords.Count()];
                        for (int k = 0; k < crds.Count(); k++)
                        {
                            crds[k] = float.Parse(coords[k]);
                        }
                        imgs[i][j] = new vectorObject(crds);
                    }
                }
                tr.Close();
                return imgs;
            }

            return null;
        }
示例#6
0
 public static void WriteTask(SetOfSigns[] imgs, int cellsize)
 {
     Parser.WriteTask(imgs, cellsize);
 }