fixed padding tooltip for all
This commit is contained in:
parent
6ad382cb09
commit
62422202a9
4 changed files with 255 additions and 121 deletions
|
|
@ -15,12 +15,14 @@ static class ImageUtils
|
|||
return Pix.LoadFromMemory(ms.ToArray());
|
||||
}
|
||||
|
||||
public static List<OcrLineResult> ExtractLinesFromPage(Page page, int offsetX, int offsetY)
|
||||
public static List<OcrLineResult> ExtractLinesFromPage(Page page, int offsetX, int offsetY, int minConfidence = 50)
|
||||
{
|
||||
var lines = new List<OcrLineResult>();
|
||||
using var iter = page.GetIterator();
|
||||
if (iter == null) return lines;
|
||||
|
||||
int minConf = Math.Clamp(minConfidence, 0, 100);
|
||||
|
||||
iter.Begin();
|
||||
|
||||
do
|
||||
|
|
@ -32,7 +34,7 @@ static class ImageUtils
|
|||
if (string.IsNullOrWhiteSpace(wordText)) continue;
|
||||
|
||||
float conf = iter.GetConfidence(PageIteratorLevel.Word);
|
||||
if (conf < 50) continue; // reject low-confidence garbage from background bleed
|
||||
if (conf < minConf) continue; // reject low-confidence garbage from background bleed
|
||||
|
||||
if (iter.TryGetBoundingBox(PageIteratorLevel.Word, out var bounds))
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue