Como usar o Iron Tesseract em C
O Iron Tesseract em C# é usado criando uma instância IronTesseract, configurando-a com configuração de linguagem e OCR, em seguida, chamando o método Read() em um objeto OcrInput contendo suas imagens ou PDFs. Isso converte imagens de texto em PDFs pesquisáveis usando o motor otimizado da Tesseract 5.
O IronOCR fornece uma API intuitiva para utilizar o Tesseract 5 personalizado e otimizado, conhecido como Iron Tesseract. Usando o IronOCR e IronTesseract, você será capaz de converter imagens de texto e documentos digitalizados em texto e PDFs pesquisáveis. A biblioteca oferece suporte a 125 idiomas internacionais e inclui recursos avançados como leitura de código de barras e visão computacional .
Início rápido: Configurar o IronTesseract em C#
Este exemplo demonstra como configurar IronTesseract com configurações específicas e executar OCR em uma única linha de código.
-
Instale IronOCR com o Gerenciador de Pacotes NuGet
-
Copie e execute este trecho de código.
var result = new IronOcr.IronTesseract { Language = IronOcr.OcrLanguage.English, Configuration = new IronOcr.TesseractConfiguration { ReadBarCodes = false, RenderSearchablePdf = true, WhiteListCharacters = "ABCabc123" } }.Read(new IronOcr.OcrInput("image.png")); -
Implante para testar em seu ambiente de produção.
Comece a usar IronOCR em seu projeto hoje com uma avaliação gratuita
Fluxo de trabalho básico de OCR
- Instale a biblioteca OCR com o NuGet para ler imagens.
- Utilize `Tesseract 5` personalizado para realizar OCR.
- Carregue os documentos desejados, como imagens ou arquivos PDF, para processamento.
- Exiba o texto extraído no console ou em um arquivo.
- Salve o resultado como um PDF pesquisável.
Como faço para criar uma instância do IronTesseract?
Inicialize um objeto Tesseract com este código:
:path=/static-assets/ocr/content-code-examples/how-to/irontesseract-initialize-irontesseract.cs
using IronOcr;
IronTesseract ocr = new IronTesseract();
Imports IronOcr
Dim ocr As New IronTesseract()
Você pode personalizar o comportamento de IronTesseract selecionando diferentes idiomas, habilitando leitura de código de barras e listando/branqueando caracteres. O IronOCR oferece opções de configuração abrangentes para ajustar seu processo de OCR:
:path=/static-assets/ocr/content-code-examples/how-to/irontesseract-configure-irontesseract.cs
IronTesseract ocr = new IronTesseract
{
Configuration = new TesseractConfiguration
{
ReadBarCodes = false,
RenderHocr = true,
TesseractVariables = null,
WhiteListCharacters = null,
BlackListCharacters = "`ë|^",
},
MultiThreaded = false,
Language = OcrLanguage.English,
EnableTesseractConsoleMessages = true, // False as default
};
Dim ocr As New IronTesseract With {
.Configuration = New TesseractConfiguration With {
.ReadBarCodes = False,
.RenderHocr = True,
.TesseractVariables = Nothing,
.WhiteListCharacters = Nothing,
.BlackListCharacters = "`ë|^"
},
.MultiThreaded = False,
.Language = OcrLanguage.English,
.EnableTesseractConsoleMessages = True
}
Uma vez configurado, você pode usar a funcionalidade Tesseract para ler objetos OcrInput. A classe OcrInput fornece métodos flexíveis para carregar diversos formatos de entrada:
:path=/static-assets/ocr/content-code-examples/how-to/irontesseract-read.cs
IronTesseract ocr = new IronTesseract();
using OcrInput input = new OcrInput();
input.LoadImage("attachment.png");
OcrResult result = ocr.Read(input);
string text = result.Text;
Dim ocr As New IronTesseract()
Using input As New OcrInput()
input.LoadImage("attachment.png")
Dim result As OcrResult = ocr.Read(input)
Dim text As String = result.Text
End Using
Para cenários complexos, você pode aproveitar os recursos de multithreading para processar vários documentos simultaneamente, melhorando significativamente o desempenho das operações em lote.
Quais são as variáveis de configuração avançadas do Tesseract?
A interface IronOcr Tesseract permite o controle total das variáveis de configuração do Tesseract através da classe IronOcr.TesseractConfiguration . Essas configurações avançadas permitem otimizar o desempenho do OCR para casos de uso específicos, como corrigir digitalizações de baixa qualidade ou ler tipos específicos de documentos .
Como faço para usar a configuração do Tesseract no código?
:path=/static-assets/ocr/content-code-examples/how-to/irontesseract-tesseract-configuration.cs
using IronOcr;
using System;
IronTesseract Ocr = new IronTesseract();
Ocr.Language = OcrLanguage.English;
Ocr.Configuration.PageSegmentationMode = TesseractPageSegmentationMode.AutoOsd;
// Configure Tesseract Engine
Ocr.Configuration.TesseractVariables["tessedit_parallelize"] = false;
using var input = new OcrInput();
input.LoadImage("/path/file.png");
OcrResult Result = Ocr.Read(input);
Console.WriteLine(Result.Text);
Imports IronOcr
Imports System
Private Ocr As New IronTesseract()
Ocr.Language = OcrLanguage.English
Ocr.Configuration.PageSegmentationMode = TesseractPageSegmentationMode.AutoOsd
' Configure Tesseract Engine
Ocr.Configuration.TesseractVariables("tessedit_parallelize") = False
Dim input = New OcrInput()
input.LoadImage("/path/file.png")
Dim Result As OcrResult = Ocr.Read(input)
Console.WriteLine(Result.Text)
O IronOCR também oferece configurações especializadas para diferentes tipos de documentos. Por exemplo, ao ler passaportes ou processar cheques MICR , você pode aplicar filtros de pré-processamento específicos e detecção de região para melhorar a precisão.
Exemplo de configuração para documentos financeiros:
:path=/static-assets/ocr/content-code-examples/how-to/iron-tesseract-6.cs
// Example: Configure for financial documents
IronTesseract ocr = new IronTesseract
{
Language = OcrLanguage.English,
Configuration = new TesseractConfiguration
{
PageSegmentationMode = TesseractPageSegmentationMode.SingleBlock,
TesseractVariables = new Dictionary<string, object>
{
["tessedit_char_whitelist"] = "0123456789.$,",
["textord_heavy_nr"] = false,
["edges_max_children_per_outline"] = 10
}
}
};
// Apply preprocessing filters for better accuracy
using OcrInput input = new OcrInput();
input.LoadPdf("financial-document.pdf");
input.Deskew();
input.EnhanceResolution(300);
OcrResult result = ocr.Read(input);
Imports IronOcr
' Example: Configure for financial documents
Dim ocr As New IronTesseract With {
.Language = OcrLanguage.English,
.Configuration = New TesseractConfiguration With {
.PageSegmentationMode = TesseractPageSegmentationMode.SingleBlock,
.TesseractVariables = New Dictionary(Of String, Object) From {
{"tessedit_char_whitelist", "0123456789.$,"},
{"textord_heavy_nr", False},
{"edges_max_children_per_outline", 10}
}
}
}
' Apply preprocessing filters for better accuracy
Using input As New OcrInput()
input.LoadPdf("financial-document.pdf")
input.Deskew()
input.EnhanceResolution(300)
Dim result As OcrResult = ocr.Read(input)
End Using
Qual é a lista completa de todas as variáveis de configuração do Tesseract?
Estas podem ser configuradas usando IronTesseract.Configuration.TesseractVariables["key"] = value;. As variáveis de configuração permitem ajustar o comportamento do OCR para obter resultados ideais com seus documentos específicos. Para obter orientações detalhadas sobre como otimizar o desempenho do OCR, consulte nosso guia de configuração rápida de OCR .
| Variável de configuração do Tesseract | Default | Significado |
|---|---|---|
| classificar_num_níveis_cp | 3 | Número de níveis do podador de classe |
| textord_debug_tabfind | 0 | Encontrando a guia Depurar |
| textord_debug_bugs | 0 | Ative a saída relacionada a erros na localização de guias. |
| textord_testregion_esquerda | -1 | Borda esquerda do retângulo de relatório de depuração |
| textord_testregion_top | -1 | Borda superior do retângulo de relatório de depuração |
| textord_testregion_right | 2147483647 | Borda direita do retângulo de depuração |
| textord_testregion_bottom | 2147483647 | Borda inferior do retângulo de depuração |
| textord_tabfind_mostrar_partições | 0 | Exibir limites da partição, aguardando se >1 |
| devanagari_split_debuglevel | 0 | Nível de depuração para o processo shiro-rekha dividido. |
| bordas_máximo_filhos_por_contorno | 10 | Número máximo de crianças dentro do contorno de um personagem. |
| camadas_filhas_máximas_de_bordas | 5 | Número máximo de camadas de filhos aninhados dentro do contorno de um personagem. |
| bordas_filhos_por_neto | 10 | Proporção de importância para contornos de recorte |
| limite_de_contagem_de_filhos_das_bordas | 45 | Número máximo de buracos permitidos na bolha |
| bordas_mín_sem_buraco | 12 | Número mínimo de pixels para possível caractere na caixa |
| proporção_área_do_caminho_das_bordas | 40 | Max lensq/area for acceptable child outline |
| textord_fp_chop_error | 2 | Max permitiu a flexão das células picadas |
| textord_tabfind_mostrar_imagens | 0 | Show image blobs |
| textord_skewsmooth_offset | 4 | Para fator suave |
| textord_skewsmooth_offset2 | 1 | Para fator suave |
| textord_test_x | -2147483647 | coordenadas do ponto de teste |
| textord_test_y | -2147483647 | coordenadas do ponto de teste |
| textord_min_blobs_in_row | 4 | Número mínimo de blobs antes da contagem do gradiente |
| textord_spline_minblobs | 8 | Min blobs in each spline segment |
| textord_spline_medianwin | 6 | Size of window for spline segmentation |
| textord_max_blob_overlaps | 4 | Max number of blobs a big blob can overlap |
| textord_min_xheight | 10 | Min credible pixel xheight |
| textord_lms_line_trials | 12 | Number of linew fits to do |
| oldbl_holed_losscount | 10 | Max lost before fallback line used |
| versão_linear_pitsync | 6 | Use new fast algorithm |
| pitsync_profundidade_falsa | 1 | Max advance fake generation |
| textord_tabfind_show_strokewidths | 0 | Show stroke widths |
| textord_dotmatrix_gap | 3 | Max pixel gap for broken pixed pitch |
| bloco de depuração textord | 0 | Block to do debug on |
| textord_pitch_range | 2 | Max range test on pitch |
| textord_words_veto_power | 5 | Rows required to outvote a veto |
| equationdetect_save_bi_image | 0 | Save input bi image |
| equationdetect_save_spt_image | 0 | Save special character image |
| equationdetect_save_semente_imagem | 0 | Save the seed image |
| equationdetect_save_merged_image | 0 | Save the merged image |
| poly_debug | 0 | Debug old poly |
| poly_wide_objects_better | 1 | More accurate approx on wide things |
| wordrec_display_splits | 0 | Display splits |
| textord_debug_printable | 0 | Make debug windows printable |
| tamanho_do_espaço_textord_é_variável | 0 | If true, word delimiter spaces are assumed to have variable width, even though characters have fixed pitch. |
| textord_tabfind_show_initial_partitions | 0 | Show partition bounds |
| textord_tabfind_show_reject_blobs | 0 | Show blobs rejected as noise |
| textord_tabfind_show_columns | 0 | Show column bounds |
| textord_tabfind_show_blocks | 0 | Show final block bounds |
| textord_tabfind_find_tables | 1 | run table detection |
| devanagari_split_debugimage | 0 | Whether to create a debug image for split shiro-rekha process. |
| textord_mostrar_cortes_fixos | 0 | Draw fixed pitch cell boundaries |
| edges_use_new_outline_complexity | 0 | Use the new outline complexity module |
| bordas_depuração | 0 | turn on debugging for this module |
| correção de bordas_filhos | 0 | Remove boxy parents of char-like children |
| gapmap_debug | 0 | Say which blocks have tables |
| gapmap_use_ends | 0 | Use large space at start and end of rows |
| gapmap_sem_quanta_isolada | 0 | Ensure gaps not less than 2quanta wide |
| textord_pesado_nr | 0 | Vigorously remove noise |
| textord_mostrar_linhas_iniciais | 0 | Display row accumulation |
| textord_mostrar_linhas_paralelas | 0 | Display page correlated rows |
| textord_mostrar_linhas_expandidas | 0 | Display rows after expanding |
| textord_mostrar_linhas_finais | 0 | Display rows after final fitting |
| textord_mostrar_blobs_finais | 0 | Display blob bounds after pre-ass |
| textord_test_landscape | 0 | Tests refer to land/port |
| textord_linhas_de_base_paralelas | 1 | Force parallel baselines |
| textord_linhas_de_base_retas | 0 | Force straight baselines |
| textord_old_baselines | 1 | Use old baseline algorithm |
| textord_old_xheight | 0 | Use old xheight algorithm |
| textord_fix_xheight_bug | 1 | Use spline baseline |
| textord_fix_makerow_bug | 1 | Prevent multiple baselines |
| textord_debug_xheights | 0 | Test xheight algorithms |
| textord_biased_skewcalc | 1 | Bias skew estimates with line length |
| textord_interpolating_skew | 1 | Interpolate across gaps |
| textord_new_inicial_xheight | 1 | Use test xheight mechanism |
| textord_debug_blob | 0 | Print test blob information |
| textord_realmente_antigo_xheight | 0 | Use original wiseowl xheight |
| textord_oldbl_debug | 0 | Debug old baseline generation |
| textord_debug_baselines | 0 | Debug baseline generation |
| textord_oldbl_paradef | 1 | Use para default mechanism |
| textord_oldbl_split_splines | 1 | Split stepped splines |
| textord_oldbl_merge_parts | 1 | Merge suspect partitions |
| correção antigabl | 1 | Improve correlation of heights |
| oldbl_xhfix | 0 | Fix bug in modes threshold for xheights |
| textord_ocropus_mode | 0 | Make baselines for ocropus |
| textord_tabfind_only_strokewidths | 0 | Only run stroke widths |
| textord_tabfind_show_initialtabs | 0 | Show tab candidates |
| textord_tabfind_show_finaltabs | 0 | Show tab vectors |
| textord_mostrar_tabelas | 0 | Show table regions |
| textord_tablefind_show_mark | 0 | Debug table marking steps in detail |
| textord_tablefind_show_stats | 0 | Show page stats used in table finding |
| textord_tablefind_recognize_tables | 0 | Enables the table recognizer for table layout and filtering. |
| textord_all_prop | 0 | All doc is proportial text |
| textord_debug_pitch_test | 0 | Debug on fixed pitch test |
| textord_disable_pitch_test | 0 | Turn off dp fixed pitch algorithm |
| textord_fast_pitch_test | 0 | Do even faster pitch algorithm |
| textord_debug_pitch_metric | 0 | Write full metric stuff |
| textord_show_row_cuts | 0 | Draw row-level cuts |
| textord_mostrar_recortes_de_página | 0 | Draw page-level cuts |
| textord_pitch_cheat | 0 | Use correct answer for fixed/prop |
| textord_blockndoc_fixado | 0 | Attempt whole doc/block fixed pitch |
| textord_mostrar_palavras_iniciais | 0 | Display separate words |
| textord_mostrar_novas_palavras | 0 | Display separate words |
| textord_mostrar_palavras_fixas | 0 | Display forced fixed pitch words |
| textord_blocksall_fixed | 0 | Moan about prop blocks |
| textord_blocksall_prop | 0 | Moan about fixed pitch blocks |
| textord_blocksall_testing | 0 | Dump stats when moaning |
| textord_modo_teste | 0 | Do current test |
| similaridade_linha_textord_pitch | 0.08 | Fraction of xheight for sameness |
| palavras_iniciais_minúsculas | 0.5 | Max initial cluster size |
| palavras_iniciais_maiúsculas | 0.15 | Min initial cluster spacing |
| palavras_propriedade_padrão_não_espaço | 0.25 | Fraction of xheight |
| palavras_padrão_espaço_fixo | 0.75 | Fraction of xheight |
| palavras_padrão_limite_fixo | 0.6 | Allowed size variance |
| textord_words_definite_spread | 0.3 | Non-fuzzy spacing region |
| textord_spacesize_ratiofp | 2.8 | Min ratio space/nonspace |
| textord_spacesize_ratioprop | 2 | Min ratio space/nonspace |
| textord_fpiqr_ratio | 1.5 | Pitch IQR/Gap IQR threshold |
| textord_max_pitch_iqr | 0.2 | Xh fraction noise in pitch |
| textord_fp_min_width | 0.5 | Min width of decent blobs |
| textord_underline_offset | 0.1 | Fraction of x to ignore |
| nível_de_depuração_ambigs | 0 | Debug level for unichar ambiguities |
| nível_de_depuração_classificar | 0 | Classify debug level |
| método_de_normação_classificatória | 1 | Normalization Method ... |
| matcher_debug_level | 0 | Matcher Debug Level |
| sinalizadores_de_depuração_do_correspondente | 0 | Matcher Debug Flags |
| nível de depuração de aprendizado de classificação | 0 | Learning Debug Level: |
| matcher_permanent_classes_min | 1 | Min # of permanent classes |
| matcher_min_examples_for_prototyping | 3 | Reliable Config Threshold |
| matcher_sufficient_examples_for_prototyping | 5 | Enable adaption even if the ambiguities have not been seen |
| limiar_de_adaptação_proto | 230 | Threshold for good protos during adaptive 0-255 |
| limiar de adaptação de classificação | 230 | Threshold for good features during adaptive 0-255 |
| limiar_classify_class_prunter | 229 | Class Pruner Threshold 0-255 |
| multiplicador_de_podador_de_classificação | 15 | Class Pruner Multiplier 0-255: |
| classificar_cp_força_de_corte | 7 | Class Pruner CutoffStrength: |
| classificar_multiplicador_de_correspondência_inteira | 10 | Integer Matcher Multiplier 0-255: |
| nível de depuração dawg | 0 | Set to 1 for general debug info, to 2 for more details, to 3 to see all the debug messages |
| nível_de_depuração_hífen | 0 | Debug level for hyphenated words. |
| stopper_smallword_size | 2 | Size of dict word to be treated as non-dict word |
| nível_de_depuração_stopper | 0 | Stopper debug level |
| tessedit_truncate_wordchoice_log | 10 | Max words to keep in list |
| tentativas_máximas_permutador | 10000 | Maximum number of different character choices to consider during permutation. This limit is especially useful when user patterns are specified, since overly generic patterns can result in dawg search exploring an overly large number of options. |
| reparar_blobs_não_cortados | 1 | Fix blobs that aren't chopped |
| chop_debug | 0 | Chop debug |
| comprimento_dividido_cortado | 10000 | Split Length |
| cortar_mesma_distância | 2 | Same distance |
| pontos_mínimos_de_contorno | 6 | Min Number of Points on Outline |
| tamanho_da_pilha_da_costura_picada | 150 | Max number of seams in seam_pile |
| ângulo_interno_cortado | -50 | Min Inside Angle Bend |
| área de contorno mínima de corte | 2000 | Min Outline Area |
| largura_máxima_centralizada_cortada | 90 | Width of (smaller) chopped blobs above which we don't care that a chop is not near the center. |
| peso_cortado_x_y | 3 | X / Y length weight |
| nível_de_depuração_wordrec | 0 | Debug level for wordrec |
| wordrec_max_join_chunks | 4 | Max number of broken pieces to associate |
| nível_de_depuração_da_busca_segmentada | 0 | SegSearch debug level |
| segsearch_max_pain_points | 2000 | Maximum number of pain points stored in the queue |
| segsearch_max_futile_classifications | 20 | Maximum number of pain point classifications per chunk that did not result in finding a better word choice. |
| nível de depuração do modelo de linguagem | 0 | Language model debug level |
| ordem_ngram_modelo_de_linguagem | 8 | Maximum order of the character ngram model |
| language_model_viterbi_list_ max_num_prunable | 10 | Maximum number of prunable (those for which PrunablePath() is true) entries in each viterbi list recorded in BLOB_CHOICEs |
| language_model_viterbi_list_max_size | 500 | Maximum size of viterbi lists recorded in BLOB_CHOICEs |
| comprimento_mínimo_composto_do_modelo_de_linguagem | 3 | Minimum length of compound words |
| wordrec_display_segmentations | 0 | Display Segmentations |
| tessedit_pageseg_mode | 6 | Page seg mode: 0=osd only, 1=auto+osd, 2=auto_only, 3=auto, 4=column, 5=block_vert, 6=block, 7=line, 8=word, 9=word_circle, 10=char,11=sparse_text, 12=sparse_text+osd, 13=raw_line (Values from PageSegMode enum in tesseract/publictypes.h) |
| tessedit_ocr_engine_mode | 2 | Which OCR engine(s) to run (Tesseract, LSTM, both). Defaults to loading and running the most accurate available. |
| páginaseg_devanagari_split_strategy | 0 | Whether to use the top-line splitting process for Devanagari documents while performing page-segmentation. |
| ocr_devanagari_split_strategy | 0 | Whether to use the top-line splitting process for Devanagari documents while performing ocr. |
| bidi_debug | 0 | Debug level for BiDi |
| applybox_debug | 1 | Debug level |
| applybox_page | 0 | Page number to apply boxes from |
| tessedit_bigram_debug | 0 | Amount of debug output for bigram correction. |
| remoção de ruído de depuração | 0 | Debug reassignment of small outlines |
| ruído_máximoporblob | 8 | Max diacritics to apply to a blob |
| ruído_máximo_por_palavra | 16 | Max diacritics to apply to a word |
| debug_x_ht_level | 0 | Reestimate debug |
| qualidade_mínima_inicial_alfas_reqd | 2 | alphas in a good word |
| tessedit_tess_adaption_mode | 39 | Adaptation decision algorithm for tess |
| nível de depuração multilíngue | 0 | Print multilang debug info. |
| nível_de_depuração_de_parágrafo | 0 | Print paragraph debug info. |
| tessedit_preserve_min_wd_len | 2 | Only preserve wds longer than this |
| classificação_máxima_de_crucagem | 10 | For adj length in rating per ch |
| indicadores_crunch_pot | 1 | How many potential indicators needed |
| strings_de_folha_crunch_lc | 4 | Don't crunch words with long lower case strings |
| crunch_leave_uc_strings | 4 | Don't crunch words with long lower case strings |
| crunch_long_repetitions | 3 | Crunch words with long repetitions |
| crunch_debug | 0 | As it says |
| fixsp_non_noise_limit | 1 | How many non-noise blbs either side? |
| fixsp_modo_concluído | 1 | What constitues done for spacing |
| debug_fix_space_level | 0 | Contextual fixspace debug |
| x_ht_tolerância_de_aceitação | 8 | Max allowed deviation of blob top outside of font data |
| x_ht_min_change | 8 | Min change in xht before actually trying it |
| superscript_debug | 0 | Debug level for sub & superscript fixer |
| qualidade_jpg | 85 | Set JPEG quality level |
| dpi definido pelo usuário | 0 | Specify DPI for input image |
| min_characters_to_try | 50 | Specify minimum characters to try during OSD |
| suspect_level | 99 | Suspect marker level |
| suspect_short_words | 2 | Don't suspect dict wds longer than this |
| tessedit_modo_rejeitar | 0 | Rejection algorithm |
| tessedit_image_border | 2 | Rej blbs near image edge limit |
| min_sane_x_ht_pixels | 8 | Reject any x-ht lt or eq than this |
| tessedit_page_number | -1 | -1 -> All pages, else specific page to process |
| tessedit_paralelizar | 1 | Run in parallel where possible |
| lstm_modo_de_escolha | 2 | Allows to include alternative symbols choices in the hOCR output. Valid input values are 0, 1 and 2. 0 is the default value. With 1 the alternative symbol choices per timestep are included. With 2 alternative symbol choices are extracted from the CTC process instead of the lattice. The choices are mapped per character. |
| lstm_choice_iterations | 5 | Sets the number of cascading iterations for the Beamsearch in lstm_modo_de_escolha. Note that lstm_modo_de_escolha must be set to a value greater than 0 to produce results. |
| nível_de_depuração_tosp | 0 | Debug data |
| tosp_espaço_suficiente_amostras_para_mediana | 3 | or should we use mean |
| tosp_redo_kern_limit | 10 | No.samples reqd to reestimate for row |
| tosp_poucas_amostras | 40 | No.gaps reqd with 1 large gap to treat as a table |
| linha_curta_tosp | 20 | No.gaps reqd with few cert spaces to use certs |
| método_de_sanidade_tosp | 1 | How to avoid being silly |
| tamanho_máximo_de_ruído_textord | 7 | Pixel size of noise |
| textord_baseline_debug | 0 | Baseline debug level |
| textord_noise_sizefraction | 10 | Fraction of size for maxima |
| limite de transposição de ruído textord | 16 | Transitions for normal blob |
| textord_noise_sncount | 1 | super norm blobs to save row |
| usar ambiguidades para adaptação | 0 | Use ambigs for deciding whether to adapt to a character |
| priorize_division | 0 | Prioritize blob division over chopping |
| classificar_habilitar_aprendizagem | 1 | Enable adaptive classifier |
| tess_cn_matching | 0 | Character Normalized Matching |
| tess_bn_matching | 0 | Baseline Normalized Matching |
| classificar_ativar_correspondência_adaptativa | 1 | Enable adaptive classifier |
| classificar_usar_modelos_pré_adaptados | 0 | Use pre-adapted classifier templates |
| classificar_salvar_modelos_adaptados | 0 | Save adapted templates to a file |
| classificar_ativar_depurador_adaptativo | 0 | Enable match debugger |
| classificar_norma_não_linear | 0 | Non-linear stroke-density normalization |
| disable_character_fragments | 1 | Do not include character fragments in the results of the classifier |
| classificar_fragmentos_de_caracteres_de_depuração | 0 | Bring up graphical debugging windows for fragments training |
| matcher_debug_separate_windows | 0 | Use two different windows for debugging the matching: One for the protos and one for the features. |
| classificar_bln_modo_numérico | 0 | Assume the input is numbers [0-9]. |
| carregar_sistema_cão | 1 | Load system word dawg. |
| carregar_freq_dawg | 1 | Load frequent word dawg. |
| carregar_cão_sem_ambiguidade | 1 | Load unambiguous word dawg. |
| carregar_punc_dawg | 1 | Load dawg with punctuation patterns. |
| carregar_número_cão | 1 | Load dawg with number patterns. |
| carregar_bigram_dawg | 1 | Load dawg with special word bigrams. |
| use_only_first_uft8_step | 0 | Use only the first UTF8 step of the given string when computing log probabilities. |
| stopper_sem_escolhas_aceitáveis | 0 | Make AcceptableChoice() always return false. Useful when there is a need to explore all segmentations |
| segmento_não_alfabético_script | 0 | Don't use any alphabetic-specific tricks. Set to true in the traineddata config file for scripts that are cursive or inherently fixed-pitch |
| salvar_palavras_doc | 0 | Save Document Words |
| mesclar_fragmentos_na_matriz | 1 | Merge the fragments in the ratings matrix and delete them after merging |
| wordrec_enable_assoc | 1 | Associator Enable |
| forçar_associação_de_palavras | 0 | force associator to run regardless of what enable_assoc is. This is used for CJK where component grouping is necessary. |
| chop_enable | 1 | Chop enable |
| corte_deslizamento_vertical | 0 | Vertical creep |
| pilha de costura nova | 1 | Use new seam_pile |
| assume_fixed_pitch_char_segment | 0 | include fixed-pitch heuristics in char segmentation |
| wordrec_skip_no_truth_words | 0 | Only run OCR for words that had truth recorded in BlamerBundle |
| wordrec_debug_blamer | 0 | Print blamer debug messages |
| wordrec_run_blamer | 0 | Try to set the blame for errors |
| salvar_opções_alternativas | 1 | Save alternative paths found during chopping and segmentation search |
| language_model_ngram_on | 0 | Turn on/off the use of character ngram model |
| language_model_ngram_use_ only_first_uft8_step | 0 | Use only the first UTF8 step of the given string when computing log probabilities. |
| language_model_ngram_space_delimited_language | 1 | Words are delimited by space |
| language_model_use_sigmoidal_certainty | 0 | Use sigmoidal score for certainty |
| tessedit_resegment_from_boxes | 0 | Take segmentation and labeling from box file |
| tessedit_resegment_from_line_boxes | 0 | Conversion of word/line box file to char box file |
| tessedit_train_from_boxes | 0 | Generate training data from boxed chars |
| tessedit_make_boxes_from_boxes | 0 | Generate more boxes from boxed chars |
| tessedit_train_line_recognizer | 0 | Break input into lines and remap boxes if present |
| tessedit_dump_pageseg_images | 0 | Dump intermediate images made during page segmentation |
| tessedit_do_invert | 1 | Try inverting the image in LSTMRecognizeWord |
| tessedit_ambigs_treinamento | 0 | Perform training for ambiguities |
| tessedit_adaption_debug | 0 | Generate and print debug information for adaption |
| applybox_learn_chars_and_char_frags_mode | 0 | Learn both character fragments (as is done in the special low exposure mode) as well as unfragmented characters. |
| applybox_learn_ngrams_mode | 0 | Each bounding box is assumed to contain ngrams. Only learn the ngrams whose outlines overlap horizontally. |
| tessedit_exibir_palavras_saídas | 0 | Draw output words |
| tessedit_dump_choices | 0 | Dump char choices |
| tessedit_timing_debug | 0 | Print timing stats |
| tessedit_fix_fuzzy_spaces | 1 | Try to improve fuzzy spaces |
| tessedit_unrej_any_wd | 0 | Don't bother with word plausibility |
| tessedit_fix_hyphens | 1 | Crunch double hyphens? |
| tessedit_enable_doc_dict | 1 | Add words to the document dictionary |
| tessedit_debug_fonts | 0 | Output font info per char |
| tessedit_debug_block_rejection | 0 | Block and Row stats |
| tessedit_ativar_correção_de_bigramas | 1 | Enable correction based on the word bigram dictionary. |
| tessedit_enable_dict_correction | 0 | Enable single word correction based on the dictionary. |
| ativar_remoção_de_ruído | 1 | Remove and conditionally reassign small outlines when they confuse layout analysis, determining diacritics vs noise |
| tessedit_minimal_rej_pass1 | 0 | Do minimal rejection on pass 1 output |
| tessedit_test_adaption | 0 | Test adaption criteria |
| teste_pt | 0 | Test for point |
| parágrafo_texto_baseado | 1 | Run paragraph detection on the post-text-recognition (more accurate) |
| lstm_use_matrix | 1 | Use ratings matrix/beam search with lstm |
| tessedit_boa_qualidade_não_rej | 1 | Reduce rejection on good docs |
| tessedit_use_reject_spaces | 1 | Reject spaces? |
| tessedit_preserve_blk_rej_perfect_wds | 1 | Only rej partially rejected words in block rejection |
| tessedit_preserve_row_rej_perfect_wds | 1 | Only rej partially rejected words in row rejection |
| tessedit_dont_blkrej_good_wds | 0 | Use word segmentation quality metric |
| tessedit_dont_rowrej_good_wds | 0 | Use word segmentation quality metric |
| tessedit_row_rej_good_docs | 1 | Apply row rejection to good docs |
| tessedit_reject_bad_qual_wds | 1 | Reject all bad quality wds |
| tessedit_debug_doc_rejection | 0 | Page stats |
| tessedit_debug_quality_metrics | 0 | Output data to debug file |
| bland_unrej | 0 | unrej potential with no checks |
| unlv_tilde_crunching | 0 | Mark v.bad words for tilde crunch |
| hocr_font_info | 0 | Add font info to hocr output |
| hocr_char_boxes | 0 | Add coordinates for each character to hocr output |
| crunch_early_merge_tess_fails | 1 | Before word crunch? |
| crunch_early_convert_bad_unlv_chs | 0 | Take out ~^ early? |
| crunch_terrible_garbage | 1 | As it says |
| strings_de_saída_ok_crunch | 1 | Don't touch sensible strings |
| crunch_accept_ok | 1 | Use acceptability in okstring |
| crunch_leave_accept_strings | 0 | Don't pot crunch sensible strings |
| crunch_include_numerals | 0 | Fiddle alpha figures |
| tessedit_prefer_joined_punct | 0 | Reward punctuation joins |
| tessedit_write_block_separators | 0 | Write block separators in output |
| tessedit_write_rep_codes | 0 | Write repetition char code |
| tessedit_write_unlv | 0 | Write .unlv output file |
| tessedit_create_txt | 0 | Write .txt output file |
| tessedit_create_hocr | 0 | Write .html hOCR output file |
| tessedit_create_alto | 0 | Write .xml ALTO file |
| tessedit_create_lstmbox | 0 | Write .box file for LSTM training |
| tessedit_create_tsv | 0 | Write .tsv output file |
| tessedit_create_wordstrbox | 0 | Write WordStr format .box output file |
| tessedit_create_pdf | 0 | Write .pdf output file |
| textonly_pdf | 0 | Create PDF with only one invisible text layer |
| suspect_constrain_1Il | 0 | UNLV keep 1Il chars rejected |
| tessedit_minimal_rejection | 0 | Only reject tess failures |
| tessedit_zero_rejection | 0 | Don't reject ANYTHING |
| tessedit_word_for_word | 0 | Make output have exactly one word per WERD |
| tessedit_zero_kelvin_rejection | 0 | Don't reject ANYTHING AT ALL |
| tessedit_rejection_debug | 0 | Adaption debug |
| tessedit_flip_0O | 1 | Contextual 0O O0 flips |
| rej_trust_doc_dawg | 0 | Use DOC dawg in 11l conf. detector |
| rej_1Il_use_dict_word | 0 | Use dictword test |
| rej_1Il_trust_permuter_type | 1 | Don't double check |
| rej_use_tess_accepted | 1 | Individual rejection control |
| rej_use_tess_blanks | 1 | Individual rejection control |
| rej_use_good_perm | 1 | Individual rejection control |
| rej_use_sensible_wd | 0 | Extend permuter check |
| rej_alphas_in_number_perm | 0 | Extend permuter check |
| tessedit_create_boxfile | 0 | Output text with boxes |
| tessedit_write_images | 0 | Capture the image from the IPE |
| modo_de_exibição_interativo | 0 | Run interactively? |
| tessedit_override_permuter | 1 | According to dict_word |
| tessedit_use_primary_params_model | 0 | In multilingual mode use params model of the primary language |
| textord_tabfind_show_vlines | 0 | Debug line finding |
| textord_use_cjk_fp_model | 0 | Use CJK fixed pitch model |
| poly_allow_detailed_fx | 0 | Allow feature extractors to see the original outline |
| tessedit_init_config_only | 0 | Only initialize with the config file. Useful if the instance is not going to be used for OCR but say only for layout analysis. |
| textord_equation_detect | 0 | Turn on equation detector |
| textord_tabfind_vertical_text | 1 | Enable vertical detection |
| textord_tabfind_force_vertical_text | 0 | Force using vertical text page mode |
| preservar_espaços_entre_palavras | 0 | Preserve multiple interword spaces |
| páginaseg_aplicar_máscara_musical | 1 | Detect music staff and remove intersecting components |
| textord_modo_altura_única | 0 | Script has no xheight, so use a single mode |
| tosp_old_to_method | 0 | Space stats use prechopping? |
| tosp_old_to_constrain_sp_kn | 0 | Constrain relative values of inter and intra-word gaps for old_to_method. |
| tosp_somente_use_prop_rows | 1 | Block stats to use fixed pitch rows? |
| tosp_forçar_quebra_de_palavras_no_ponto | 0 | Force word breaks on punct to break long lines in non-space delimited langs |
| tosp_use_pre_chopping | 0 | Space stats use prechopping? |
| tosp_old_to_bug_fix | 0 | Fix suspected bug in old code |
| tosp_block_use_cert_spaces | 1 | Only stat OBVIOUS spaces |
| tosp_row_use_cert_spaces | 1 | Only stat OBVIOUS spaces |
| tosp_blobs_estreitos_não_certificado | 1 | Only stat OBVIOUS spaces |
| tosp_row_use_cert_spaces1 | 1 | Only stat OBVIOUS spaces |
| tosp_recovery_isolated_row_stats | 1 | Use row alone when inadequate cert spaces |
| tosp_apenas_pequenos_espaços_para_kern | 0 | Better guess |
| tosp_all_flips_fuzzy | 0 | Pass ANY flip to context? |
| tosp_fuzzy_limit_all | 1 | Don't restrict kn->sp fuzzy limit to tables |
| textord_sem_rejeições | 0 | Don't remove noise blobs |
| textord_mostrar_blobs | 0 | Display unsorted blobs |
| textord_mostrar_caixas | 0 | Display unsorted blobs |
| textord_ruído_rejwords | 1 | Reject noise-like words |
| textord_noise_rejrows | 1 | Reject noise-like rows |
| textord_ruído_depuração | 0 | Debug row garbage detector |
| classificar_aprender_depurar_str | Class str to debug learning | |
| arquivo_de_palavras_do_usuário | A filename of user-provided words. | |
| sufixo_palavras_do_usuário | A suffix of user-provided words located in tessdata. | |
| arquivo_de_padrões_do_usuário | A filename of user-provided patterns. | |
| sufixo_padrões_de_usuário | A suffix of user-provided patterns located in tessdata. | |
| arquivo de palavras ambíguas de saída | Output file for ambiguities found in the dictionary | |
| palavra_para_depurar | Word for which stopper debug information should be printed to stdout | |
| tessedit_char_blacklist | Blacklist of chars not to recognize | |
| tessedit_char_whitelist | Whitelist of chars to recognize | |
| tessedit_char_unblacklist | List of chars to override tessedit_char_blacklist | |
| tessedit_write_params_to_file | Write all parameters to the given file. | |
| aplicar_padrão_de_exposição_da_caixa | .exp | Exposure value follows this pattern in the image filename. The name of the image files are expected to be in the form [lang].[fontname].exp [num].tif |
| chs_leading_punct('`" | Pontuação inicial | |
| chs_trailing_punct1 | ).,;:?! | 1st Trailing punctuation |
| chs_trailing_punct2)'`" | 2nd Trailing punctuation | |
| contornos_ímpares | %| | Número não padrão de contornos |
| outlines_2ij!?%":; | Número não padrão de contornos | |
| pontuação_numérica | ., | Punct. chs expected WITHIN numbers |
| caractere_não_reconhecido | | | Output char for unidentified blobs |
| ok_repeated_ch_non_alphanum_wds | -?*= | Allow NN to unrej |
| conflito_conjunto_I_l_1 | Il1 [] | Il1 conflict set |
| tipo_de_arquivo | .tif | Filename extension |
| tessedit_load_sublangs | List of languages to load with this one | |
| separador_de_página | Page separator (default is form feed control character) | |
| classificar_char_norm_range | 0.2 | Character Normalization Range ... |
| classificar_taxa_máxima | 1.5 | Veto ratio between classifier ratings |
| classificar_margem_de_certeza_máxima | 5.5 | Veto difference between classifier certainties |
| matcher_good_threshold | 0.125 | Good Match (0-1) |
| resultado_adaptativo_confiável_do_matcher | 0 | Great Match (0-1) |
| limiar_perfeito_do_correspondente | 0.02 | Perfect Match (0-1) |
| matcher_bad_match_pad | 0.15 | Bad Match Pad (0-1) |
| margem_de_classificação_do_comparador | 0.1 | New template margin (0-1) |
| matcher_avg_noise_size | 12 | Avg. noise blob length |
| matcher_clustering_max_angle_delta | 0.015 | Maximum angle delta for prototype clustering |
| penalização_de_lixo_desajustado | 0 | Penalty to apply when a non-alnum is vertically out of its expected textline position |
| escala_de_avaliação | 1.5 | Rating scaling factor |
| escala_de_certeza | 20 | Certainty scaling factor |
| tessedit_class_miss_scale | 0.00390625 | Scale factor for features not used |
| fator_de_poda_adaptado_classificar | 2.5 | Prune poor adapted results this much worse than best result |
| limiar de poda adaptado de classificação | -1 | Threshold at which fator_de_poda_adaptado_classificar starts |
| classificar_fragmentos_de_caracteres_lixo_limiar_de_certeza | -3 | Exclude fragments that do not look like whole characters from training and adaption |
| tamanho_máximo_grande_do_speckle | 0.3 | Max large speckle size |
| penalidade_de_classificação_speckle | 10 | Penalty to add to worst rating for noise |
| xheight_penalty_subscripts | 0.125 | Score penalty (0.1 = 10%) added if there are subscripts or superscripts in a word, but it is otherwise OK. |
| penalidade_altura_x_inconsistente | 0.25 | Score penalty (0.1 = 10%) added if an xheight is inconsistent. |
| segment_penalty_dict_frequent_word | 1 | Score multiplier for word matches which have good case and are frequent in the given language (lower is better). |
| segment_penalty_dict_case_ok | 1.1 | Score multiplier for word matches that have good case (lower is better). |
| segment_penalty_dict_case_bad | 1.3125 | Default score multiplier for word matches, which may have case issues (lower is better). |
| segment_penalidade_dict_nonword | 1.25 | Score multiplier for glyph fragment segmentations which do not match a dictionary word (lower is better). |
| escala_de_certeza | 20 | Certainty scaling factor |
| stopper_nondict_certainty_base | -2.5 | Certainty threshold for non-dict words |
| stopper_phase2_certainty_rejection_offset | 1 | Reject certainty offset |
| stopper_certainty_per_char | -0.5 | Certainty to add for each dict char above small word size. |
| stopper_allowable_character_badness | 3 | Max certaintly variation allowed in a word (in sigma) |
| doc_dict_pending_threshold | 0 | Worst certainty for using pending dictionary |
| doc_dict_certainty_threshold | -2.25 | Worst certainty for words that can be inserted into the document dictionary |
| tessedit_certainty_threshold | -2.25 | Good blob limit |
| chop_split_dist_knob | 0.5 | Split length adjustment |
| chop_overlap_knob | 0.9 | Split overlap adjustment |
| chop_center_knob | 0.15 | Split center adjustment |
| chop_sharpness_knob | 0.06 | Split sharpness adjustment |
| chop_width_change_knob | 5 | Width change adjustment |
| chop_ok_split | 100 | OK split limit |
| chop_good_split | 50 | Good split limit |
| segsearch_max_char_wh_ratio | 2 | Proporção máxima entre largura e altura dos caracteres |
Para obter melhores resultados, recomenda-se usar os filtros de pré-processamento de imagem do IronOCR antes de aplicar o OCR. Esses filtros podem melhorar drasticamente a precisão, especialmente ao trabalhar com digitalizações de baixa qualidade ou documentos complexos, como tabelas .
Perguntas frequentes
Como configuro o IronTesseract para OCR em C#?
Para configurar o IronTesseract, crie uma instância do IronTesseract e defina propriedades como Idioma e Configuração. Você pode especificar o idioma do OCR (dentre 125 idiomas suportados), habilitar a leitura de código de barras, configurar a saída em PDF pesquisável e definir a lista de caracteres permitidos. Por exemplo: var tesseract = new IronOcr.IronTesseract { Language = IronOcr.OcrLanguage.English, Configuration = new IronOcr.TesseractConfiguration { ReadBarCodes = false, RenderSearchablePdf = true } };
Quais formatos de entrada o IronTesseract suporta?
O IronTesseract aceita diversos formatos de entrada através da classe OcrInput. Você pode processar imagens (PNG, JPG, etc.), arquivos PDF e documentos digitalizados. A classe OcrInput oferece métodos flexíveis para carregar esses diferentes formatos, facilitando a execução de OCR em praticamente qualquer documento que contenha texto.
Posso ler códigos de barras juntamente com texto usando o IronTesseract?
Sim, o IronTesseract inclui recursos avançados de leitura de código de barras. Você pode habilitar a detecção de código de barras definindo `ReadBarCodes = true` na configuração do Tesseract. Isso permite extrair dados de texto e código de barras do mesmo documento em uma única operação de OCR.
Como faço para criar PDFs pesquisáveis a partir de documentos digitalizados?
O IronTesseract pode converter documentos e imagens digitalizados em PDFs pesquisáveis definindo `RenderSearchablePdf = true` na configuração do Tesseract. Isso cria arquivos PDF onde o texto é selecionável e pesquisável, mantendo a aparência original do documento.
Quais idiomas o IronTesseract suporta para OCR?
O IronTesseract suporta 125 idiomas internacionais para reconhecimento de texto. Você pode especificar o idioma definindo a propriedade `Language` na sua instância do IronTesseract, como `IronOcr.OcrLanguage.English`, `Spanish`, `Chinese`, `Arabic` e muitos outros.
Posso restringir quais caracteres são reconhecidos durante o OCR?
Sim, o IronTesseract permite a criação de listas de permissão e bloqueio de caracteres através da propriedade WhiteListCharacters em TesseractConfiguration. Esse recurso ajuda a melhorar a precisão quando você conhece o conjunto de caracteres esperado, como, por exemplo, limitar o reconhecimento apenas a caracteres alfanuméricos.
Como faço para realizar OCR em vários documentos simultaneamente?
O IronTesseract oferece suporte a recursos multithread para processamento em lote. Você pode aproveitar o processamento paralelo para realizar OCR em vários documentos simultaneamente, melhorando significativamente o desempenho ao lidar com grandes volumes de imagens ou PDFs.
Qual versão do Tesseract o IronOCR utiliza?
O IronOCR utiliza uma versão personalizada e otimizada do Tesseract 5, conhecida como Iron Tesseract. Este mecanismo aprimorado oferece maior precisão e desempenho em comparação com as implementações padrão do Tesseract, mantendo a compatibilidade com aplicativos .NET.
Como o IronOCR pode melhorar a precisão dos dados?
O IronOCR melhora a precisão dos dados através de seus algoritmos avançados de reconhecimento e recursos de correção de imagem, assegurando que o processo de extração de texto seja tanto confiável quanto preciso.
Há uma avaliação gratuita disponível para o IronOCR?
Sim, o Iron Software oferece uma avaliação gratuita do IronOCR, permitindo que os usuários testem seus recursos e capacidades antes de tomar uma decisão de compra.

