Exemplo n.º 1
0
        private void ReadLabelsButton_Click(object sender, EventArgs e)
        {
            if (pictureBox1.Tag == null)
            {
                return;
            }

            Console.WriteLine("reading");
            try
            {
                labelRecognition.ResetRuntimeSettings();
                String templateName = LoadDLRTemplate();
                if (templateName == "")
                {
                    DLR_RuntimeSettings rs = labelRecognition.GetRuntimeSettings();
                    rs.RegionPredetectionModes.Append(EnumDLRRegionPredetectionMode.DLR_RPM_GENERAL_GRAY_CONTRAST);
                    //rs.RegionPredetectionModes.Append(EnumDLRRegionPredetectionMode.DLR_RPM_GENERAL_RGB_CONTRAST);

                    rs.LinesCount         = 100;
                    rs.CharacterModelName = comboBox1.SelectedItem.ToString();
                    labelRecognition.UpdateRuntimeSettings(rs);
                }

                DLR_Result[] results = labelRecognition.RecognizeByFile(pictureBox1.Tag.ToString(), templateName);
                OutputDLRResult(results);
            }
            catch (DLR_Exception exp)
            {
                Console.WriteLine(exp);
            }
            catch (Exception exp)
            {
                Console.WriteLine(exp);
            }
        }
Exemplo n.º 2
0
        private void ReadLabelsWithDBRButton_Click(object sender, EventArgs e)
        {
            if (pictureBox1.Tag == null)
            {
                return;
            }
            if (textBox1.Tag == null)
            {
                MessageBox.Show("Please read barcodes first.");

                return;
            }
            TextResult[] dbr_result   = (TextResult[])textBox1.Tag;
            String       templateName = LoadDLRTemplate();

            if (templateName == "")
            {
                DLR_RuntimeSettings rs = labelRecognition.GetRuntimeSettings();
                rs.ReferenceRegion.LocalizationSourceType = EnumDLRLocalizationSourceType.DLR_LST_BARCODE;
                Console.WriteLine(rs.ReferenceRegion.Points.ToString());
                rs.LinesCount         = 100;
                rs.CharacterModelName = comboBox1.SelectedItem.ToString();
                labelRecognition.UpdateRuntimeSettings(rs);
            }

            labelRecognition.UpdateReferenceRegionFromBarcodeResults(dbr_result, templateName);
            DLR_Result[] results = labelRecognition.RecognizeByFile(pictureBox1.Tag.ToString(), templateName);

            //labelRecognition.OutputSettingsToFile("D:\\out.json", "");
            OutputDLRResult(results);
        }
Exemplo n.º 3
0
        private void ReadLabelsButton_Click(object sender, EventArgs e)
        {
            if (pictureBox1.Tag == null)
            {
                return;
            }

            Console.WriteLine("reading");
            try
            {
                labelRecognition.ResetRuntimeSettings();
                String templateName = LoadDLRTemplate();
                if (templateName == "")
                {
                    DLR_RuntimeSettings rs = labelRecognition.GetRuntimeSettings();
                    //rs.ReferenceRegion.LocalizationSourceType = EnumDLRLocalizationSourceType.DLR_LST_PREDETECTED_REGION;
                    //rs.RegionPredetectionModes.Append(EnumDLRRegionPredetectionMode.DLR_RPM_GENERAL_GRAY_CONTRAST);
                    rs.RegionPredetectionModes.Append(EnumDLRRegionPredetectionMode.DLR_RPM_GENERAL_RGB_CONTRAST);
                    //int index = rs.RegionPredetectionModes.Length;
                    //Console.WriteLine("modes length");
                    //Console.WriteLine(rs.RegionPredetectionModes.Length);
                    //Console.WriteLine(rs.RegionPredetectionModes.GetValue(0));
                    //rs.RegionPredetectionModes.Prepend(EnumDLRRegionPredetectionMode.DLR_RPM_GENERAL_HSV_CONTRAST);
                    //Console.WriteLine(rs.RegionPredetectionModes.Length);
                    //Console.WriteLine(rs.RegionPredetectionModes.GetValue(0));
                    rs.LinesCount         = 100;
                    rs.CharacterModelName = comboBox1.SelectedItem.ToString();
                    labelRecognition.UpdateRuntimeSettings(rs);
                    //labelRecognition.SetModeArgument("RegionPredetectionModes", index, "ForeAndBackgroundColours", "[43,60,5]");
                }

                DLR_Result[] results = labelRecognition.RecognizeByFile(pictureBox1.Tag.ToString(), templateName);
                OutputDLRResult(results);
            }
            catch (DLR_Exception exp)
            {
                Console.WriteLine(exp);
            }
            catch (Exception exp)
            {
                Console.WriteLine(exp);
            }
        }