Beispiel #1
0
        /// <summary>
        /// Initialize halcon procedures
        /// </summary>
        public static void InitializeProcedures()
        {
            hDevEngine.SetEngineAttribute("execute_procedures_jit_compiled", "true");
            hDevEngine.SetProcedurePath(Directory.GetCurrentDirectory());

            HDevProcedure hDevProcedureCheckColor = new HDevProcedure("CheckColor");

            hDevprocedureCallCheckColor = new HDevProcedureCall(hDevProcedureCheckColor);

            HDevProcedure hDevProcedureCreateLogos = new HDevProcedure("CreateLogos");

            hDevprocedureCallCreateLogos = new HDevProcedureCall(hDevProcedureCreateLogos);

            HDevProcedure hDevProcedureCheckLogos = new HDevProcedure("CheckLogos");

            hDevprocedureCallCheckLogos = new HDevProcedureCall(hDevProcedureCheckLogos);

            HDevProcedure hDevProcedureCheckText = new HDevProcedure("CheckText");

            hDevProcedureCallCheckText = new HDevProcedureCall(hDevProcedureCheckText);

            HDevProcedure hDevProcedureCheckShapes = new HDevProcedure("CheckShapes");

            hDevProcedureCallCheckShapes = new HDevProcedureCall(hDevProcedureCheckShapes);
        }
    private void rake(HObject hoImage, out HObject hoRegions, HTuple hvElements, HTuple hvDetectHeight,
                      HTuple hvDetectWidth, HTuple hvSigma, HTuple hvThreshold, HTuple hvTransition,
                      HTuple hvSelect, HTuple hvRow1, HTuple hvColumn1, HTuple hvRow2, HTuple hvColumn2,
                      out HTuple hvBeginRow, out HTuple hvBeginCol)
    {
        HDevProcedure     rakeProc = new HDevProcedure("rake");
        HDevProcedureCall rakeProcCall;

        rakeProcCall = new HDevProcedureCall(rakeProc);
        rakeProcCall.SetInputIconicParamObject("Image", hoImage);
        rakeProcCall.SetInputCtrlParamTuple("Elements", hvElements);
        rakeProcCall.SetInputCtrlParamTuple("DetectHeight", hvDetectHeight);
        rakeProcCall.SetInputCtrlParamTuple("DetectWidth", hvDetectWidth);
        rakeProcCall.SetInputCtrlParamTuple("Sigma", hvSigma);
        rakeProcCall.SetInputCtrlParamTuple("Threshold", hvThreshold);
        rakeProcCall.SetInputCtrlParamTuple("Transition", hvTransition);
        rakeProcCall.SetInputCtrlParamTuple("Select", hvSelect);
        rakeProcCall.SetInputCtrlParamTuple("Row1", hvRow1);
        rakeProcCall.SetInputCtrlParamTuple("Column1", hvColumn1);
        rakeProcCall.SetInputCtrlParamTuple("Row2", hvRow2);
        rakeProcCall.SetInputCtrlParamTuple("Column2", hvColumn2);
        rakeProcCall.Execute();
        // get output parameters from procedure call

        hoRegions  = rakeProcCall.GetOutputIconicParamXld("Regions");
        hvBeginRow = rakeProcCall.GetOutputCtrlParamTuple("ResultRow");
        hvBeginCol = rakeProcCall.GetOutputCtrlParamTuple("ResultColumn");

        rakeProcCall.Dispose();
        rakeProc.Dispose();
    }
