Esempio n. 1
0
        public void GetResultData()
        {
            VehicleRecogResult result = ZmqVehicleSink.GetInstance().GetVehicleByPic(mTargetFileName);

            if (null != result)
            {
                mVehResult = result;
                if (null != result.Veh)
                {
                    foreach (var item in result.Veh)
                    {
                        string[] vehicleLocation = item.Clwz.Split(',');
                        if (vehicleLocation.Length == 4)
                        {
                            int _x = Convert.ToInt32(vehicleLocation[0]);
                            int _y = Convert.ToInt32(vehicleLocation[1]);
                            int _w = Convert.ToInt32(vehicleLocation[2]);
                            int _h = Convert.ToInt32(vehicleLocation[3]);

                            mListCustomBodyRec.Add(new Rectangle(new Point(_x, _y), new Size(_w, _h)));
                            TIEVision.COMMON.HOBJ.HOBJInfo info = new TIEVision.COMMON.HOBJ.HOBJInfo();
                            info.info.rect.x      = _x;
                            info.info.rect.y      = _y;
                            info.info.rect.width  = _w;
                            info.info.rect.height = _h;
                            mResultInfoList.Add(info);
                        }
                    }
                }
            }

            pictureEdit1.Invalidate();
        }
Esempio n. 2
0
        private void simpleButtonMax_Click(object sender, EventArgs e)
        {
            if (XtraMessageBox.Show("是否退出程序!", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
            {
                ZmqComparison.GetInstance().RleaseZmqComparison();

                ZmqVehicleSink.GetInstance().RleaseZmqVehicleSink();


                //ZmqFaceHitResLib.GetInstance().RleaseZmqFaceHitResLib();
                //frmVideoAnalysis.Close();
                try
                {
                    bool isExist = ServiceHelper.IsServiceExisted("TFeatureComparison");
                    if (isExist)
                    {
                        ServiceHelper.StopService("TFeatureComparison");
                    }
                    isExist = ServiceHelper.IsServiceExisted("HCarRegWorker");
                    if (isExist)
                    {
                        ServiceHelper.StopService("HCarRegWorker");
                    }
                    isExist = ServiceHelper.IsServiceExisted("HCarRegProxy");
                    if (isExist)
                    {
                        ServiceHelper.StopService("HCarRegProxy");
                    }
                }
                catch (Exception ex)
                {
                    LogHelper.WriteLog(typeof(FrmMain), ex.Message);
                }
                this.Close();
                this.Dispose();
                Application.Exit();
            }
            else
            {
                // e.Cancel = true;
            }
        }
Esempio n. 3
0
        public void SavePicturesToDB()
        {
            mVehicleTaskList = VehicleMongoDAL.GetInstance().GetAllVehicleTask();
            if (null != mVehicleTaskList)
            {
                if (mVehicleTaskList.Count > 0)
                {
                    for (int i = 0; i < mVehicleTaskList.Count; i++)
                    {
                        if (mVehicleTaskList[i].TaskState == "0")
                        {
                            currentIndex = i;
                            break;
                        }
                        else
                        {
                            currentIndex = -1;
                        }
                    }

                    if (currentIndex >= 0)
                    {
                        foreach (FileData f in FastDirectoryEnumerator.EnumerateFiles(mVehicleTaskList[currentIndex].TaskPath, "*", System.IO.SearchOption.AllDirectories))
                        {
                            string filename     = f.Path.ToLower();
                            string FileFullName = f.Path;
                            if ((filename.Contains(".jpg") || filename.Contains(".bmp") || filename.Contains(".jpeg")))
                            {
                                m_listFilePath.Add(f.Path);
                                //InsertIntoMongo(filename);

                                mVehicleTaskList[currentIndex].TaskCount = mTaskCount++.ToString();
                            }
                            if (m_listFilePath.Count >= 100)
                            {
                                ZmqVehicleSink.GetInstance().SendVehicles(m_listFilePath);
                                try
                                {
                                    mVehicleTaskList[currentIndex].TaskCount = (Convert.ToInt32(mVehicleTaskList[currentIndex].TaskCount) + m_listFilePath.Count).ToString();
                                    VehicleMongoDAL.GetInstance().UpdateVehicleTask(mVehicleTaskList[currentIndex]);
                                    this.Invoke(new DelegateBindHandler(BindDataSource));
                                }
                                catch
                                { }
                                m_listFilePath.Clear();
                            }
                        }
                        if (m_listFilePath.Count > 0)
                        {
                            ZmqVehicleSink.GetInstance().SendVehicles(m_listFilePath);
                            try
                            {
                                mVehicleTaskList[currentIndex].TaskCount = (Convert.ToInt32(mVehicleTaskList[currentIndex].TaskCount) + m_listFilePath.Count).ToString();
                                VehicleMongoDAL.GetInstance().UpdateVehicleTask(mVehicleTaskList[currentIndex]);
                                this.Invoke(new DelegateBindHandler(BindDataSource));
                            }
                            catch
                            { }
                            m_listFilePath.Clear();
                        }
                        mVehicleTaskList[currentIndex].TaskState = "1";
                        VehicleMongoDAL.GetInstance().UpdateVehicleTask(mVehicleTaskList[currentIndex]);
                        loadTaskData();
                    }
                }
            }

            try
            {
                Thread.Sleep(1000);
                this.Invoke(new DelegateRestartTime(RestartTime));
            }
            catch { }
        }