Example #1
0
        public static void save_arround(short[] input, Form1.Save_data s)
        {
            Bitmap   bitmap = new Bitmap(350, 350);
            Graphics e      = Graphics.FromImage(bitmap);

            if (input.Length == 25)
            {
                for (int i = 0; i < 6; i++)
                {
                    e.DrawLine(new Pen(Color.Black), i * 70, 0, i * 70, 349);
                    e.DrawLine(new Pen(Color.Black), 0, i * 70, 349, i * 70);
                }
                e.DrawLine(new Pen(Color.Black), 349, 0, 349, 350);
                e.DrawLine(new Pen(Color.Black), 0, 349, 350, 349);
                Font drawFont = new Font("Arial", 20, FontStyle.Regular);
                int  num      = 0;
                for (int i = 0; i < 5; i++)
                {
                    for (int j = 0; j < 5; j++)
                    {
                        e.FillRectangle(new SolidBrush(GrayTonew_color_V(normailze(input[num]))), new Rectangle(70 * j, 70 * i, 70, 70));
                        e.DrawString(input[num].ToString(), drawFont, new SolidBrush(Color.Black), new PointF(70 * j + 20, 70 * i + 20));
                        num++;
                    }
                }
                bitmap.Save(string.Format("{0}\\{1}_{2}_({3},{4}).png", s.path, s.frame_id, s.area, s.x, s.y));
            }
            else
            {
                for (int i = 0; i < 8; i++)
                {
                    e.DrawLine(new Pen(Color.Black), i * 50, 0, i * 50, 349);
                    e.DrawLine(new Pen(Color.Black), 0, i * 50, 349, i * 50);
                }
                e.DrawLine(new Pen(Color.Black), 349, 0, 349, 350);
                e.DrawLine(new Pen(Color.Black), 0, 349, 350, 349);
                Font drawFont = new Font("Arial", 15, FontStyle.Regular);
                int  num      = 0;
                for (int i = 0; i < 7; i++)
                {
                    for (int j = 0; j < 7; j++)
                    {
                        e.FillRectangle(new SolidBrush(GrayTonew_color_V(normailze(input[num]))), new Rectangle(50 * j, 50 * i, 50, 50));
                        e.DrawString(input[num].ToString(), drawFont, new SolidBrush(Color.Black), new PointF(50 * j + 10, 50 * i + 10));
                        num++;
                    }
                }
                bitmap.Save(string.Format("{0}\\{1}_{2}_({3},{4}).png", s.path, s.frame_id, s.area, s.x, s.y));
            }
        }
Example #2
0
        public static void WriteCVS(ref StreamWriter swd, Form1.Save_data Data)
        {
            StringBuilder sbd = new StringBuilder();

            sbd.Append(Data.frame_id).Append(",").Append(Data.x).Append(",").Append(Data.y).Append(",");
            for (int i = 0; i < Data.data_7x7.Length; i++)
            {
                sbd.Append(Data.data_7x7[i]).Append(",");
            }
            sbd.Append(Data.area).Append(",").Append(Data.lenght).Append(",").Append(Data.second_area);
            swd.WriteLine(sbd);
            swd.Flush();
            // Console.WriteLine(Data.frame_id);
        }