Beispiel #3
0
        public static HTuple GetBitFromPLC(HTuple Dxxx, HTuple GetIndexBit, HTuple socket)
        {
            HTuple data = -1;

            try
            {
                HDevProcedure     getDataPlc     = new HDevProcedure("Melsoft_3E_Revc");
                HDevProcedureCall getDataPlcCall = new HDevProcedureCall(getDataPlc);
                HDevProcedure     GetBitPlc      = new HDevProcedure("Get_Bit_Of_Word");
                HDevProcedureCall GetBitPlcCall  = new HDevProcedureCall(GetBitPlc);
                //_getDataPLC.SetInputCtrlParamTuple(["String","Destination","Lenght","Socket"],
                getDataPlcCall.SetInputCtrlParamTuple("Data_Type", "Word");
                getDataPlcCall.SetInputCtrlParamTuple("Destination", Dxxx);
                getDataPlcCall.SetInputCtrlParamTuple("Lenght", 1);
                getDataPlcCall.SetInputCtrlParamTuple("Socket", socket);
                getDataPlcCall.Execute();
                data = getDataPlcCall.GetOutputCtrlParamTuple("Data_Tuple");
                GetBitPlcCall.SetInputCtrlParamTuple("Data", data);
                GetBitPlcCall.SetInputCtrlParamTuple("Order_Tuple", GetIndexBit);
                GetBitPlcCall.Execute();
                data = GetBitPlcCall.GetOutputCtrlParamTuple("Out_Tuple");
            }
            catch (Exception ex)
            {
                data = "Error";
            }
            return(data);
        }
        void getOrigin(HObject Img, HObject Region_Binary, HObject Region_First, HObject Region_Second, HTuple HomMat2D_TransRegion)
        {
            HTuple RowProj = 0;
            HTuple ColProj = 0;
            HTuple Angle_  = 0;

            //Input
            HDevProcedure     getOrigin     = new HDevProcedure("create_origin_from_region");
            HDevProcedureCall getOriginCall = new HDevProcedureCall(getOrigin);

            getOriginCall.SetInputIconicParamObject("Image", Img);
            getOriginCall.SetInputIconicParamObject("Region_Binary", Region_Binary);
            getOriginCall.SetInputIconicParamObject("Region_First", Region_First);
            getOriginCall.SetInputIconicParamObject("Region_Second", Region_Second);
            getOriginCall.SetInputCtrlParamTuple("HomMat2D_TransRegion", HomMat2D_TransRegion);
            getOriginCall.SetInputCtrlParamTuple("showOrigin", "true");

            getOriginCall.Execute();

            //Output
            RowProj = getOriginCall.GetOutputCtrlParamTuple("RowProj");
            ColProj = getOriginCall.GetOutputCtrlParamTuple("ColProj");
            Angle_  = getOriginCall.GetOutputCtrlParamTuple("Angle");
            window.SetColor("green");
            HOperatorSet.GenCrossContourXld(out HObject cross, RowProj, ColProj, 100000, Angle_);
            cross.DispObj(window);
        }
    private void spoke(HObject hoImage, out HObject hoRegions, HTuple hvElements, HTuple hvDetectHeight,
                       HTuple hvDetectWidth, HTuple hvSigma, HTuple hvThreshold, HTuple hvTransition,
                       HTuple hvSelect, HTuple hvRoiRows, HTuple hvRoiCols, HTuple hvDirect,
                       out HTuple hvResultRow, out HTuple hvResultColumn, out HTuple hvArcType)
    {
        HDevProcedure     rakeProc = new HDevProcedure("spoke");
        HDevProcedureCall rakeProcCall;

        rakeProcCall = new HDevProcedureCall(rakeProc);
        rakeProcCall.SetInputIconicParamObject("Image", hoImage);
        rakeProcCall.SetInputCtrlParamTuple("Elements", hvElements);
        rakeProcCall.SetInputCtrlParamTuple("DetectHeight", hvDetectHeight);
        rakeProcCall.SetInputCtrlParamTuple("DetectWidth", hvDetectWidth);
        rakeProcCall.SetInputCtrlParamTuple("Sigma", hvSigma);
        rakeProcCall.SetInputCtrlParamTuple("Threshold", hvThreshold);
        rakeProcCall.SetInputCtrlParamTuple("Transition", hvTransition);
        rakeProcCall.SetInputCtrlParamTuple("Select", hvSelect);
        rakeProcCall.SetInputCtrlParamTuple("ROIRows", hvRoiRows);
        rakeProcCall.SetInputCtrlParamTuple("ROICols", hvRoiCols);
        rakeProcCall.SetInputCtrlParamTuple("Direct", hvDirect);
        rakeProcCall.Execute();
        // get output parameters from procedure call

        hoRegions      = rakeProcCall.GetOutputIconicParamRegion("Regions");
        hvResultRow    = rakeProcCall.GetOutputCtrlParamTuple("ResultRow");
        hvResultColumn = rakeProcCall.GetOutputCtrlParamTuple("ResultColumn");
        hvArcType      = rakeProcCall.GetOutputCtrlParamTuple("ArcType");

        rakeProcCall.Dispose();
        rakeProc.Dispose();
    }
