private void btnSearchQR_Click(object sender, EventArgs e) { QRConfig qRConfig = new QRConfig(); RectangleContour rectROI1 = (RectangleContour)imageViewerQR.Roi.GetContour(0).Shape; userProgram.QRConfigs[0].Rectangle.Left = rectROI1.Left; userProgram.QRConfigs[0].Rectangle.Top = rectROI1.Top; userProgram.QRConfigs[0].Rectangle.Width = rectROI1.Width; userProgram.QRConfigs[0].Rectangle.Height = rectROI1.Height; qRConfig.Rectangle.Left = rectROI1.Left; qRConfig.Rectangle.Top = rectROI1.Top; qRConfig.Rectangle.Width = rectROI1.Width; qRConfig.Rectangle.Height = rectROI1.Height; qRConfig.Index = 0; qRConfig.Name = string.Format("QRConfig0"); qRConfig.QRDimension = DetectQRDimension(cboDimensionQR.Text); qRConfig.Polarity = DetectQRPolarity(cboPolarityQR.Text); qRConfig.CellSize = DetectQRCellSampleSize(cboCellSizeQR.Text); userProgram.QRConfigs.Add(qRConfig); txtResultQR.Text = processPicture.ProcessQR(imageViewerQR.Image, userProgram.QRConfigs); }
private void btnSearch5_Click(object sender, EventArgs e) { if (txbProgramName.Text != "" & cbxQRSize.Text != "" & cbxQRPolarity.Text != "" & cbxQRCell.Text != "") { QRConfig qRConfig = new QRConfig(); try { RectangleContour rectROI1 = (RectangleContour)imageViewer5.Roi.GetContour(0).Shape; userProgram.QRConfigs[0].Rectangle.Left = rectROI1.Left; userProgram.QRConfigs[0].Rectangle.Top = rectROI1.Top; userProgram.QRConfigs[0].Rectangle.Width = rectROI1.Width; userProgram.QRConfigs[0].Rectangle.Height = rectROI1.Height; qRConfig.Rectangle.Left = rectROI1.Left; qRConfig.Rectangle.Top = rectROI1.Top; qRConfig.Rectangle.Width = rectROI1.Width; qRConfig.Rectangle.Height = rectROI1.Height; qRConfig.Index = 0; qRConfig.Name = string.Format("QRConfig0"); qRConfig.QRDimension = QRDimension.AutoDetect; if (cbxQRSize.Text == "11*11") { qRConfig.QRDimension = QRDimension.Size11x11; } else if (cbxQRSize.Text == "21*21") { qRConfig.QRDimension = QRDimension.Size21x21; } else if (cbxQRSize.Text == "25*25") { qRConfig.QRDimension = QRDimension.Size25x25; } qRConfig.Polarity = QRPolarity.AutoDetect; if (cbxQRPolarity.Text == "Black on White") { qRConfig.Polarity = QRPolarity.BlackOnWhite; } else if (cbxQRPolarity.Text == "White on Black") { qRConfig.Polarity = QRPolarity.WhiteOnBlack; } qRConfig.CellSize = QRCellSampleSize.AutoDetect; if (cbxCellSample.Text == "3*3") { qRConfig.CellSize = QRCellSampleSize.Size3x3; } userProgram.QRConfigs.Add(qRConfig); tbxQR.Text = processPicture.ProcessQR(imageViewer5.Image, userProgram.QRConfigs); } catch (Exception ex) { MessageBox.Show(ex.Message + "Please select a ROI which contains the QR code! "); } } else { MessageBox.Show("Please confirm the information Barcode format and Barcode number!"); } }