コード例 #1
0
        private void MergeDG(ref ReportDB[] mDB, ref ReportDB[] DB)
        {
            if (mDB == null)
            {
                mDB = new ReportDB[DB.Length];

            }

            for (int i = 0; i < DB.Length; i++)
            {
                if (mDB[i] == null)
                {
                    mDB[i] = new ReportDB();

                    int tnum = DB[i].TGS.Count;

                    for (int j = 0; j < tnum; j++)
                    {
                        TG tg = new TG();
                        tg.m_ID = ((TG)DB[i].TGS[j]).m_ID;
                        mDB[i].TGS.Add(tg);
                    }
                }

                int tcount = DB[i].TGS.Count;

                for (int x = 0; x < tcount; x++)
                {
                    TG ttg = (TG)mDB[i].TGS[x];

                    TG stg = null;

                    for (int k = 0; k < tcount; k++)
                    {
                        if (((TG)DB[i].TGS[x]).m_ID == ttg.m_ID)
                        {
                            stg = (TG)DB[i].TGS[x];
                            break;
                        }
                    }

                    if (stg == null)
                        continue;

                    int tgcount = stg.Arr.Count;

                    for (int y = 0; y < tgcount; y++)
                    {
                        ttg.Arr.Add(stg.Arr[y]);
                    }
                }
            }
        }