Beispiel #6
0
        //---------------------//
        #region Create origin from region
        public static result create_origin(HObject Img, HObject Region_Binary, HObject Region_First, HObject Region_Second, HTuple HomMat2D_TransRegion)
        {
            result rs      = new result();
            HTuple RowProj = 0;
            HTuple ColProj = 0;
            HTuple Angle_  = 0;

            //Input
            HDevProcedure     getOrigin     = new HDevProcedure("create_origin_from_region");
            HDevProcedureCall getOriginCall = new HDevProcedureCall(getOrigin);

            getOriginCall.SetInputIconicParamObject("Image", Img);
            getOriginCall.SetInputIconicParamObject("Region_Binary", Region_Binary);
            getOriginCall.SetInputIconicParamObject("Region_First", Region_First);
            getOriginCall.SetInputIconicParamObject("Region_Second", Region_Second);
            getOriginCall.SetInputCtrlParamTuple("HomMat2D_TransRegion", HomMat2D_TransRegion);
            getOriginCall.SetInputCtrlParamTuple("showOrigin", "true");

            getOriginCall.Execute();

            //Output
            RowProj = getOriginCall.GetOutputCtrlParamTuple("RowProj");
            ColProj = getOriginCall.GetOutputCtrlParamTuple("ColProj");
            Angle_  = getOriginCall.GetOutputCtrlParamTuple("Angle");

            rs.RowProj = RowProj;
            rs.ColProj = ColProj;
            rs.Angle_  = Angle_;
            return(rs);
        }
Beispiel #7
0
        //---------------------//
        #region Calib Handeye 11 point
        public static result handeye11point(HTuple lst_row, HTuple lst_col, HTuple lst_the, HTuple lst_robot_x, HTuple lst_robot_y)
        {
            //HDevEngine _procderduce = new HDevEngine();
            //string path_Procerduce = Application.StartupPath + "/HalconProcerduce";
            //_procderduce.SetProcedurePath(path_Procerduce);
            result rs = new result();

            try
            {
                HTuple HomMat_ImgtoWorld = new HTuple();
                HTuple HomMat_WorldtoImg = new HTuple();
                /// Set procedure for handeye program
                HDevProcedure     procedure_handeye      = new HDevProcedure("handeye_stationary_camera");
                HDevProcedureCall procedure_handeye_call = new HDevProcedureCall(procedure_handeye);
                procedure_handeye_call.SetInputCtrlParamTuple("listRow_Img", lst_row);
                procedure_handeye_call.SetInputCtrlParamTuple("listCol_Img", lst_col);
                procedure_handeye_call.SetInputCtrlParamTuple("listAgl_Img", lst_the);
                procedure_handeye_call.SetInputCtrlParamTuple("listX_Robot", lst_robot_x);
                procedure_handeye_call.SetInputCtrlParamTuple("listY_Robot", lst_robot_y);
                procedure_handeye_call.Execute();
                /// Process procedure and read result from out data
                HomMat_ImgtoWorld    = procedure_handeye_call.GetOutputCtrlParamTuple("HomMat_ImgtoWorld");
                HomMat_WorldtoImg    = procedure_handeye_call.GetOutputCtrlParamTuple("HomMat_WorldtoImg");
                rs.TCP_to_Tool       = procedure_handeye_call.GetOutputCtrlParamTuple("TCP_to_Tool");
                rs.Tool_to_TCP       = procedure_handeye_call.GetOutputCtrlParamTuple("Tool_to_TCP");
                rs.Agl_Master        = procedure_handeye_call.GetOutputCtrlParamTuple("thetaGet");
                rs.HomMat_ImgtoWorld = HomMat_ImgtoWorld;
                rs.HomMat_WorldtoImg = HomMat_WorldtoImg;
            }
            catch (Exception ex)
            {
            }
            return(rs);
        }
        private void LoadBtn_Click(object sender, System.EventArgs e)
        {
            // load program and access procedure calls
            try
            {
                HDevProgram Program = new HDevProgram(ProgramPathString);

                HDevProcedure InitAcqProc          = new HDevProcedure(Program, "init_acquisition");
                HDevProcedure ProcessImageProc     = new HDevProcedure(Program, "detect_fin");
                HDevProcedure VisualizeDetailsProc =
                    new HDevProcedure(Program, "display_zoomed_region");

                InitAcqProcCall          = new HDevProcedureCall(InitAcqProc);
                ProcessImageProcCall     = new HDevProcedureCall(ProcessImageProc);
                VisualizeDetailsProcCall = new HDevProcedureCall(VisualizeDetailsProc);
            }
            catch (HDevEngineException Ex)
            {
                MessageBox.Show(Ex.Message, "HDevEngine Exception");
                return;
            }

            // enable InitAcq button and disable Load button
            InitAcqBtn.Enabled = true;
            LoadBtn.Enabled    = false;
        }
    private void pts_to_best_line(out HObject hoLine, HTuple hvBeginRow,
                                  HTuple hvBeginCol,
                                  int activeNum,
                                  out HTuple hvResultBeginRow,
                                  out HTuple hvResultBeginCol,
                                  out HTuple hvResultEndRow,
                                  out HTuple hvResultEndCol)
    {
        HDevProcedure     ptsProc = new HDevProcedure("pts_to_best_line");
        HDevProcedureCall ptsProcCall;

        ptsProcCall = new HDevProcedureCall(ptsProc);
        ptsProcCall.SetInputCtrlParamTuple("Rows", hvBeginRow);
        ptsProcCall.SetInputCtrlParamTuple("Cols", hvBeginCol);
        ptsProcCall.SetInputCtrlParamTuple("ActiveNum", activeNum);
        ptsProcCall.Execute();
        // get output parameters from procedure call

        hoLine           = ptsProcCall.GetOutputIconicParamObject("Line");
        hvResultBeginRow = ptsProcCall.GetOutputCtrlParamTuple("Row1");
        hvResultBeginCol = ptsProcCall.GetOutputCtrlParamTuple("Col1");
        hvResultEndRow   = ptsProcCall.GetOutputCtrlParamTuple("Row2");
        hvResultEndCol   = ptsProcCall.GetOutputCtrlParamTuple("Col2");

        ptsProcCall.Dispose();
        ptsProc.Dispose();
    }
