当前位置: 首页>>代码示例>>C#>>正文


C# TesseractEngine.SetVariable方法代码示例

本文整理汇总了C#中TesseractEngine.SetVariable方法的典型用法代码示例。如果您正苦于以下问题:C# TesseractEngine.SetVariable方法的具体用法?C# TesseractEngine.SetVariable怎么用?C# TesseractEngine.SetVariable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TesseractEngine的用法示例。


在下文中一共展示了TesseractEngine.SetVariable方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CanSetDoubleVariable

 public void CanSetDoubleVariable(string variableName, double variableValue)
 {
     using (var engine = new TesseractEngine(@"./tessdata", "eng", EngineMode.Default)) {
         var variableWasSet = engine.SetVariable(variableName, variableValue);
         Assert.That(variableWasSet, Is.True, "Failed to set variable '{0}'.", variableName);
         double result;
         if(engine.TryGetDoubleVariable(variableName, out result)) {
             Assert.That(result, Is.EqualTo(variableValue));
         } else {
             Assert.Fail("Failed to retrieve value for '{0}'.", variableName);
         }
     }
 }
开发者ID:huanghws2013,项目名称:tesseract,代码行数:13,代码来源:EngineTests.cs

示例2: SetVariablesAccordingToConfig

        private static void SetVariablesAccordingToConfig(TesseractEngine engine, ZoneConfiguration barcodeConfig)
        {
            if (barcodeConfig.TextualDataFilter.FilterType == FilterType.Alpha)
            {
                engine.SetVariable("tessedit_char_whitelist", "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-");
            }

            if (barcodeConfig.TextualDataFilter.FilterType == FilterType.AlphaOnly)
            {
                engine.SetVariable("tessedit_char_whitelist", "ABCDEFGHIJKLMNOPQRSTUVWXYZ-");
            }

            if (barcodeConfig.TextualDataFilter.FilterType == FilterType.Digits)
            {
                engine.SetVariable("tessedit_char_whitelist", "0123456789");
            }

            if (barcodeConfig.TextualDataFilter.FilterType == FilterType.Number)
            {
                engine.SetVariable("tessedit_char_whitelist", "0123456789,.");
            }
        }
开发者ID:SuperJMN,项目名称:Glass,代码行数:22,代码来源:TesseractOcrOcrService.cs

示例3: CanSetBooleanVariable

 public void CanSetBooleanVariable(bool variableValue)
 {
     const string VariableName = "classify_enable_learning";
     using (var engine = new TesseractEngine(@"./tessdata", "eng", EngineMode.Default)) {
         var variableWasSet = engine.SetVariable(VariableName, variableValue);
         Assert.That(variableWasSet, Is.True, "Failed to set variable '{0}'.", VariableName);
         bool result;
         if(engine.TryGetBoolVariable(VariableName, out result)) {
             Assert.That(result, Is.EqualTo(variableValue));
         } else {
             Assert.Fail("Failed to retrieve value for '{0}'.", VariableName);
         }
     }
 }
开发者ID:huanghws2013,项目名称:tesseract,代码行数:14,代码来源:EngineTests.cs

示例4: WritesOutThresholdedImageWhenOCRing

        public void WritesOutThresholdedImageWhenOCRing()
        {
            var expectedFilePath = Path.Combine(Environment.CurrentDirectory, "tessinput.tif");

            if (File.Exists(expectedFilePath)) {
                File.Delete(expectedFilePath);
            }

            using (var engine = new TesseractEngine(@"./tessdata", "eng", EngineMode.Default)) {
                engine.SetVariable("tessedit_write_images", true);

                using (var img = Pix.LoadFromFile("./phototest.tif")) {
                    using (var page = engine.Process(img)) {
                        var region1Text = page.GetText();

                        Assert.That(File.Exists(expectedFilePath));
                    }
                }
            }
        }
开发者ID:odflash,项目名称:tesseract,代码行数:20,代码来源:EngineTests.cs

示例5: CanSetClassifyBlnNumericModeVariable

        public void CanSetClassifyBlnNumericModeVariable()
        {
            using (var engine = new TesseractEngine(@"./tessdata", "eng", EngineMode.Default)) {
                engine.SetVariable("classify_bln_numeric_mode", 1);

                using (var img = Pix.LoadFromFile("./Data/processing/numbers.png")) {
                    using (var page = engine.Process(img)) {
                        var text = page.GetText();

                        const string expectedText = "1234567890\n\n";

                        Assert.That(text, Is.EqualTo(expectedText));
                    }
                }
            }
        }
开发者ID:odflash,项目名称:tesseract,代码行数:16,代码来源:EngineTests.cs


注:本文中的TesseractEngine.SetVariable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。