public CodeResult[] Decode(List <HObject> regions) { List <HObject> imageReduced = new List <HObject>(); foreach (var member in regions) { HObject _iamge = new HObject(); HOperatorSet.ReduceDomain(m_image, member, 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); } else if (_form is FormQRCodeParam) { FormQRCodeParam form = (FormQRCodeParam)_form; tdcode = new QRCode(); tdcode.SetCodeParam(form.CodeParameter); results = tdcode.Decode(imageReduced); } return(results); }
//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); }