Beispiel #10
0
 public halcon_me()
 {
     InitializeComponent();
     CounterTMT.AppEvents.Instance.UpdateScreenEvent += LogToScreen;
     GraphInteractiveObect = new GraphInteractive();
     Program   = new HDevProgram();
     Procedure = new HDevProcedure();
     MyEngine  = new HDevEngine();
     HOperatorSet.GenEmptyObj(out ho_Image);
     HOperatorSet.GenEmptyObj(out TempImage);
 }
Beispiel #11
0
        private void LoadHalconEnginee()
        {
            HOperatorSet.SetSystem("filename_encoding", "utf8");

            string CurrentPath = Directory.GetCurrentDirectory();

            MyEngine.SetProcedurePath(CurrentPath);

            string ProgramPathString = Directory.GetCurrentDirectory() + @"\ini\MeasureSize.hdev";
            string ProcedureCallName = "MeasureSizeLibrary";

            Program       = new HDevProgram(ProgramPathString);
            Procedure     = new HDevProcedure(Program, ProcedureCallName);
            ProcedureCall = new HDevProcedureCall(Procedure);
        }
Beispiel #12
0
        private void LoadBtn_Click(object sender, System.EventArgs e)
        {
            try
            {
                HDevProcedure Procedure = new HDevProcedure("detect_fin");
                ProcCall = new HDevProcedureCall(Procedure);
            }
            catch (HDevEngineException Ex)
            {
                MessageBox.Show(Ex.Message, "HDevEngine Exception");
                return;
            }

            // enable Execute button
            LoadBtn.Enabled    = false;
            ExecuteBtn.Enabled = true;
        }
Beispiel #13
0
        private void LoadBtn_Click(object sender, System.EventArgs e)
        {
            try
            {
                HDevProcedure Procedure = new HDevProcedure("Calibrate");
                ProcCall = new HDevProcedureCall(Procedure);

                HDevProcedure ProcChkLight = new HDevProcedure("checkLight");
                ProcChkLightCall = new HDevProcedureCall(ProcChkLight);
            }
            catch (HDevEngineException Ex)
            {
                MessageBox.Show(Ex.Message, "HDevEngine Exception");
                return;
            }


            // enable Execute button
            LoadBtn.Enabled  = false;
            StartBtn.Enabled = true;
        }
