Comment extraire du texte à partir d'un fichier image

Comment utiliser Iron Tesseract en C

This article was translated from English: Does it need improvement?
Translated
View the article in English

Iron Tesseract en C# est utilisé en créant une instance IronTesseract, en la configurant avec des paramètres de langue et d'OCR, puis en appelant la méthode Read() sur un objet OcrInput contenant vos images ou PDFs. Cela convertit les images de texte en PDFs consultables en utilisant le moteur optimisé de Tesseract 5.

IronOCR fournit une API intuitive pour utiliser le Tesseract 5 personnalisé et optimisé, connu sous le nom d'Iron Tesseract. En utilisant IronOCR et IronTesseract, vous serez capable de convertir des images de texte et des documents scannés en texte et PDFs consultables. La bibliothèque prend en charge 125 langues internationales et comprend des fonctionnalités avancées telles que la lecture de codes-barres et la vision par ordinateur.

Démarrage rapide : Configurer IronTesseract en C#

Cet exemple démontre comment configurer IronTesseract avec des paramètres spécifiques et effectuer l'OCR en une seule ligne de code.

  1. Installez IronOCR avec le Gestionnaire de Packages NuGet

    PM > Install-Package IronOcr
  2. Copiez et exécutez cet extrait de code.

    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"));
  3. Déployez pour tester sur votre environnement de production.

    Commencez à utiliser IronOCR dans votre projet dès aujourd'hui avec un essai gratuit

    arrow pointer

Comment créer une instance IronTesseract?

Initialiser un objet Tesseract avec ce code :

: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()
$vbLabelText   $csharpLabel

Vous pouvez personnaliser le comportement de IronTesseract en sélectionnant différentes langues, en activant la lecture de codes-barres, et en créant des listes blanches/noires de caractères. IronOcr propose des options de configuration complètes pour affiner votre processus d'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
}
$vbLabelText   $csharpLabel

Une fois configuré, vous pouvez utiliser les fonctionnalités de Tesseract pour lire les objets OcrInput. La classe OcrInput fournit des méthodes flexibles pour charger différents formats d'entrée :

: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
$vbLabelText   $csharpLabel

Pour les scénarios complexes, vous pouvez exploiter les capacités de multithreading pour traiter plusieurs documents simultanément, ce qui améliore considérablement les performances des opérations par lots.

Qu'est-ce que les variables de configuration avancées de Tesseract?

L'interface IronOCR Tesseract permet un contrôle total des variables de configuration de Tesseract via la classe IronOcr.TesseractConfiguration . Ces paramètres avancés vous permettent d'optimiser les performances de l'OCR pour des cas d'utilisation spécifiques, tels que la correction de scans de faible qualité ou la lecture de types de documents spécifiques.

Comment utiliser la configuration Tesseract dans le code?

: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)
$vbLabelText   $csharpLabel

IronOCR propose également une configuration spécialisée pour différents types de documents. Par exemple, lorsque vous lisez des passeports ou traitez des chèques MICR, vous pouvez appliquer des filtres de prétraitement spécifiques et une détection de région pour améliorer la précision.

Exemple de configuration pour des documents financiers :

: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
$vbLabelText   $csharpLabel

Quelle est la liste complète de toutes les variables de configuration de Tesseract ?

Cela peut être défini en utilisant IronTesseract.Configuration.TesseractVariables["key"] = value;. Les variables de configuration vous permettent d'affiner le comportement de l'OCR pour obtenir des résultats optimaux avec vos documents spécifiques. Pour des conseils détaillés sur l'optimisation des performances de l'OCR, consultez notre guide de configuration de l'OCR rapide.

