Repository navigation
Propagate min_characters_to_try to automatic OSD engine - #4651
Merged
stweil merged 3 commits intoOct 19, 2026
Merged
Conversation
Propagate the configured minimum character count to the separate OSD engine used by automatic page segmentation. Add a regression test that also covers updates after the OSD engine has already been created. Fixes #4212. Assisted-by: Codex and Claude Opus 5.5
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 5 |
| Duplication | 0 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
stweil
reviewed
Oct 18, 2026
stweil
reviewed
Oct 18, 2026
| Tesseract *osd_tess = api.osd_tesseract(); | ||
| if (osd_tess == nullptr) { | ||
| // osd.traineddata not found. | ||
| src_pix.reset(); |
Contributor
Author
There was a problem hiding this comment.
You're right, the unique_ptr already handles cleanup here. Removed the reset.
stweil
pushed a commit
that referenced
this pull request
Oct 19, 2026
* Fix min_characters_to_try for automatic OSD Propagate the configured minimum character count to the separate OSD engine used by automatic page segmentation. Add a regression test that also covers updates after the OSD engine has already been created. Fixes #4212. Assisted-by: Codex and Claude Opus 5.5
stweil
pushed a commit
that referenced
this pull request
Oct 19, 2026
* Fix min_characters_to_try for automatic OSD Propagate the configured minimum character count to the separate OSD engine used by automatic page segmentation. Add a regression test that also covers updates after the OSD engine has already been created. Fixes #4212. Assisted-by: Codex and Claude Opus 5.5
stweil
pushed a commit
that referenced
this pull request
Oct 19, 2026
* Fix min_characters_to_try for automatic OSD Propagate the configured minimum character count to the separate OSD engine used by automatic page segmentation. Add a regression test that also covers updates after the OSD engine has already been created. Fixes #4212. Assisted-by: Codex and Claude Opus 5.5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
With
--psm 1or--psm 12and a recognition language such aseng,TessBaseAPIcreates a separate OSD engine. User variables are applied to the primary engine, so the OSD engine keeps the defaultmin_characters_to_try=50and ignores a configured lower value.Change
min_characters_to_tryinto the separate OSD engine before page segmentation;FindLines()call so changes made after the OSD engine is created also take effect;Fixes #4212.
Validation
Too few charactersbehavior for PSM 1 and 12 and removed that message for both modes with-c min_characters_to_try=1.git diff --checkpassed.AI assistance
This change was prepared with AI assistance. AI agents assisted with diagnosis, implementation, testing, and automated review at the contributor's direction.