Beispiel #14
0
        public static HTuple HandEyeFinally(HTuple _CameraParam)
        {
            HTuple[] dataError = new HTuple[] { "Error", "Error" };
            try
            {
                HTuple data01 = new HTuple();
                HTuple data02 = new HTuple();

                HOperatorSet.WriteTuple(arrPointRobotX, Application.StartupPath + "/arrPoint/X_Robot.tup");
                HOperatorSet.WriteTuple(arrPointRobotY, Application.StartupPath + "/arrPoint/Y_Robot.tup");
                HOperatorSet.WriteTuple(arrPointRobotZ, Application.StartupPath + "/arrPoint/Z_Robot.tup");

                HOperatorSet.WriteTuple(arrPointVisionX, Application.StartupPath + "/arrPoint/X_Vision.tup");
                HOperatorSet.WriteTuple(arrPointVisionY, Application.StartupPath + "/arrPoint/Y_Vision.tup");

                HDevProcedure     _handeye     = new HDevProcedure("calibrate_hand_eye_scara_stationary_cam_approx2");
                HDevProcedureCall _handeyecall = new HDevProcedureCall(_handeye);
                _handeyecall.SetInputCtrlParamTuple("CameraParam", _CameraParam);
                _handeyecall.SetInputCtrlParamTuple("CalibrationPointsRow", arrPointVisionX);
                _handeyecall.SetInputCtrlParamTuple("CalibrationPointsColumn", arrPointVisionY);
                _handeyecall.SetInputCtrlParamTuple("CalibrationRobotX", arrPointRobotX);
                _handeyecall.SetInputCtrlParamTuple("CalibrationRobotY", arrPointRobotY);
                _handeyecall.SetInputCtrlParamTuple("CalibrationRobotZ", arrPointRobotZ);
                _handeyecall.Execute();
                data01 = _handeyecall.GetOutputCtrlParamTuple("CamInBasePose");
                data02 = _handeyecall.GetOutputCtrlParamTuple("CPInCamPose");
                HOperatorSet.WritePose(data01, Application.StartupPath + "/PoseAlign/CamInBasePose.dat");
                HOperatorSet.WritePose(data02, Application.StartupPath + "/PoseAlign/CPInCamPose.dat");

                //HOperatorSet.CalibrateHandEye(CalibDataID, out HTuple Errors);
                //HOperatorSet.GetCalibData(CalibDataID, "camera", 0, "base_in_cam_pose", out HTuple BaseInCamPose);
                //HOperatorSet.WritePose(BaseInCamPose, Application.StartupPath + "/hand_eye/" + "Cam_H_Tool.dat");
                return(1);
            }
            catch (Exception ex)
            {
                return(dataError);
            }
        }
Beispiel #15
0
        public static HTuple SendDataFromPLC(HTuple Data_Type, HTuple Data_Send, HTuple Dxxx, HTuple socket)
        {
            HTuple data = -1;

            try
            {
                HDevProcedure     setDataPlc     = new HDevProcedure("Melsoft_3E_Send");
                HDevProcedureCall setDataPlcCall = new HDevProcedureCall(setDataPlc);
                setDataPlcCall.SetInputCtrlParamTuple("Data_Type", Data_Type);
                setDataPlcCall.SetInputCtrlParamTuple("Data_Tuple", Data_Send);
                setDataPlcCall.SetInputCtrlParamTuple("Destination", Dxxx);
                setDataPlcCall.SetInputCtrlParamTuple("Socket", socket);
                setDataPlcCall.Execute();
                data = setDataPlcCall.GetOutputCtrlParamTuple("CCode");
            }
            catch (Exception ex)
            {
                data = "Error";
            }

            return(data);
        }
Beispiel #16
0
        public static HTuple  RecDataFromPLC(HTuple Data_Type, HTuple Dxxx, HTuple lenght, HTuple socket)
        {
            HTuple data = -1;

            try
            {
                HDevProcedure     getDataPlc     = new HDevProcedure("Melsoft_3E_Revc");
                HDevProcedureCall getDataPlcCall = new HDevProcedureCall(getDataPlc);
                //_getDataPLC.SetInputCtrlParamTuple(["String","Destination","Lenght","Socket"],)
                getDataPlcCall.SetInputCtrlParamTuple("Data_Type", Data_Type);
                getDataPlcCall.SetInputCtrlParamTuple("Destination", Dxxx);
                getDataPlcCall.SetInputCtrlParamTuple("Lenght", lenght);
                getDataPlcCall.SetInputCtrlParamTuple("Socket", socket);
                getDataPlcCall.Execute();
                data = getDataPlcCall.GetOutputCtrlParamTuple("Data_Tuple");
            }
            catch (Exception ex)
            {
                data = "Error";
            }
            return(data);
        }
    private void pts_to_best_circle(out HObject hoCircle, HTuple hvResultRow, HTuple hvResultColumn, int activeNum,
                                    string arcType, out HTuple hvCirCentreRow, out HTuple hvCirCentreColumn,
                                    out HTuple hvCirRadius)
    {
        HDevProcedure     ptsProc = new HDevProcedure("pts_to_best_circle");
        HDevProcedureCall ptsProcCall;

        ptsProcCall = new HDevProcedureCall(ptsProc);
        ptsProcCall.SetInputCtrlParamTuple("Rows", hvResultRow);
        ptsProcCall.SetInputCtrlParamTuple("Cols", hvResultColumn);
        ptsProcCall.SetInputCtrlParamTuple("ActiveNum", activeNum);
        ptsProcCall.SetInputCtrlParamTuple("ArcType", arcType);
        ptsProcCall.Execute();
        // get output parameters from procedure call

        hoCircle          = ptsProcCall.GetOutputIconicParamObject("Circle");
        hvCirCentreRow    = ptsProcCall.GetOutputCtrlParamTuple("RowCenter");
        hvCirCentreColumn = ptsProcCall.GetOutputCtrlParamTuple("ColCenter");
        hvCirRadius       = ptsProcCall.GetOutputCtrlParamTuple("Radius");

        ptsProcCall.Dispose();
        ptsProc.Dispose();
    }
