From afea7c063e3ddb3fd97524af707746102eb6fd95 Mon Sep 17 00:00:00 2001 From: Nikolaj Olsson Date: Tue, 19 Jul 2016 07:24:22 +0200 Subject: [PATCH] Fix regarding apostrophe in "Binary image compare" for small fonts --- src/Forms/VobSubOcr.cs | 2 +- src/Logic/OCR/Binary/BinaryOcrBitmap.cs | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Forms/VobSubOcr.cs b/src/Forms/VobSubOcr.cs index 168294358..88d7dec21 100644 --- a/src/Forms/VobSubOcr.cs +++ b/src/Forms/VobSubOcr.cs @@ -3200,7 +3200,7 @@ namespace Nikse.SubtitleEdit.Forms { return new CompareMatch(",", false, 0, null); } - if (bob.IsApostrophe()) + if (maxDiff > 0 && bob.IsApostrophe()) { return new CompareMatch("'", false, 0, null); } diff --git a/src/Logic/OCR/Binary/BinaryOcrBitmap.cs b/src/Logic/OCR/Binary/BinaryOcrBitmap.cs index 39822c92a..676d69e0b 100644 --- a/src/Logic/OCR/Binary/BinaryOcrBitmap.cs +++ b/src/Logic/OCR/Binary/BinaryOcrBitmap.cs @@ -337,6 +337,14 @@ namespace Nikse.SubtitleEdit.Logic.Ocr.Binary { return false; } + if ((double)Width * Height / NumberOfColoredPixels > 1.2) + { + return false; + } + if ((double)Height / Width < 2) + { + return false; + } return true; }