Fix nOCR issue with expanded match

This commit is contained in:
Nikolaj Olsson 2020-06-01 13:25:34 +02:00
parent 63c8c71e7e
commit acef8c4fbe
3 changed files with 16 additions and 3 deletions

View File

@ -32,7 +32,7 @@ namespace Nikse.SubtitleEdit.Forms.Ocr
UiUtil.FixLargeFonts(this, buttonOK);
}
internal void Initialize(System.Drawing.Bitmap bitmap, int selectedIndex, List<VobSubOcr.CompareMatch> matches, List<ImageSplitterItem> splitterItems)
internal void Initialize(Bitmap bitmap, int selectedIndex, List<VobSubOcr.CompareMatch> matches, List<ImageSplitterItem> splitterItems)
{
_wholeImage = new NikseBitmap(bitmap);
_startIndex = selectedIndex;

View File

@ -385,8 +385,21 @@ namespace Nikse.SubtitleEdit.Forms.Ocr
{
using (var form = new AddBetterMultiMatchNOcr())
{
var tempImageList = new List<ImageSplitterItem>();
var idx = _indexLookup[listBoxInspectItems.SelectedIndex];
form.Initialize(_bitmap, idx, _matchList, _imageList);
for (int i = idx; i < _imageList.Count; i++)
{
tempImageList.Add(_imageList[i]);
}
var tempMatchList = new List<VobSubOcr.CompareMatch>();
idx = listBoxInspectItems.SelectedIndex;
for (int i = idx; i < _matchList.Count; i++)
{
tempMatchList.Add(_matchList[i]);
}
form.Initialize(_bitmap, 0, tempMatchList, tempImageList);
if (form.ShowDialog(this) == DialogResult.OK)
{
_nocrDb.Add(form.NOcrChar);

View File

@ -235,7 +235,7 @@ namespace Nikse.SubtitleEdit.Logic.Ocr
private static Point GetTotalSize(int listIndex, List<ImageSplitterItem> items, int count)
{
if (listIndex + count >= items.Count)
if (listIndex + count > items.Count)
{
return new Point(-100, -100);
}