Beispiel #18
0
        private void 主界面_Load(object sender, EventArgs e)
        {
            #region 加载hdvp文件
            try
            {
                m_HDevEngine.SetProcedurePath(m_sHDevEnginePath);
                m_CamProcedure     = new HDevProcedure("_829test");
                m_CamProcedureCall = m_CamProcedure.CreateCall();
            }
            catch (Exception df)
            {
                string s = "a";
                // Fun_Add_lb_Info("文件读取失败!" + df.Message);
            }
            #endregion

            #region 开启作业线程
            m_AutoRunThread = new Thread(Fun_AutoRun);
            m_AutoRunThread.IsBackground = true;
            m_AutoRunThread.Start();
            Console.WriteLine("自动作业线程已开启!" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:fff"));
            #endregion
        }
Beispiel #19
0
        private void Form1_Load(object sender, EventArgs e)
        {
            String path     = @".\hdev\ocr_mvtec_using_a_camera.hdev";
            String procPath = @".\procedure";

            engine.SetProcedurePath(procPath);
            program               = new HDevProgram(path);
            programCall           = new HDevProgramCall(program);
            ocr_NHP               = new HDevProcedure(program, "ocr_NHP");
            ocr_NHP_Call          = new HDevProcedureCall(ocr_NHP);
            charArray2String      = new HDevProcedure(program, "charArray2String");
            charArray2String_Call = new HDevProcedureCall(charArray2String);
            t = DateTime.Now;

            dgv = dataGridView1;
            mainWindowList[0] = hSmartWindowControl1.HalconWindow;
            mainWindowList[1] = hSmartWindowControl2.HalconWindow;
            //mainWindowList[2] = hSmartWindowControl3.HalconWindow;
            //mainWindowList[3] = hSmartWindowControl4.HalconWindow;
            //hSmartWindowControl5.Hide();
            //hSmartWindowControl6.Hide();
            sideWindowList[0] = hSmartWindowControl3.HalconWindow;
            sideWindowList[1] = hSmartWindowControl4.HalconWindow;
            //sideWindowList[2] = hSmartWindowControl7.HalconWindow;
            //sideWindowList[3] = hSmartWindowControl8.HalconWindow;
            //hSmartWindowControl7.Hide();
            //hSmartWindowControl8.Hide();

            initSetup();
            setCamera();
            updateSetting();

            dgv.AutoSize = false;
            this.dgv.Columns[0].AutoSizeMode         = DataGridViewAutoSizeColumnMode.DisplayedCells;
            this.dgv.AutoSizeColumnsMode             = DataGridViewAutoSizeColumnsMode.DisplayedCells;
            dgv.RowHeadersDefaultCellStyle.BackColor = Color.DarkSalmon;
        }
Beispiel #20
0
 public void Initial_PZT_Detection()
 {
     PTZ_Detection_Procedure     = new HDevProcedure("PZT_Detection");
     PTZ_Detection_ProcedureCall = PTZ_Detection_Procedure.CreateCall();
     bIsInitial = true;
 }
Beispiel #21
0
 public void Initial_Grab_Intervene()
 {
     Grab_Intervene_Procedure     = new HDevProcedure("Grab_Intervene");
     Grab_Intervene_ProcedureCall = Grab_Intervene_Procedure.CreateCall();
     bIsInitial = true;
 }
Beispiel #22
0
 public void Initial_LM_DP()
 {
     LM_DP_Procedure     = new HDevProcedure("LuoMuDianpianDetection");
     LM_DP_ProcedureCall = LM_DP_Procedure.CreateCall();
     bIsInitial          = true;
 }
Beispiel #23
0
 public void Initial_FangDai()
 {
     FangDai_Procedure     = new HDevProcedure("FD_Detection");
     FangDai_ProcedureCall = FangDai_Procedure.CreateCall();
     bIsInitial            = true;
 }
 public void Initial_LanQuan()
 {
     LanQuan_Procedure     = new HDevProcedure("LanQuan_Detection");
     LanQuan_ProcedureCall = LanQuan_Procedure.CreateCall();
     bIsInitial            = true;
 }
Beispiel #25
0
        private void SetForm_Load(object sender, EventArgs e)
        {
            #region 初始化ComboBox控件
            string PathLiaoHao = Global.m_sLiaoHaoPath;
            if (!Directory.Exists(PathLiaoHao))
            {
                Directory.CreateDirectory(PathLiaoHao);
            }

            comBox_TypeNow.Items.Clear();
            string[] str = null;
            using (FileStream fsRead = new FileStream(Global.m_sLiaoHaoPath + "\\LiaoHao.ini", FileMode.Open))
            {
                int    fsLen  = (int)fsRead.Length;
                byte[] heByte = new byte[fsLen];
                int    r      = fsRead.Read(heByte, 0, heByte.Length);
                string myStr  = System.Text.Encoding.UTF8.GetString(heByte);
                str = myStr.Split(',');
            }
            for (int i = 0; i < str.Length - 1; i++)
            {
                comBox_TypeNow.Items.Add(str[i]);
            }

            string S1 = "";
            S1 = IniAPI.INIGetStringValue(Global.m_sConfigPath + "\\System.ini", "SYSTEM", "常用料号", "");
            if (S1 != "")
            {
                comBox_TypeNow.Text = S1;
            }

            #endregion

            #region 读取曝光和增益的最大值

            int IntexposureMax = 0;
            int IntgainMax     = 0;

            string StrexposureMax = string.Empty;
            string StrgainMax     = string.Empty;

            StrexposureMax = IniAPI.INIGetStringValue(Global.m_sConfigPath + "\\System.ini", "SYSTEM", "ExposureMax", "10000");
            StrgainMax     = IniAPI.INIGetStringValue(Global.m_sConfigPath + "\\System.ini", "SYSTEM", "GainMax", "15");

            bool b1 = int.TryParse(StrexposureMax, out IntexposureMax);
            if (b1 != true)
            {
                IntexposureMax = 10000;
            }
            numUD_Exposure.Maximum = IntexposureMax;
            bool b2 = int.TryParse(StrgainMax, out IntgainMax);
            if (b2 != true)
            {
                IntgainMax = 15;
            }
            numUD_Gain.Maximum = IntgainMax;

            IniAPI.INIWriteValue(Global.m_sConfigPath + "\\System.ini", "SYSTEM", "ExposureMax", StrexposureMax);
            IniAPI.INIWriteValue(Global.m_sConfigPath + "\\System.ini", "SYSTEM", "GainMax", StrgainMax);

            #endregion

            #region 加载hdvp文件
            try
            {
                m_HDevEngine.SetProcedurePath(m_sHDevEnginePath);
                m_CamProcedure     = new HDevProcedure("_829test");
                m_CamProcedureCall = m_CamProcedure.CreateCall();
            }
            catch (Exception df)
            {
                string s = "a";
                // Fun_Add_lb_Info("文件读取失败!" + df.Message);
            }
            #endregion
        }