Variable de configuration Tesseract Default Signification
classifier_num_cp_niveaux3Nombre de niveaux de taille de l'élagueuse
textord_debug_tabfind0Recherche de l'onglet de débogage
textord_debug_bugs0Activer les résultats relatifs aux bogues dans la recherche par onglets
textord_testregion_gauche-1Bord gauche du rectangle de rapport de débogage
textord_testregion_top-1Bord supérieur du rectangle de rapport de débogage
textord_testregion_droite2147483647Bord droit du rectangle de débogage
textord_testregion_bottom2147483647Bord inférieur du rectangle de débogage
textord_tabfind_show_partitions0Afficher les limites de la partition, en attente si >1
niveau de débogage de la division devanagari0Niveau de débogage pour le processus shiro-rekha divisé.
bords_max_enfants_par_contour10Nombre maximal d'enfants à l'intérieur d'un contour de personnage
couches enfants maximum des bords5Nombre maximal de calques enfants imbriqués dans le contour d'un personnage
bords_enfants_par_petit-enfant10Rapport d'importance pour le découpage des contours
limite du nombre d'enfants aux bords45Nombre maximal de trous autorisés dans la tache
bords_min_non-trou12Nombre minimal de pixels pour un caractère potentiel dans la boîte
rapport de surface du chemin des bords40Max lensq/area for acceptable child outline
textord_fp_chop_error2Courbure maximale autorisée des cellules hachées
textord_tabfind_afficher_images0Show image blobs
textord_skewsmooth_offset4Pour un facteur lisse
textord_skewsmooth_offset21Pour un facteur lisse
textord_test_x-2147483647coordonnées du point de test
textord_test_y-2147483647coordonnées du point de test
textword_min_blobs_dans_ligne4Nombre minimal de blobs avant le comptage du gradient
textord_spline_minblobs8Min blobs in each spline segment
textord_spline_médianewin6Size of window for spline segmentation
textord_max_blob_overlaps4Max number of blobs a big blob can overlap
textord_min_xhauteur10Min credible pixel xheight
essais_lms_ligne_textord12Number of linew fits to do
vieux_trou_perte10Max lost before fallback line used
version linéaire de Pitsync6Use new fast algorithm
profondeur_fausse_synchronisation_pit1Max advance fake generation
textord_tabfind_show_strokewidths0Show stroke widths
intervalle de matrice de points textord3Max pixel gap for broken pixed pitch
bloc de débogage textord0Block to do debug on
plage de hauteur de textord2Max range test on pitch
pouvoir de veto des mots textord5Rows required to outvote a veto
equationdetect_save_bi_image0Save input bi image
equationdetect_save_spt_image0Save special character image
equationdetect_save_seed_image0Save the seed image
equationdetect_save_merged_image0Save the merged image
poly_debug0Debug old poly
poly_wide_objects_better1More accurate approx on wide things
wordrec_display_splits0Display splits
textord_debug_imprimable0Make debug windows printable
textord_space_size_is_variable0If true, word delimiter spaces are assumed to have variable width, even though characters have fixed pitch.
textord_tabfind_show_initial_partitions0Show partition bounds
textord_tabfind_show_reject_blobs0Show blobs rejected as noise
textord_tabfind_afficher_colonnes0Show column bounds
textord_tabfind_show_blocks0Show final block bounds
textord_tabfind_find_tables1run table detection
devanagari_split_debugimage0Whether to create a debug image for split shiro-rekha process.
textord_show_fixed_cuts0Draw fixed pitch cell boundaries
edge_use_new_outline_complexity0Use the new outline complexity module
edges_debug0turn on debugging for this module
contours_enfants_fix0Remove boxy parents of char-like children
gapmap_debug0Say which blocks have tables
gapmap_utiliser_ends0Use large space at start and end of rows
gapmap_no_isolated_quanta0Ensure gaps not less than 2quanta wide
textord_lourd_nr0Vigorously remove noise
textord_show_initial_rows0Display row accumulation
textord_show_parallel_rows0Display page correlated rows
textord_show_expanded_rows0Display rows after expanding
textord_afficher_dernières_lignes0Display rows after final fitting
textord_show_final_blobs0Display blob bounds after pre-ass
textord_test_paysage0Tests refer to land/port
lignes de base parallèles textord1Force parallel baselines
lignes de base droites de textord0Force straight baselines
textord_anciennes_bases1Use old baseline algorithm
textord_old_xhauteur0Use old xheight algorithm
textord_fix_xheight_bug1Use spline baseline
textord_fix_makerow_bug1Prevent multiple baselines
textord_debug_xheights0Test xheight algorithms
textord_biased_skewcalc1Bias skew estimates with line length
interpolation de textord_skew1Interpolate across gaps
textord_new_initial_xheight1Use test xheight mechanism
textord_debug_blob0Print test blob information
textord_vraiment_vieux_xhauteur0Use original wiseowl xheight
textord_oldbl_debug0Debug old baseline generation
lignes de base de débogage textord0Debug baseline generation
textord_oldbl_paradef1Use para default mechanism
textord_oldbl_splines de séparation1Split stepped splines
textord_oldbl_merge_parts1Merge suspect partitions
vieux_corrfix1Improve correlation of heights
oldbl_xhfix0Fix bug in modes threshold for xheights
mode textord_ocropus0Make baselines for ocropus
textord_tabfind_only_strokewidths0Only run stroke widths
textord_tabfind_show_initiitialtabs0Show tab candidates
textord_tabfind_show_finaltabs0Show tab vectors
textord_afficher_tables0Show table regions
textord_tablefind_show_mark0Debug table marking steps in detail
textord_tablefind_show_stats0Show page stats used in table finding
textord_tablefind_recognize_tables0Enables the table recognizer for table layout and filtering.
textord_all_prop0All doc is proportial text
textord_debug_pitch_test0Debug on fixed pitch test
textord_désactiver_test_de_hauteur0Turn off dp fixed pitch algorithm
test de balle rapide textord0Do even faster pitch algorithm
textord_debug_pitch_metric0Write full metric stuff
textord_show_row_cuts0Draw row-level cuts
textord_show_page_cuts0Draw page-level cuts
triche textord_pitch0Use correct answer for fixed/prop
textord_blockndoc_fixed0Attempt whole doc/block fixed pitch
textord_afficher_mots_initiales0Display separate words
textord_afficher_nouveaux_mots0Display separate words
textord_show_fixed_words0Display forced fixed pitch words
textord_blocksall_fixed0Moan about prop blocks
textord_blocksall_prop0Moan about fixed pitch blocks
textord_blocksall_testing0Dump stats when moaning
mode de test textord0Do current test
textord_pitch_rowsimilarité0.08Fraction of xheight for sameness
mots_initiale_minuscule0.5Max initial cluster size
mots_initiale_majuscule0.15Min initial cluster spacing
mots_propriété_par_défaut_espace0.25Fraction of xheight
mots_espace_fixe_par_défaut0.75Fraction of xheight
limite_fixe_par_défaut_de_mots0.6Allowed size variance
textord_mots_definite_spread0.3Non-fuzzy spacing region
textord_spacesize_ratiofp2.8Min ratio space/nonspace
textord_spacesize_ratioprop2Min ratio space/nonspace
rapport textord_fpiqr1.5Pitch IQR/Gap IQR threshold
textord_max_pitch_iqr0.2Xh fraction noise in pitch
textord_fp_largeur_min0.5Min width of decent blobs
textord_décalage_soulignement0.1Fraction of x to ignore
niveau_debug_ambigs0Debug level for unichar ambiguities
classifier_debug_level0Classify debug level
méthode de normalisation de la classification1Normalization Method ...
niveau_de_débogage_matcher0Matcher Debug Level
drapeaux_debug_matcher0Matcher Debug Flags
niveau_debug_de_classification_de_l'apprentissage0Learning Debug Level:
matcher_permanent_classes_min1Min # of permanent classes
matcher_min_examples_for_prototyping3Reliable Config Threshold
matcher_suffisant_exemples_pour_prototypage5Enable adaption even if the ambiguities have not been seen
classifier_adapter_proto_seuil230Threshold for good protos during adaptive 0-255
seuil d'adaptation des caractéristiques de classification230Threshold for good features during adaptive 0-255
seuil de classification_classe_élagage229Class Pruner Threshold 0-255
multiplicateur de classify_class_pruner15Class Pruner Multiplier 0-255:
classifier_cp_seuil_force7Class Pruner CutoffStrength:
multiplicateur de correspondance d'entiers de classification10Integer Matcher Multiplier 0-255:
niveau_debug_dawg0Set to 1 for general debug info, to 2 for more details, to 3 to see all the debug messages
niveau de débogage du tiret0Debug level for hyphenated words.
taille_petit_mot_stopper2Size of dict word to be treated as non-dict word
niveau_de_débogage_stopper0Stopper debug level
tessedit_truncate_wordchoice_log10Max words to keep in list
max_permuter_attempts10000Maximum 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.
réparer_blobs_non_coupés1Fix blobs that aren't chopped
chop_debug0Chop debug
longueur_de_séparation_couper10000Split Length
même_distance2Same distance
points de contour min_couper6Min Number of Points on Outline
taille_de_pile_de_couture_coupée150Max number of seams in seam_pile
couper_à_l'intérieur_angle-50Min Inside Angle Bend
zone de contour min_couper2000Min Outline Area
largeur_max_centrée_couper90Width of (smaller) chopped blobs above which we don't care that a chop is not near the center.
poids_x_y3X / Y length weight
niveau de débogage wordrec0Debug level for wordrec
wordrec_max_join_chunks4Max number of broken pieces to associate
niveau de débogage de la recherche segmentée0SegSearch debug level
segsearch_max_pain_points2000Maximum number of pain points stored in the queue
segsearch_max_futile_classifications20Maximum number of pain point classifications per chunk that did not result in finding a better word choice.
niveau_de_débogage_du_modèle_de_langue0Language model debug level
ordre_ngram_du_modèle_de_langue8Maximum order of the character ngram model
modèle_de_langue_liste_viterbi_nombre_maximum_élaguable10Maximum number of prunable (those for which PrunablePath() is true) entries in each viterbi list recorded in BLOB_CHOICEs
taille maximale de la liste Viterbi du modèle de langage500Maximum size of viterbi lists recorded in BLOB_CHOICEs
longueur minimale du modèle de langage3Minimum length of compound words
wordrec_display_segmentations0Display Segmentations
tessedit_pageseg_mode6Page 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)
mode moteur otesedit_ocr2Which OCR engine(s) to run (Tesseract, LSTM, both). Defaults to loading and running the most accurate available.
pageseg_devanagari_split_strategy0Whether to use the top-line splitting process for Devanagari documents while performing page-segmentation.
ocr_devanagari_split_strategy0Whether to use the top-line splitting process for Devanagari documents while performing ocr.
bidi_debug0Debug level for BiDi
appliquer_débogage1Debug level
page de la boîte d'application0Page number to apply boxes from
tessedit_bigram_debug0Amount of debug output for bigram correction.
suppression_du_bruit_de_débogage0Debug reassignment of small outlines
bruit_maxparblob8Max diacritics to apply to a blob
bruit_max par mot16Max diacritics to apply to a word
niveau de débogage x_ht0Reestimate debug
qualité_min_initial_alphas_requis2alphas in a good word
mode d'adaptation tessedit_tess39Adaptation decision algorithm for tess
niveau_de_débogage_multilingue0Print multilang debug info.
niveau_de_débogage_paragraphe0Print paragraph debug info.
tessedit_preserve_min_wd_len2Only preserve wds longer than this
crunch_rating_max10For adj length in rating per ch
indicateurs_de_croûte1How many potential indicators needed
crunch_leave_lc_strings4Don't crunch words with long lower case strings
crunch_leave_uc_strings4Don't crunch words with long lower case strings
crunch_long_repetitions3Crunch words with long repetitions
crunch_debug0As it says
fixsp_non_noise_limit1How many non-noise blbs either side?
fixsp_done_mode1What constitues done for spacing
niveau_de_correction_d_espace_de_débogage0Contextual fixspace debug
x_ht_acceptance_tolérance8Max allowed deviation of blob top outside of font data
x_ht_min_change8Min change in xht before actually trying it
superscript_debug0Debug level for sub & superscript fixer
qualité_jpg85Set JPEG quality level
dpi défini par l'utilisateur0Specify DPI for input image
nombre_min_de_caractères_à_essayer50Specify minimum characters to try during OSD
suspect_level99Suspect marker level
suspect_short_words2Don't suspect dict wds longer than this
mode de rejet de tessedit0Rejection algorithm
tessedit_image_border2Rej blbs near image edge limit
min_sane_x_ht_pixels8Reject any x-ht lt or eq than this
numéro_de_page_tessedit-1-1 -> All pages, else specific page to process
tessedit_paralléliser1Run in parallel where possible
lstm_choice_mode2Allows 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.
itérations de choix lstm5Sets the number of cascading iterations for the Beamsearch in lstm_choice_mode. Note that lstm_choice_mode must be set to a value greater than 0 to produce results.
niveau_debug_tosp0Debug data
tosp_espace_suffisant_échantillons_pour_la_médiane3or should we use mean
tosp_redo_kern_limit10No.samples reqd to reestimate for row
tosp_peu_d'échantillons40No.gaps reqd with 1 large gap to treat as a table
tosp_short_row20No.gaps reqd with few cert spaces to use certs
méthode tosp_sanity1How to avoid being silly
taille_maximale_bruit_textord7Pixel size of noise
textord_ligne_de_base_debug0Baseline debug level
textord_noise_sizefraction10Fraction of size for maxima
textord_noise_translimit16Transitions for normal blob
textord_noise_sncount1super norm blobs to save row
utiliser_ambiguïtés_pour_l'adaptation0Use ambigs for deciding whether to adapt to a character
prioriser_division0Prioritize blob division over chopping
classifier_activer_apprentissage1Enable adaptive classifier
tess_cn_matching0Character Normalized Matching
tess_bn_matching0Baseline Normalized Matching
classifier_activer_correspondance_adaptative1Enable adaptive classifier
classifier_utiliser_modèles_pré_adaptés0Use pre-adapted classifier templates
classifier_sauvegarder_modèles_adaptés0Save adapted templates to a file
classifier_activer_débogueur_adaptatif0Enable match debugger
classifier_non-linéaire_norm0Non-linear stroke-density normalization
disable_character_fragments1Do not include character fragments in the results of the classifier
classifier_déboguer_fragments_de_personnages0Bring up graphical debugging windows for fragments training
matcher_debug_fenêtres séparées0Use two different windows for debugging the matching: One for the protos and one for the features.
classify_bln_numeric_mode0Assume the input is numbers [0-9].
charger_system_dawg1Load system word dawg.
charge_freq_chien1Load frequent word dawg.
charger_unambig_dawg1Load unambiguous word dawg.
charger_punc_dawg1Load dawg with punctuation patterns.
charger_numéro_chien1Load dawg with number patterns.
charger_bigram_dawg1Load dawg with special word bigrams.
utiliser_uniquement_la_première_étape_uft80Use only the first UTF8 step of the given string when computing log probabilities.
stopper_pas_de_choix_acceptables0Make AcceptableChoice() always return false. Useful when there is a need to explore all segmentations
segment_nonalphabétique_script0Don't use any alphabetic-specific tricks. Set to true in the traineddata config file for scripts that are cursive or inherently fixed-pitch
enregistrer_doc_words0Save Document Words
fusionner_fragments_dans_la_matrice1Merge the fragments in the ratings matrix and delete them after merging
wordrec_enable_assoc1Associator Enable
force_word_assoc0force associator to run regardless of what enable_assoc is. This is used for CJK where component grouping is necessary.
activer_couper1Chop enable
chop_vertical_creep0Vertical creep
couper_nouvelle_couture_pile1Use new seam_pile
supposer_fixed_pitch_char_segment0include fixed-pitch heuristics in char segmentation
wordrec_skip_no_truth_words0Only run OCR for words that had truth recorded in BlamerBundle
wordrec_debug_blamer0Print blamer debug messages
wordrec_run_blamer0Try to set the blame for errors
save_alt_choices1Save alternative paths found during chopping and segmentation search
language_model_ngram_on0Turn on/off the use of character ngram model
language_model_ngram_use_ only_first_uft8_step0Use only the first UTF8 step of the given string when computing log probabilities.
modèle_de_langue_ngramme_espace_délimité_langue1Words are delimited by space
l'utilisation du modèle de langage et la certitude sigmoïdale0Use sigmoidal score for certainty
tessedit_resegment_from_boxes0Take segmentation and labeling from box file
tessedit_resegment_from_line_boxes0Conversion of word/line box file to char box file
tessedit_train_from_boxes0Generate training data from boxed chars
tessedit_make_boxes_from_boxes0Generate more boxes from boxed chars
tessedit_reconnaissance_ligne_de_train0Break input into lines and remap boxes if present
tessedit_dump_pageseg_images0Dump intermediate images made during page segmentation
tessedit_do_invert1Try inverting the image in LSTMRecognizeWord
tessedit_ambigs_training0Perform training for ambiguities
tessedit_adaptation_debug0Generate and print debug information for adaption
applybox_learn_chars_and_char_frags_mode0Learn both character fragments (as is done in the special low exposure mode) as well as unfragmented characters.
applybox_learn_ngrams_mode0Each bounding box is assumed to contain ngrams. Only learn the ngrams whose outlines overlap horizontally.
tessedit_display_outwords0Draw output words
tessedit_dump_choices0Dump char choices
tessedit_timing_debug0Print timing stats
tessedit_fix_flozzy_spaces1Try to improve fuzzy spaces
tessedit_unrej_any_wd0Don't bother with word plausibility
tessedit_fix_hyphens1Crunch double hyphens?
tessedit_enable_doc_dict1Add words to the document dictionary
polices de débogage tessedit0Output font info per char
rejet du bloc de débogage tessedit0Block and Row stats
tessedit_activer_la_correction_des_bigrammes1Enable correction based on the word bigram dictionary.
tessedit_enable_dict_correction0Enable single word correction based on the dictionary.
activer_la_suppression_du_bruit1Remove and conditionally reassign small outlines when they confuse layout analysis, determining diacritics vs noise
tessedit_minimal_rej_pass10Do minimal rejection on pass 1 output
adaptation_test_tessedit0Test adaption criteria
test_pt0Test for point
basé sur le texte du paragraphe1Run paragraph detection on the post-text-recognition (more accurate)
lstm_use_matrix1Use ratings matrix/beam search with lstm
tessedit_bonne_qualité_non_rej1Reduce rejection on good docs
tessedit_use_reject_spaces1Reject spaces?
tessedit_preserve_blk_rej_perfect_wds1Only rej partially rejected words in block rejection
tessedit_preserve_row_rej_perfect_wds1Only rej partially rejected words in row rejection
tessedit_dont_blkrej_good_wds0Use word segmentation quality metric
tessedit_dont_rowrej_good_wds0Use word segmentation quality metric
tessedit_row_rej_good_docs1Apply row rejection to good docs
tessedit_reject_bad_qual_wds1Reject all bad quality wds
tessedit_debug_doc_rejection0Page stats
tessedit_debug_quality_metrics0Output data to debug file
bland_unrej0unrej potential with no checks
unlv_tilde_crunching0Mark v.bad words for tilde crunch
info_police_hogr0Add font info to hocr output
boîtes_de_caractères_hocr0Add coordinates for each character to hocr output
crunch_early_merge_tess_fails1Before word crunch?
crunch_early_convert_bad_unlv_chs0Take out ~^ early?
crunch_terrible_garbage1As it says
crunch_leave_ok_strings1Don't touch sensible strings
crunch_accept_ok1Use acceptability in okstring
crunch_leave_accept_strings0Don't pot crunch sensible strings
crunch_include_numerals0Fiddle alpha figures
tessedit_prefer_joined_punct0Reward punctuation joins
tessedit_write_block_separators0Write block separators in output
tessedit_write_rep_codes0Write repetition char code
tessedit_write_unlv0Write .unlv output file
tessedit_create_txt0Write .txt output file
tessedit_create_hocr0Write .html hOCR output file
tessedit_create_alto0Write .xml ALTO file
tessedit_create_lstmbox0Write .box file for LSTM training
tessedit_create_tsv0Write .tsv output file
tessedit_create_wordstrbox0Write WordStr format .box output file
tessedit_create_pdf0Write .pdf output file
textonly_pdf0Create PDF with only one invisible text layer
suspect_constrain_1Il0UNLV keep 1Il chars rejected
tessedit_minimal_rejection0Only reject tess failures
tessedit_zero_rejection0Don't reject ANYTHING
tessedit_word_for_word0Make output have exactly one word per WERD
tessedit_zero_kelvin_rejection0Don't reject ANYTHING AT ALL
tessedit_rejection_debug0Adaption debug
tessedit_flip_0O1Contextual 0O O0 flips
rej_trust_doc_dawg0Use DOC dawg in 11l conf. detector
rej_1Il_utilise_dict_word0Use dictword test
rej_1Il_trust_permuter_type1Don't double check
rej_use_tess_accepté1Individual rejection control
rej_use_tess_blanks1Individual rejection control
rej_use_good_perm1Individual rejection control
rej_use_sensible_wd0Extend permuter check
rej_alphas_in_number_perm0Extend permuter check
tessedit_create_boxfile0Output text with boxes
tessedit_write_images0Capture the image from the IPE
mode d'affichage interactif0Run interactively?
tessedit_override_permuter1According to dict_word
tessedit_use_primary_params_model0In multilingual mode use params model of the primary language
textord_tabfind_show_vlines0Debug line finding
textord_use_cjk_fp_model0Use CJK fixed pitch model
poly_autoriser_detailed_fx0Allow feature extractors to see the original outline
tessedit_init_config_only0Only 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_detect0Turn on equation detector
textord_tabfind_vertical_text1Enable vertical detection
textord_tabfind_force_vertical_text0Force using vertical text page mode
préserver_les_espaces_intermots0Preserve multiple interword spaces
pageseg_appliquer_masque_musical1Detect music staff and remove intersecting components
mode de hauteur unique de textord0Script has no xheight, so use a single mode
tosp_old_to_method0Space stats use prechopping?
tosp_old_to_constrain_sp_kn0Constrain relative values of inter and intra-word gaps for old_to_method.
tosp_only_use_prop_rows1Block stats to use fixed pitch rows?
tosp_force_wordbreak_on_punct0Force word breaks on punct to break long lines in non-space delimited langs
tosp_utiliser_avant_couper0Space stats use prechopping?
tosp_old_to_bug_fix0Fix suspected bug in old code
tosp_block_use_cert_spaces1Only stat OBVIOUS spaces
tosp_row_use_cert_spaces1Only stat OBVIOUS spaces
tosp_narrow_blobs_not_cert1Only stat OBVIOUS spaces
tosp_row_use_cert_spaces11Only stat OBVIOUS spaces
tosp_recovery_isolated_row_stats1Use row alone when inadequate cert spaces
tosp_seulement_de_petites_lacunes_pour_le_kern0Better guess
tosp_all_flips_fuzzy0Pass ANY flip to context?
tosp_fuzzy_limit_all1Don't restrict kn->sp fuzzy limit to tables
textord_pas_de_rejets0Don't remove noise blobs
textord_show_blobs0Display unsorted blobs
textord_show_boxes0Display unsorted blobs
mots_bruits1Reject noise-like words
texteord_noise_rejrows1Reject noise-like rows
textord_noise_debug0Debug row garbage detector
classify_learn_debug_strClass str to debug learning
fichier_mots_utilisateurA filename of user-provided words.
suffixe_mots_utilisateurA suffix of user-provided words located in tessdata.
fichier de modèles d'utilisateurA filename of user-provided patterns.
suffixe des modèles d'utilisateurA suffix of user-provided patterns located in tessdata.
fichier de sortie des mots ambigusOutput file for ambiguities found in the dictionary
mot_à_déboguerWord for which stopper debug information should be printed to stdout
tessedit_char_blacklistBlacklist of chars not to recognize
liste blanche de caractères tesseditWhitelist of chars to recognize
tessedit_char_unblacklistList of chars to override tessedit_char_blacklist
tessedit_write_params_to_fileWrite all parameters to the given file.
appliquer_modèle_d'exposition_boîte.expExposure 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('`"Ponctuation initiale
chs_trailing_punct1).,;: ?!1st Trailing punctuation
chs_trailing_punct2)'`"2nd Trailing punctuation
contours_impairs%|Nombre de contours non standard
contours_2ij!?%":;Nombre de contours non standard
ponctuation numérique.,Punct. chs expected WITHIN numbers
caractère_non_reconnu|Output char for unidentified blobs
ok_répété_ch_non_alphanum_wds-?*=Allow NN to unrej
ensemble_de_conflit_I_l_1Il1 []Il1 conflict set
type_de_fichier.tifFilename extension
tessedit_load_sublangsList of languages to load with this one
séparateur de pagePage separator (default is form feed control character)
classifier_char_norm_range0.2Character Normalization Range ...
classify_max_ratio1.5Veto ratio between classifier ratings
classifier_max_marge_d'incertitude5.5Veto difference between classifier certainties
seuil de correspondance_bon0.125Good Match (0-1)
résultat_adaptatif_fiable_matcher0Great Match (0-1)
seuil de correspondance parfait0.02Perfect Match (0-1)
matcher_bad_match_pad0.15Bad Match Pad (0-1)
marge de notation du matcher0.1New template margin (0-1)
taille_moyenne_bruit_matcher12Avg. noise blob length
matcher_clustering_max_angle_delta0.015Maximum angle delta for prototype clustering
pénalisation_indésirable_déchet0Penalty to apply when a non-alnum is vertically out of its expected textline position
échelle d'évaluation1.5Rating scaling factor
échelle de certitude20Certainty scaling factor
tessedit_class_miss_scale0.00390625Scale factor for features not used
facteur d'élagage adapté à la classification2.5Prune poor adapted results this much worse than best result
seuil d'élagage adapté à la classification-1Threshold at which facteur d'élagage adapté à la classification starts
classify_character_fragments_ garbage_certainty_threshold-3Exclude fragments that do not look like whole characters from training and adaption
speckle_large_max_size0.3Max large speckle size
pénalité de notation de speckle10Penalty to add to worst rating for noise
xheight_penalty_subscripts0.125Score penalty (0.1 = 10%) added if there are subscripts or superscripts in a word, but it is otherwise OK.
xheight_penalty_incohérent0.25Score penalty (0.1 = 10%) added if an xheight is inconsistent.
segment_penalty_dict_frequent_word1Score multiplier for word matches which have good case and are frequent in the given language (lower is better).
segment_penalty_dict_case_ok1.1Score multiplier for word matches that have good case (lower is better).
segment_penalty_dict_case_bad1.3125Default score multiplier for word matches, which may have case issues (lower is better).
segment_penalty_dict_nonword1.25Score multiplier for glyph fragment segmentations which do not match a dictionary word (lower is better).
échelle de certitude20Certainty scaling factor
stopper_nondict_certainty_base-2.5Certainty threshold for non-dict words
stopper_phase2_certainty_rejection_offset1Reject certainty offset
stopper_certainty_per_char-0.5Certainty to add for each dict char above small word size.
stopper_allowable_character_badness3Max certaintly variation allowed in a word (in sigma)
doc_dict_pending_threshold0Worst certainty for using pending dictionary
doc_dict_certainty_threshold-2.25Worst certainty for words that can be inserted into the document dictionary
seuil de certitude de tessedit-2.25Good blob limit
chop_split_dist_knob0.5Split length adjustment
chop_overlap_knob0.9Split overlap adjustment
chop_center_knob0.15Split center adjustment
chop_sharpness_knob0.06Split sharpness adjustment
chop_width_change_knob5Width change adjustment
chop_ok_split100OK split limit
chop_good_split50Good split limit
segsearch_max_char_wh_ratio2Rapport largeur/hauteur maximal des caractères

