Beispiel #1
0
 public ReadCode()
 {
     InitializeComponent();
     m_image = new HObject();
     DelegateUIControl.GetInstance().FormSetHDisplay = this.hDisplay1;
     //
 }
Beispiel #2
0
        //public HObject InputImage
        //{
        //    get { return m_image; }
        //    set { m_image = value; }
        //}
        private void btn_Decode_Click(object sender, EventArgs e)
        {
            List <HObject> region       = new List <HObject>();
            List <HObject> imageReduced = new List <HObject>();

            region = hDisplay1.GetSearchRegions();
            Time_Meter time_Meter = new Time_Meter();

            foreach (var member in region)
            {
                HObject _iamge = new HObject();
                HOperatorSet.ReduceDomain(m_image, member, out _iamge);
                HOperatorSet.CropDomain(_iamge, out _iamge);
                imageReduced.Add(_iamge);
            }

            TDCode     tdcode;
            CodeResult sss = new CodeResult();

            CodeResult[] results = new CodeResult[] { };
            if (_form is FormDMCodeParam)
            {
                FormDMCodeParam form = (FormDMCodeParam)_form;
                tdcode = new DMCode();

                tdcode.SetCodeParam(form.CodeParameter);

                results          = tdcode.Decode(imageReduced);
                txt_TimeUse.Text = (time_Meter.TimePass() * 1000).ToString();
            }
            else if (_form is FormQRCodeParam)
            {
                FormQRCodeParam form = (FormQRCodeParam)_form;

                tdcode = new QRCode();
                tdcode.SetCodeParam(form.CodeParameter);
                results = tdcode.Decode(imageReduced);
            }

            List <StringX>           ss      = new List <StringX>();
            List <HalWindow.RegionX> regions = new List <HalWindow.RegionX>();

            foreach (var member in results)
            {
                if (member.code != string.Empty)
                {
                    HTuple area   = new HTuple();
                    HTuple row    = new HTuple();
                    HTuple column = new HTuple();
                    HOperatorSet.AreaCenter(member.codexld, out area, out row, out column);
                    StringX sx = new StringX(15, false, false);
                    sx.SetString(member.code, (int)row.D, (int)column.D, System.Drawing.Color.Green);
                    ss.Add(sx);
                    HalWindow.RegionX regionX = new HalWindow.RegionX(member.codexld, "green");
                    regions.Add(regionX);
                }
            }
            DelegateUIControl.GetInstance().UpdateHDisplay("FormSetHDisplay", m_image, regions, ss);
        }
Beispiel #3
0
        private void btn_loadImage_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Filter = "|*.bmp;*.jpeg;";
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                string path = ofd.FileName;
                HOperatorSet.ReadImage(out m_image, path);
                DelegateUIControl.GetInstance().UpdateHDisplay("FormSetHDisplay", m_image, null, null);
            }
        }
Beispiel #4
0
 public static DelegateUIControl GetInstance()
 {
     if (m_Instance == null)
     {
         lock (m_lock)
         {
             if (m_Instance == null)
             {
                 m_Instance = new DelegateUIControl();
             }
         }
     }
     return(m_Instance);
 }