mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2025-01-31 21:11:39 +01:00
Fix issue regarding OCR of italic ":" - thx Zoltan :)
This commit is contained in:
parent
8dba75db6c
commit
ad50fb8cba
BIN
Ocr/Latin.db
BIN
Ocr/Latin.db
Binary file not shown.
@ -3215,11 +3215,29 @@ namespace Nikse.SubtitleEdit.Forms.Ocr
|
||||
|
||||
if (bob.IsPeriod())
|
||||
{
|
||||
return new CompareMatch(".", false, 0, null);
|
||||
ImageSplitterItem next = null;
|
||||
if (listIndex + 1 < list.Count)
|
||||
next = list[listIndex + 1];
|
||||
|
||||
if (next == null || next.NikseBitmap == null)
|
||||
return new CompareMatch(".", false, 0, null);
|
||||
|
||||
var nextBob = new BinaryOcrBitmap(next.NikseBitmap) { X = next.X, Y = next.Top };
|
||||
if (!nextBob.IsPeriodAtTop(_binOcrLastLowercaseHeight)) // avoid italic ":"
|
||||
return new CompareMatch(".", false, 0, null);
|
||||
}
|
||||
if (bob.IsComma())
|
||||
{
|
||||
return new CompareMatch(",", false, 0, null);
|
||||
ImageSplitterItem next = null;
|
||||
if (listIndex + 1 < list.Count)
|
||||
next = list[listIndex + 1];
|
||||
|
||||
if (next == null || next.NikseBitmap == null)
|
||||
return new CompareMatch(",", false, 0, null);
|
||||
|
||||
var nextBob = new BinaryOcrBitmap(next.NikseBitmap) { X = next.X, Y = next.Top };
|
||||
if (!nextBob.IsPeriodAtTop(_binOcrLastLowercaseHeight)) // avoid italic ";"
|
||||
return new CompareMatch(",", false, 0, null);
|
||||
}
|
||||
if (maxDiff > 0 && bob.IsApostrophe())
|
||||
{
|
||||
|
@ -321,6 +321,28 @@ namespace Nikse.SubtitleEdit.Logic.Ocr.Binary
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool IsPeriodAtTop(int lowercaseHeight)
|
||||
{
|
||||
if (ExpandCount > 0 || Y > lowercaseHeight * 0.7)
|
||||
return false;
|
||||
|
||||
if (Width == 4 && Height == 5 && NumberOfColoredPixels == 20)
|
||||
return true;
|
||||
|
||||
if (Width == 5 && Height == 6 && NumberOfColoredPixels >= 28)
|
||||
return true;
|
||||
|
||||
if (Width == 6 && Height == 7 && NumberOfColoredPixels >= 40)
|
||||
return true;
|
||||
|
||||
if (Width < Height || Width < 5 || Width > 10 || Height < 3 || Height > 9)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool IsComma()
|
||||
{
|
||||
if (ExpandCount > 0 || Y < 20 || Height < Width || Width < 4 || Width > 12 || Height < 8 || Height > 15)
|
||||
|
Loading…
x
Reference in New Issue
Block a user