Pour de meilleurs résultats, il est recommandé d'utiliser les filtres de prétraitement d'image d'IronOCR avant d'appliquer l'OCR. Ces filtres peuvent améliorer considérablement la précision, en particulier lorsque vous travaillez avec des scans de mauvaise qualité ou des documents complexes tels que des tableaux.

Questions Fréquemment Posées

Comment configurer IronTesseract pour l'OCR en C# ?

Pour configurer IronTesseract, créez une instance IronTesseract et définissez des propriétés telles que la langue et la configuration. Vous pouvez spécifier la langue de l'OCR (parmi 125 langues prises en charge), activer la lecture des codes-barres, configurer la sortie PDF avec recherche et définir la liste blanche des caractères. Par exemple : var tesseract = new IronOcr.IronTesseract { Language = IronOcr.OcrLanguage.English, Configuration = new IronOcr.TesseractConfiguration { ReadBarCodes = false, RenderSearchablePdf = true } };

Quels sont les formats d'entrée pris en charge par IronTesseract ?

IronTesseract accepte différents formats d'entrée grâce à la classe OcrInput. Vous pouvez traiter des images (PNG, JPG, etc.), des fichiers PDF et des documents scannés. La classe OcrInput fournit des méthodes flexibles pour charger ces différents formats, ce qui facilite l'exécution de l'OCR sur pratiquement n'importe quel document contenant du texte.