コード例 #2
0
        private bool ReadParam(ref ReportDB[] DB, ref string path)
        {
            if (!File.Exists(path))
                return false;

            try
            {
                StreamReader reader = new StreamReader(path);

                string tstr = reader.ReadLine();
                int m_ClientsNum = int.Parse(tstr);
                tstr = reader.ReadLine();

                //아이피 읽어들이기
                //m_Avips = new string[m_ClientsNum];

                for (int i = 0; i < m_ClientsNum; i++)
                {
                    tstr = reader.ReadLine();
                }

                //패스워드 읽기
                tstr = reader.ReadLine();

                //카메라 파라미터 읽기

                //m_AvParam = new AVParam[m_ClientsNum];

                for (int i = 0; i < m_ClientsNum; i++)
                {
                    //m_AvParam[i] = new AVParam();
                    tstr = reader.ReadLine();
                    //m_AvParam[i].left = int.Parse(tstr);
                    tstr = reader.ReadLine();
                    //m_AvParam[i].top = int.Parse(tstr);
                    tstr = reader.ReadLine();
                    //m_AvParam[i].width = int.Parse(tstr);
                    tstr = reader.ReadLine();
                    //m_AvParam[i].height = int.Parse(tstr);
                    tstr = reader.ReadLine();
                    //m_AvParam[i].fps = int.Parse(tstr);
                    tstr = reader.ReadLine();
                    //m_AvParam[i].res = (IMAGE_RESOLUTION)Enum.Parse(typeof(IMAGE_RESOLUTION), tstr);
                    tstr = reader.ReadLine();
                    //m_AvParam[i].codecType = (AVCodecType)Enum.Parse(typeof(AVCodecType), tstr);
                    tstr = reader.ReadLine();
                    //m_AvParam[i].quality = int.Parse(tstr);
                    tstr = reader.ReadLine();
                    //m_AvParam[i].intraFramePeriod = int.Parse(tstr);
                    tstr = reader.ReadLine();
                    //m_AvParam[i].bitrate = int.Parse(tstr);
                    tstr = reader.ReadLine();
                    //m_AvParam[i].stream_id = int.Parse(tstr);
                    tstr = reader.ReadLine();
                    //m_AvParam[i].dn_mode = (DN_modes)Enum.Parse(typeof(DN_modes), tstr);
                    tstr = reader.ReadLine();
                    //m_AvParam[i].light = (Light_modes)Enum.Parse(typeof(Light_modes), tstr);
                    tstr = reader.ReadLine();
                    //m_AvParam[i].CameraMode = int.Parse(tstr);
                    tstr = reader.ReadLine();
                    //m_AvParam[i].ShutterSpeed = int.Parse(tstr);
                }

                tstr = reader.ReadLine();
                TargetType m_TargetType = (TargetType)Enum.Parse(typeof(TargetType), tstr);
                tstr = reader.ReadLine();
                m_TargetWidth = double.Parse(tstr);
                tstr = reader.ReadLine();
                m_TargetHeight = double.Parse(tstr);
                tstr = reader.ReadLine();
                m_TargetLimit = double.Parse(tstr);
                tstr = reader.ReadLine();
                double m_RotateLimit = double.Parse(tstr);
                tstr = reader.ReadLine();
                double m_ScaleLimit = double.Parse(tstr);
                tstr = reader.ReadLine();

                //타깃정보 입력
                tstr = reader.ReadLine();

                if (tstr.Length > 0)
                {
                    int imgnum = int.Parse(tstr);
                    DB = new ReportDB[imgnum];

                    for (int i = 0; i < imgnum; i++)
                    {
                        DB[i] = new ReportDB();
                        tstr = reader.ReadLine();
                        tstr = reader.ReadLine();

                        if (tstr == "initialized")
                        {
                            DB[i].m_Initialized = true;
                            tstr = reader.ReadLine();
                            int tnum = int.Parse(tstr);

                            if (tnum > 0)
                            {

                                for (int x = 0; x < tnum; x++)
                                {
                                    TG tg = new TG();
                                    DB[i].TGS.Add(tg);
                                }

                                //DB[i].m_Targets = new TargetDb[tnum];

                                for (int j = 0; j < tnum; j++)
                                {
                                    TG tg = (TG)DB[i].TGS[j];
                                    //m_Images[i].m_Targets[j] = new TargetDb();
                                    tg.m_ID = reader.ReadLine();
                                    tstr = reader.ReadLine();
                                    tg.ix = double.Parse(tstr);
                                    tstr = reader.ReadLine();
                                    tg.iy = double.Parse(tstr);
                                    tstr = reader.ReadLine();
                                    tg.m_DWidth = double.Parse(tstr);
                                    tstr = reader.ReadLine();
                                    tg.m_DHeight = double.Parse(tstr);
                                    tstr = reader.ReadLine();

                                    int cnum = int.Parse(tstr);

                                    if (cnum > 0)
                                    {
                                        tg.m_Corners = new PointF[cnum];

                                        for (int x = 0; x < cnum; x++)
                                        {
                                            tg.m_Corners[x] = new PointF();
                                            tstr = reader.ReadLine();
                                            char[] splt = { ',' };
                                            string[] rst = tstr.Split(splt);
                                            tg.m_Corners[x].X = float.Parse(rst[0]);
                                            tg.m_Corners[x].Y = float.Parse(rst[1]);

                                        }
                                    }

                                }
                            }

                            //ResetTargets(false, m_Images[i].m_Targets.Length);

                        }
                        else
                        {
                            DB[i].m_Initialized = false;
                        }

                    }
                }

                reader.Close();
                return true;

            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.ToString());
                return false;
            }
        }
コード例 #3
0
        private void CalcStatic(ref TG tg, ref double maxhor, ref double maxver, ref double evenhor, ref double evenver, ref double maxang, ref double maxscale)
        {
            int num = tg.Arr.Count;

            double dx = 0, dy = 0;
            maxang = -10000;
            maxscale = -10000;

            for (int i = 0; i < num; i++)
            {
                COORD cd = (COORD)tg.Arr[i];
                dx += cd.dx;
                dy += cd.dy;

                if (cd.dx > maxhor)
                    maxhor = cd.dx;
                if (cd.dy > maxver)
                    maxver = cd.dy;
                if (cd.ang > maxang)
                    maxang = cd.ang;
                if (cd.scale > maxscale)
                    maxscale = cd.scale;

            }

            evenhor = dx / num;
            evenver = dy / num;
        }