예제 #1
0
 /// <summary>
 /// 初始化参数
 /// </summary>
 /// <param name="iOCRText"></param>
 /// <param name="control"></param>
 /// <param name="halconWinControl_"></param>
 public void Set_showParameterHalconWinControl(IOCRTextShuJu iOCRText, Control.ControlCollection control, HalControl.HalconWinControl_ROI halconWinControl_)
 {
     if (halconWinControl_ != null)
     {
         halconWinControl_.DrawRectangle2(iOCRText.IOutSide.Mid_col_x, iOCRText.IOutSide.Mid_row_y, iOCRText.IOutSide.Phi, iOCRText.IOutSide.Len1, iOCRText.IOutSide.Len2, iOCRText.IOutSide);
     }
     Set_ShowOCVParameter(iOCRText, control);
 }
예제 #2
0
        /// <summary>
        /// 刷新定位点
        /// </summary>
        /// <param name="IOCR"></param>
        /// <returns></returns>
        public bool Set_ShuaXinDingWeiDian(IOCRTextShuJu iOCRText)
        {
            bool ok = false;

            if (iOCRText.IrectShuJuPianYi != null)
            {
                iOCRText.GeuSuiDian_X_Col = iOCRText.IrectShuJuPianYi.Column;
                iOCRText.GenSuiDian_Y_Row = iOCRText.IrectShuJuPianYi.Row;
                iOCRText.GenSuiDian_A     = iOCRText.IrectShuJuPianYi.Angle;
            }
            ok = true;
            return(ok);
        }
예제 #3
0
        /// <summary>
        /// 更换字库
        /// </summary>
        /// <param name="iOCRText"></param>
        /// <param name="name"></param>
        /// <returns></returns>
        public bool Set_GengHuanZiKu(IOCRTextShuJu iOCRText, string name)
        {
            bool ok = false;

            iOCRText.Hv_FileName = name;
            string path = AppDomain.CurrentDomain.BaseDirectory + @"Ocr\" + iOCRText.Hv_FileName + ".omc";
            HTuple OCRHandle;

            //HOperatorSet.ClearOcrClassMlp(iOCRText.TextMode);
            HOperatorSet.ClearTextModel(iOCRText.TextMode);
            HOperatorSet.CreateTextModelReader(iOCRText.Mode, iOCRText.Hv_FileName, out OCRHandle);
            //HOperatorSet.ReadOcrClassMlp(path, out OCRHandle);
            iOCRText.TextMode = OCRHandle;

            ok = true;
            return(ok);
        }
예제 #4
0
        /// <summary>
        /// 显示参数
        /// </summary>
        /// <param name="iOCRText"></param>
        /// <param name="control"></param>
        /// <returns></returns>
        bool Set_ShowOCVParameter(IOCRTextShuJu iOCRText, Control.ControlCollection control)
        {
            bool ok = false;

            foreach (Control con in control)
            {
                string name = con.Name;
                if ((con is ComboBox) || (con is TextBox) || (con is RichTextBox) || (con is Label))
                {
                    switch (name)
                    {
                        #region  加载字库
                    case "Hv_FileName":
                        List <string> str_name;
                        find_all_omc(out str_name);
                        ComboBox com = con as ComboBox;
                        if (com != null)
                        {
                            foreach (string filename in str_name)
                            {
                                com.Items.Add(filename.Replace(".omc", ""));
                            }
                        }
                        con.Text = iOCRText.Hv_FileName;
                        break;
                        #endregion

                        #region  默认
                    default:
                        break;
                        #endregion
                    }
                }
                if (con.Controls.Count > 0)
                {
                    Set_ShowOCVParameter(iOCRText, con.Controls);
                }
            }
            ok = true;
            return(ok);
        }
예제 #5
0
        private void OCRTextFrm_Load(object sender, EventArgs e)
        {
            halconWinControl_ROI1.init();
            halconWinControl_ROI1.Repaint += repaint;
            _read += read_one_image;
            _run  += run;


#if DEBUG == true
            if (TreeStatic.Mult_Tree_Node.Obj == null)
            {
                _iOCRText = new OCRTextShuJu();
            }
            else
            {
                _iOCRText = (OCRTextShuJu)TreeStatic.Mult_Tree_Node.Obj;;
            }
#else
            _IOCR = new OCRHalcon.OCRShuJu.OCRShuJu();
#endif
            this._Set_OCRText.Set_showParameterHalconWinControl(this._iOCRText, this.Controls, this.halconWinControl_ROI1);
            Hv_FileName.SelectedValueChanged += chice_ocr_omc;
        }