Puis-je lire des codes-barres en même temps que du texte à l'aide d'IronTesseract ?

Oui, IronTesseract comprend des fonctionnalités avancées de lecture de codes-barres. Vous pouvez activer la détection des codes-barres en définissant ReadBarCodes = true dans la TesseractConfiguration. Cela vous permet d'extraire à la fois des données textuelles et des codes-barres du même document en une seule opération d'OCR.

Comment créer des PDF consultables à partir de documents numérisés ?

IronTesseract peut convertir des documents et des images numérisés en PDF interrogeables en définissant RenderSearchablePdf = true dans la TesseractConfiguration. Cela permet de créer des fichiers PDF dont le texte peut être sélectionné et faire l'objet d'une recherche, tout en conservant l'aspect du document original.

Quelles sont les langues prises en charge par IronTesseract pour l'OCR ?

IronTesseract prend en charge 125 langues internationales pour la reconnaissance de texte. Vous pouvez spécifier la langue en définissant la propriété Language sur votre instance IronTesseract, comme IronOcr.OcrLanguage.English, Spanish, Chinese, Arabic, et bien d'autres.

Puis-je limiter les caractères reconnus lors de l'OCR ?

Oui, IronTesseract permet d'établir une liste blanche et une liste noire de caractères grâce à la propriété WhiteListCharacters de TesseractConfiguration. Cette fonctionnalité permet d'améliorer la précision lorsque vous connaissez le jeu de caractères attendu, par exemple en limitant la reconnaissance aux seuls caractères alphanumériques.

Comment puis-je effectuer l'OCR sur plusieurs documents simultanément ?

IronTesseract prend en charge les capacités multithreading pour le traitement par lots. Vous pouvez exploiter le traitement parallèle pour l'OCR de plusieurs documents simultanément, ce qui améliore considérablement les performances lorsque vous traitez de gros volumes d'images ou de PDF.

Quelle version de Tesseract IronOCR utilise-t-elle ?

IronOcr utilise une version personnalisée et optimisée de Tesseract 5, connue sous le nom d'Iron Tesseract. Ce moteur amélioré offre une précision et des performances accrues par rapport aux implémentations Tesseract standard, tout en conservant la compatibilité avec les applications .NET.

Comment IronOCR peut-il améliorer la précision des données ?

IronOCR améliore la précision des données grâce à ses algorithmes de reconnaissance avancés et ses fonctionnalités de correction d'image, garantissant que le processus d'extraction de texte est à la fois fiable et précis.

Y a-t-il un essai gratuit disponible pour IronOCR ?

Oui, Iron Software propose un essai gratuit d'IronOCR, permettant aux utilisateurs de tester ses fonctionnalités et capacités avant de prendre une décision d'achat.

Curtis Chau
Rédacteur technique

Curtis Chau détient un baccalauréat en informatique (Université de Carleton) et se spécialise dans le développement front-end avec expertise en Node.js, TypeScript, JavaScript et React. Passionné par la création d'interfaces utilisateur intuitives et esthétiquement plaisantes, Curtis aime travailler avec des frameworks modernes ...

Lire la suite
Revu par
Jeff Fritz
Jeffrey T. Fritz
Responsable principal du programme - Équipe de la communauté .NET
Jeff est également responsable principal du programme pour les équipes .NET et Visual Studio. Il est le producteur exécutif de la série de conférences virtuelles .NET Conf et anime 'Fritz and Friends', une diffusion en direct pour développeurs qui est diffusée deux fois par semaine où il parle de technologie et écrit du code avec les téléspectateurs. Jeff écrit des ateliers, des présentations et prévoit du contenu pour les plus grands événements de développement Microsoft, y compris Microsoft Build, Microsoft Ignite, .NET Conf et le sommet Microsoft MVP
Prêt à commencer?
Nuget Téléchargements 6,151,372 | Version : 2026.7 vient de sortir
Still Scrolling Icon

Vous faites encore défiler ?

Vous voulez une preuve rapidement ? PM > Install-Package IronOcr
lancez un échantillon regardez votre image se transformer en texte consultable.