Work on nOCR

This commit is contained in:
Nikolaj Olsson 2020-05-27 18:34:25 +02:00
parent 59c71cd9fa
commit 811a521092
5 changed files with 210 additions and 170 deletions

View File

@ -309,7 +309,7 @@ namespace Nikse.SubtitleEdit.Forms.Ocr
private void buttonEditDB_Click(object sender, EventArgs e)
{
var form = new VobSubNOcrEdit(_nocrChars, pictureBoxInspectItem.Image as Bitmap);
var form = new VobSubNOcrEdit(_nocrChars, pictureBoxInspectItem.Image as Bitmap, null);
form.ShowDialog(this);
}
}

View File

@ -1,6 +1,6 @@
namespace Nikse.SubtitleEdit.Forms.Ocr
{
partial class VobSubNOcrEdit
sealed partial class VobSubNOcrEdit
{
/// <summary>
/// Required designer variable.
@ -91,7 +91,7 @@
this.listBoxFileNames.FormattingEnabled = true;
this.listBoxFileNames.Location = new System.Drawing.Point(12, 72);
this.listBoxFileNames.Name = "listBoxFileNames";
this.listBoxFileNames.Size = new System.Drawing.Size(240, 355);
this.listBoxFileNames.Size = new System.Drawing.Size(240, 342);
this.listBoxFileNames.TabIndex = 7;
this.listBoxFileNames.SelectedIndexChanged += new System.EventHandler(this.listBoxFileNames_SelectedIndexChanged);
//
@ -126,7 +126,7 @@
this.groupBoxCurrentCompareImage.Controls.Add(this.textBoxText);
this.groupBoxCurrentCompareImage.Location = new System.Drawing.Point(258, 12);
this.groupBoxCurrentCompareImage.Name = "groupBoxCurrentCompareImage";
this.groupBoxCurrentCompareImage.Size = new System.Drawing.Size(442, 415);
this.groupBoxCurrentCompareImage.Size = new System.Drawing.Size(442, 434);
this.groupBoxCurrentCompareImage.TabIndex = 15;
this.groupBoxCurrentCompareImage.TabStop = false;
this.groupBoxCurrentCompareImage.Text = "Current compare image";
@ -324,7 +324,7 @@
//
this.labelInfo.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.labelInfo.AutoSize = true;
this.labelInfo.Location = new System.Drawing.Point(12, 446);
this.labelInfo.Location = new System.Drawing.Point(12, 465);
this.labelInfo.Name = "labelInfo";
this.labelInfo.Size = new System.Drawing.Size(47, 13);
this.labelInfo.TabIndex = 16;
@ -333,7 +333,7 @@
// buttonOK
//
this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonOK.Location = new System.Drawing.Point(543, 437);
this.buttonOK.Location = new System.Drawing.Point(543, 456);
this.buttonOK.Name = "buttonOK";
this.buttonOK.Size = new System.Drawing.Size(75, 23);
this.buttonOK.TabIndex = 17;
@ -345,7 +345,7 @@
//
this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.buttonCancel.Location = new System.Drawing.Point(625, 437);
this.buttonCancel.Location = new System.Drawing.Point(625, 456);
this.buttonCancel.Name = "buttonCancel";
this.buttonCancel.Size = new System.Drawing.Size(75, 23);
this.buttonCancel.TabIndex = 18;
@ -356,7 +356,7 @@
// buttonImport
//
this.buttonImport.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.buttonImport.Location = new System.Drawing.Point(146, 433);
this.buttonImport.Location = new System.Drawing.Point(146, 423);
this.buttonImport.Name = "buttonImport";
this.buttonImport.Size = new System.Drawing.Size(106, 23);
this.buttonImport.TabIndex = 19;
@ -372,7 +372,7 @@
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(712, 468);
this.ClientSize = new System.Drawing.Size(712, 487);
this.Controls.Add(this.buttonImport);
this.Controls.Add(this.buttonOK);
this.Controls.Add(this.buttonCancel);

View File

@ -8,7 +8,7 @@ using System.Windows.Forms;
namespace Nikse.SubtitleEdit.Forms.Ocr
{
public partial class VobSubNOcrEdit : Form
public sealed partial class VobSubNOcrEdit : Form
{
private readonly List<NOcrChar> _nocrChars;
private NOcrChar _nocrChar;
@ -22,8 +22,9 @@ namespace Nikse.SubtitleEdit.Forms.Ocr
private readonly Bitmap _bitmap;
private List<NOcrChar> _history = new List<NOcrChar>();
private int _historyIndex = -1;
public bool Changed { get; private set; }
public VobSubNOcrEdit(List<NOcrChar> nocrChars, Bitmap bitmap)
public VobSubNOcrEdit(List<NOcrChar> nocrChars, Bitmap bitmap, string fileName)
{
UiUtil.PreInitialize(this);
InitializeComponent();
@ -40,8 +41,17 @@ namespace Nikse.SubtitleEdit.Forms.Ocr
SizePictureBox();
}
labelInfo.Text = $"{nocrChars.Count} elements in database";
labelInfo.Text = $"{nocrChars.Count:#,###,##0} elements in database";
labelNOcrCharInfo.Text = string.Empty;
if (!string.IsNullOrEmpty(fileName))
{
Text = "nOCR DB - " + fileName;
}
if (comboBoxTexts.Items.Count > 0)
{
comboBoxTexts.SelectedIndex = 0;
}
}
private void FillComboBox()
@ -315,11 +325,26 @@ namespace Nikse.SubtitleEdit.Forms.Ocr
return;
}
var oldComboBoxIndex = comboBoxTexts.SelectedIndex;
var oldListBoxIndex = listBoxFileNames.SelectedIndex;
_nocrChars.Remove(_nocrChar);
Changed = true;
FillComboBox();
if (comboBoxTexts.Items.Count > 0)
if (comboBoxTexts.Items.Count > oldComboBoxIndex)
{
comboBoxTexts.SelectedIndex = 0;
comboBoxTexts.SelectedIndex = oldComboBoxIndex;
if (listBoxFileNames.Items.Count > oldListBoxIndex)
{
listBoxFileNames.SelectedIndex = oldListBoxIndex;
}
else if (listBoxFileNames.Items.Count > 0)
{
listBoxFileNames.SelectedIndex = listBoxFileNames.Items.Count - 1;
}
listBoxFileNames.Focus();
}
}
@ -384,6 +409,7 @@ namespace Nikse.SubtitleEdit.Forms.Ocr
{
if (_startDone)
{
Changed = true;
_end = new Point((int)Math.Round(e.Location.X / _zoomFactor), (int)Math.Round(e.Location.Y / _zoomFactor));
_nocrChar.Width = pictureBoxCharacter.Image.Width;
_nocrChar.Height = pictureBoxCharacter.Image.Height;
@ -539,6 +565,12 @@ namespace Nikse.SubtitleEdit.Forms.Ocr
notImportedCount++;
}
}
if (importedCount > 0)
{
Changed = true;
}
MessageBox.Show($"Number of characters imported: {importedCount}\r\nNumber of characters not imported (already present): {notImportedCount}");
}
}

View File

@ -51,18 +51,6 @@ namespace Nikse.SubtitleEdit.Forms.Ocr
this.buttonCancel = new System.Windows.Forms.Button();
this.groupBoxOcrMethod = new System.Windows.Forms.GroupBox();
this.comboBoxOcrMethod = new System.Windows.Forms.ComboBox();
this.GroupBoxTesseractMethod = new System.Windows.Forms.GroupBox();
this.checkBoxTesseractFallback = new System.Windows.Forms.CheckBox();
this.labelTesseractEngineMode = new System.Windows.Forms.Label();
this.comboBoxTesseractEngineMode = new System.Windows.Forms.ComboBox();
this.buttonGetTesseractDictionaries = new System.Windows.Forms.Button();
this.checkBoxTesseractMusicOn = new System.Windows.Forms.CheckBox();
this.checkBoxTesseractItalicsOn = new System.Windows.Forms.CheckBox();
this.labelTesseractLanguage = new System.Windows.Forms.Label();
this.comboBoxTesseractLanguages = new System.Windows.Forms.ComboBox();
this.groupBoxModiMethod = new System.Windows.Forms.GroupBox();
this.label1 = new System.Windows.Forms.Label();
this.comboBoxModiLanguage = new System.Windows.Forms.ComboBox();
this.groupBoxNOCR = new System.Windows.Forms.GroupBox();
this.buttonLineOcrEditLanguage = new System.Windows.Forms.Button();
this.buttonLineOcrNewLanguage = new System.Windows.Forms.Button();
@ -85,6 +73,18 @@ namespace Nikse.SubtitleEdit.Forms.Ocr
this.comboBoxCharacterDatabase = new System.Windows.Forms.ComboBox();
this.labelImageDatabase = new System.Windows.Forms.Label();
this.buttonNewCharacterDatabase = new System.Windows.Forms.Button();
this.GroupBoxTesseractMethod = new System.Windows.Forms.GroupBox();
this.checkBoxTesseractFallback = new System.Windows.Forms.CheckBox();
this.labelTesseractEngineMode = new System.Windows.Forms.Label();
this.comboBoxTesseractEngineMode = new System.Windows.Forms.ComboBox();
this.buttonGetTesseractDictionaries = new System.Windows.Forms.Button();
this.checkBoxTesseractMusicOn = new System.Windows.Forms.CheckBox();
this.checkBoxTesseractItalicsOn = new System.Windows.Forms.CheckBox();
this.labelTesseractLanguage = new System.Windows.Forms.Label();
this.comboBoxTesseractLanguages = new System.Windows.Forms.ComboBox();
this.groupBoxModiMethod = new System.Windows.Forms.GroupBox();
this.label1 = new System.Windows.Forms.Label();
this.comboBoxModiLanguage = new System.Windows.Forms.ComboBox();
this.groupBoxOCRControls = new System.Windows.Forms.GroupBox();
this.labelStartFrom = new System.Windows.Forms.Label();
this.numericUpDownStartNumber = new System.Windows.Forms.NumericUpDown();
@ -153,13 +153,13 @@ namespace Nikse.SubtitleEdit.Forms.Ocr
this.timerHideStatus = new System.Windows.Forms.Timer(this.components);
this.contextMenuStripListview.SuspendLayout();
this.groupBoxOcrMethod.SuspendLayout();
this.GroupBoxTesseractMethod.SuspendLayout();
this.groupBoxModiMethod.SuspendLayout();
this.groupBoxNOCR.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownNumberOfPixelsIsSpaceNOCR)).BeginInit();
this.groupBoxImageCompareMethod.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownMaxErrorPct)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownPixelsIsSpace)).BeginInit();
this.GroupBoxTesseractMethod.SuspendLayout();
this.groupBoxModiMethod.SuspendLayout();
this.groupBoxOCRControls.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownStartNumber)).BeginInit();
this.groupBoxOcrAutoFix.SuspendLayout();
@ -439,10 +439,10 @@ namespace Nikse.SubtitleEdit.Forms.Ocr
// groupBoxOcrMethod
//
this.groupBoxOcrMethod.Controls.Add(this.comboBoxOcrMethod);
this.groupBoxOcrMethod.Controls.Add(this.groupBoxNOCR);
this.groupBoxOcrMethod.Controls.Add(this.groupBoxImageCompareMethod);
this.groupBoxOcrMethod.Controls.Add(this.GroupBoxTesseractMethod);
this.groupBoxOcrMethod.Controls.Add(this.groupBoxModiMethod);
this.groupBoxOcrMethod.Controls.Add(this.groupBoxNOCR);
this.groupBoxOcrMethod.Location = new System.Drawing.Point(13, 5);
this.groupBoxOcrMethod.Name = "groupBoxOcrMethod";
this.groupBoxOcrMethod.Size = new System.Drawing.Size(392, 192);
@ -466,140 +466,6 @@ namespace Nikse.SubtitleEdit.Forms.Ocr
this.comboBoxOcrMethod.TabIndex = 0;
this.comboBoxOcrMethod.SelectedIndexChanged += new System.EventHandler(this.ComboBoxOcrMethodSelectedIndexChanged);
//
// GroupBoxTesseractMethod
//
this.GroupBoxTesseractMethod.Controls.Add(this.checkBoxTesseractFallback);
this.GroupBoxTesseractMethod.Controls.Add(this.labelTesseractEngineMode);
this.GroupBoxTesseractMethod.Controls.Add(this.comboBoxTesseractEngineMode);
this.GroupBoxTesseractMethod.Controls.Add(this.buttonGetTesseractDictionaries);
this.GroupBoxTesseractMethod.Controls.Add(this.checkBoxTesseractMusicOn);
this.GroupBoxTesseractMethod.Controls.Add(this.checkBoxTesseractItalicsOn);
this.GroupBoxTesseractMethod.Controls.Add(this.labelTesseractLanguage);
this.GroupBoxTesseractMethod.Controls.Add(this.comboBoxTesseractLanguages);
this.GroupBoxTesseractMethod.Location = new System.Drawing.Point(13, 31);
this.GroupBoxTesseractMethod.Name = "GroupBoxTesseractMethod";
this.GroupBoxTesseractMethod.Size = new System.Drawing.Size(366, 131);
this.GroupBoxTesseractMethod.TabIndex = 1;
this.GroupBoxTesseractMethod.TabStop = false;
this.GroupBoxTesseractMethod.Text = "Tesseract";
//
// checkBoxTesseractFallback
//
this.checkBoxTesseractFallback.AutoSize = true;
this.checkBoxTesseractFallback.Location = new System.Drawing.Point(21, 104);
this.checkBoxTesseractFallback.Name = "checkBoxTesseractFallback";
this.checkBoxTesseractFallback.Size = new System.Drawing.Size(152, 17);
this.checkBoxTesseractFallback.TabIndex = 7;
this.checkBoxTesseractFallback.Text = "Fallback to Tesseract 3.02";
this.checkBoxTesseractFallback.UseVisualStyleBackColor = true;
//
// labelTesseractEngineMode
//
this.labelTesseractEngineMode.AutoSize = true;
this.labelTesseractEngineMode.Location = new System.Drawing.Point(18, 50);
this.labelTesseractEngineMode.Name = "labelTesseractEngineMode";
this.labelTesseractEngineMode.Size = new System.Drawing.Size(68, 13);
this.labelTesseractEngineMode.TabIndex = 6;
this.labelTesseractEngineMode.Text = "Engine mode";
//
// comboBoxTesseractEngineMode
//
this.comboBoxTesseractEngineMode.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxTesseractEngineMode.FormattingEnabled = true;
this.comboBoxTesseractEngineMode.Items.AddRange(new object[] {
"Original Tesseract only (can detect italic)",
"Neural nets LSTM only",
"Tesseract + LSTM",
"Default, based on what is available"});
this.comboBoxTesseractEngineMode.Location = new System.Drawing.Point(98, 47);
this.comboBoxTesseractEngineMode.Name = "comboBoxTesseractEngineMode";
this.comboBoxTesseractEngineMode.Size = new System.Drawing.Size(195, 21);
this.comboBoxTesseractEngineMode.TabIndex = 5;
this.comboBoxTesseractEngineMode.SelectedIndexChanged += new System.EventHandler(this.comboBoxTesseractEngineMode_SelectedIndexChanged);
//
// buttonGetTesseractDictionaries
//
this.buttonGetTesseractDictionaries.Location = new System.Drawing.Point(300, 18);
this.buttonGetTesseractDictionaries.Name = "buttonGetTesseractDictionaries";
this.buttonGetTesseractDictionaries.Size = new System.Drawing.Size(29, 23);
this.buttonGetTesseractDictionaries.TabIndex = 2;
this.buttonGetTesseractDictionaries.Text = "...";
this.buttonGetTesseractDictionaries.UseVisualStyleBackColor = true;
this.buttonGetTesseractDictionaries.Click += new System.EventHandler(this.buttonGetTesseractDictionaries_Click);
//
// checkBoxTesseractMusicOn
//
this.checkBoxTesseractMusicOn.AutoSize = true;
this.checkBoxTesseractMusicOn.Checked = true;
this.checkBoxTesseractMusicOn.CheckState = System.Windows.Forms.CheckState.Checked;
this.checkBoxTesseractMusicOn.Location = new System.Drawing.Point(81, 77);
this.checkBoxTesseractMusicOn.Name = "checkBoxTesseractMusicOn";
this.checkBoxTesseractMusicOn.Size = new System.Drawing.Size(93, 17);
this.checkBoxTesseractMusicOn.TabIndex = 4;
this.checkBoxTesseractMusicOn.Text = "Music symbols";
this.checkBoxTesseractMusicOn.UseVisualStyleBackColor = true;
//
// checkBoxTesseractItalicsOn
//
this.checkBoxTesseractItalicsOn.AutoSize = true;
this.checkBoxTesseractItalicsOn.Checked = true;
this.checkBoxTesseractItalicsOn.CheckState = System.Windows.Forms.CheckState.Checked;
this.checkBoxTesseractItalicsOn.Location = new System.Drawing.Point(21, 77);
this.checkBoxTesseractItalicsOn.Name = "checkBoxTesseractItalicsOn";
this.checkBoxTesseractItalicsOn.Size = new System.Drawing.Size(54, 17);
this.checkBoxTesseractItalicsOn.TabIndex = 3;
this.checkBoxTesseractItalicsOn.Text = "Italics";
this.checkBoxTesseractItalicsOn.UseVisualStyleBackColor = true;
//
// labelTesseractLanguage
//
this.labelTesseractLanguage.AutoSize = true;
this.labelTesseractLanguage.Location = new System.Drawing.Point(18, 22);
this.labelTesseractLanguage.Name = "labelTesseractLanguage";
this.labelTesseractLanguage.Size = new System.Drawing.Size(54, 13);
this.labelTesseractLanguage.TabIndex = 0;
this.labelTesseractLanguage.Text = "Language";
//
// comboBoxTesseractLanguages
//
this.comboBoxTesseractLanguages.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxTesseractLanguages.FormattingEnabled = true;
this.comboBoxTesseractLanguages.Location = new System.Drawing.Point(98, 20);
this.comboBoxTesseractLanguages.Name = "comboBoxTesseractLanguages";
this.comboBoxTesseractLanguages.Size = new System.Drawing.Size(195, 21);
this.comboBoxTesseractLanguages.TabIndex = 1;
this.comboBoxTesseractLanguages.SelectedIndexChanged += new System.EventHandler(this.ComboBoxTesseractLanguagesSelectedIndexChanged);
//
// groupBoxModiMethod
//
this.groupBoxModiMethod.Controls.Add(this.label1);
this.groupBoxModiMethod.Controls.Add(this.comboBoxModiLanguage);
this.groupBoxModiMethod.Location = new System.Drawing.Point(7, 50);
this.groupBoxModiMethod.Name = "groupBoxModiMethod";
this.groupBoxModiMethod.Size = new System.Drawing.Size(366, 131);
this.groupBoxModiMethod.TabIndex = 3;
this.groupBoxModiMethod.TabStop = false;
this.groupBoxModiMethod.Text = "MODI";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(11, 58);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(54, 13);
this.label1.TabIndex = 33;
this.label1.Text = "Language";
//
// comboBoxModiLanguage
//
this.comboBoxModiLanguage.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxModiLanguage.FormattingEnabled = true;
this.comboBoxModiLanguage.Location = new System.Drawing.Point(108, 55);
this.comboBoxModiLanguage.Name = "comboBoxModiLanguage";
this.comboBoxModiLanguage.Size = new System.Drawing.Size(195, 21);
this.comboBoxModiLanguage.TabIndex = 0;
this.comboBoxModiLanguage.SelectedIndexChanged += new System.EventHandler(this.ComboBoxModiLanguageSelectedIndexChanged);
//
// groupBoxNOCR
//
this.groupBoxNOCR.Controls.Add(this.buttonLineOcrEditLanguage);
@ -941,6 +807,140 @@ namespace Nikse.SubtitleEdit.Forms.Ocr
this.buttonNewCharacterDatabase.UseVisualStyleBackColor = true;
this.buttonNewCharacterDatabase.Click += new System.EventHandler(this.ButtonNewCharacterDatabaseClick);
//
// GroupBoxTesseractMethod
//
this.GroupBoxTesseractMethod.Controls.Add(this.checkBoxTesseractFallback);
this.GroupBoxTesseractMethod.Controls.Add(this.labelTesseractEngineMode);
this.GroupBoxTesseractMethod.Controls.Add(this.comboBoxTesseractEngineMode);
this.GroupBoxTesseractMethod.Controls.Add(this.buttonGetTesseractDictionaries);
this.GroupBoxTesseractMethod.Controls.Add(this.checkBoxTesseractMusicOn);
this.GroupBoxTesseractMethod.Controls.Add(this.checkBoxTesseractItalicsOn);
this.GroupBoxTesseractMethod.Controls.Add(this.labelTesseractLanguage);
this.GroupBoxTesseractMethod.Controls.Add(this.comboBoxTesseractLanguages);
this.GroupBoxTesseractMethod.Location = new System.Drawing.Point(13, 31);
this.GroupBoxTesseractMethod.Name = "GroupBoxTesseractMethod";
this.GroupBoxTesseractMethod.Size = new System.Drawing.Size(366, 131);
this.GroupBoxTesseractMethod.TabIndex = 1;
this.GroupBoxTesseractMethod.TabStop = false;
this.GroupBoxTesseractMethod.Text = "Tesseract";
//
// checkBoxTesseractFallback
//
this.checkBoxTesseractFallback.AutoSize = true;
this.checkBoxTesseractFallback.Location = new System.Drawing.Point(21, 104);
this.checkBoxTesseractFallback.Name = "checkBoxTesseractFallback";
this.checkBoxTesseractFallback.Size = new System.Drawing.Size(152, 17);
this.checkBoxTesseractFallback.TabIndex = 7;
this.checkBoxTesseractFallback.Text = "Fallback to Tesseract 3.02";
this.checkBoxTesseractFallback.UseVisualStyleBackColor = true;
//
// labelTesseractEngineMode
//
this.labelTesseractEngineMode.AutoSize = true;
this.labelTesseractEngineMode.Location = new System.Drawing.Point(18, 50);
this.labelTesseractEngineMode.Name = "labelTesseractEngineMode";
this.labelTesseractEngineMode.Size = new System.Drawing.Size(68, 13);
this.labelTesseractEngineMode.TabIndex = 6;
this.labelTesseractEngineMode.Text = "Engine mode";
//
// comboBoxTesseractEngineMode
//
this.comboBoxTesseractEngineMode.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxTesseractEngineMode.FormattingEnabled = true;
this.comboBoxTesseractEngineMode.Items.AddRange(new object[] {
"Original Tesseract only (can detect italic)",
"Neural nets LSTM only",
"Tesseract + LSTM",
"Default, based on what is available"});
this.comboBoxTesseractEngineMode.Location = new System.Drawing.Point(98, 47);
this.comboBoxTesseractEngineMode.Name = "comboBoxTesseractEngineMode";
this.comboBoxTesseractEngineMode.Size = new System.Drawing.Size(195, 21);
this.comboBoxTesseractEngineMode.TabIndex = 5;
this.comboBoxTesseractEngineMode.SelectedIndexChanged += new System.EventHandler(this.comboBoxTesseractEngineMode_SelectedIndexChanged);
//
// buttonGetTesseractDictionaries
//
this.buttonGetTesseractDictionaries.Location = new System.Drawing.Point(300, 18);
this.buttonGetTesseractDictionaries.Name = "buttonGetTesseractDictionaries";
this.buttonGetTesseractDictionaries.Size = new System.Drawing.Size(29, 23);
this.buttonGetTesseractDictionaries.TabIndex = 2;
this.buttonGetTesseractDictionaries.Text = "...";
this.buttonGetTesseractDictionaries.UseVisualStyleBackColor = true;
this.buttonGetTesseractDictionaries.Click += new System.EventHandler(this.buttonGetTesseractDictionaries_Click);
//
// checkBoxTesseractMusicOn
//
this.checkBoxTesseractMusicOn.AutoSize = true;
this.checkBoxTesseractMusicOn.Checked = true;
this.checkBoxTesseractMusicOn.CheckState = System.Windows.Forms.CheckState.Checked;
this.checkBoxTesseractMusicOn.Location = new System.Drawing.Point(81, 77);
this.checkBoxTesseractMusicOn.Name = "checkBoxTesseractMusicOn";
this.checkBoxTesseractMusicOn.Size = new System.Drawing.Size(93, 17);
this.checkBoxTesseractMusicOn.TabIndex = 4;
this.checkBoxTesseractMusicOn.Text = "Music symbols";
this.checkBoxTesseractMusicOn.UseVisualStyleBackColor = true;
//
// checkBoxTesseractItalicsOn
//
this.checkBoxTesseractItalicsOn.AutoSize = true;
this.checkBoxTesseractItalicsOn.Checked = true;
this.checkBoxTesseractItalicsOn.CheckState = System.Windows.Forms.CheckState.Checked;
this.checkBoxTesseractItalicsOn.Location = new System.Drawing.Point(21, 77);
this.checkBoxTesseractItalicsOn.Name = "checkBoxTesseractItalicsOn";
this.checkBoxTesseractItalicsOn.Size = new System.Drawing.Size(54, 17);
this.checkBoxTesseractItalicsOn.TabIndex = 3;
this.checkBoxTesseractItalicsOn.Text = "Italics";
this.checkBoxTesseractItalicsOn.UseVisualStyleBackColor = true;
//
// labelTesseractLanguage
//
this.labelTesseractLanguage.AutoSize = true;
this.labelTesseractLanguage.Location = new System.Drawing.Point(18, 22);
this.labelTesseractLanguage.Name = "labelTesseractLanguage";
this.labelTesseractLanguage.Size = new System.Drawing.Size(54, 13);
this.labelTesseractLanguage.TabIndex = 0;
this.labelTesseractLanguage.Text = "Language";
//
// comboBoxTesseractLanguages
//
this.comboBoxTesseractLanguages.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxTesseractLanguages.FormattingEnabled = true;
this.comboBoxTesseractLanguages.Location = new System.Drawing.Point(98, 20);
this.comboBoxTesseractLanguages.Name = "comboBoxTesseractLanguages";
this.comboBoxTesseractLanguages.Size = new System.Drawing.Size(195, 21);
this.comboBoxTesseractLanguages.TabIndex = 1;
this.comboBoxTesseractLanguages.SelectedIndexChanged += new System.EventHandler(this.ComboBoxTesseractLanguagesSelectedIndexChanged);
//
// groupBoxModiMethod
//
this.groupBoxModiMethod.Controls.Add(this.label1);
this.groupBoxModiMethod.Controls.Add(this.comboBoxModiLanguage);
this.groupBoxModiMethod.Location = new System.Drawing.Point(7, 50);
this.groupBoxModiMethod.Name = "groupBoxModiMethod";
this.groupBoxModiMethod.Size = new System.Drawing.Size(366, 131);
this.groupBoxModiMethod.TabIndex = 3;
this.groupBoxModiMethod.TabStop = false;
this.groupBoxModiMethod.Text = "MODI";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(11, 58);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(54, 13);
this.label1.TabIndex = 33;
this.label1.Text = "Language";
//
// comboBoxModiLanguage
//
this.comboBoxModiLanguage.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxModiLanguage.FormattingEnabled = true;
this.comboBoxModiLanguage.Location = new System.Drawing.Point(108, 55);
this.comboBoxModiLanguage.Name = "comboBoxModiLanguage";
this.comboBoxModiLanguage.Size = new System.Drawing.Size(195, 21);
this.comboBoxModiLanguage.TabIndex = 0;
this.comboBoxModiLanguage.SelectedIndexChanged += new System.EventHandler(this.ComboBoxModiLanguageSelectedIndexChanged);
//
// groupBoxOCRControls
//
this.groupBoxOCRControls.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
@ -1708,10 +1708,6 @@ namespace Nikse.SubtitleEdit.Forms.Ocr
this.Resize += new System.EventHandler(this.VobSubOcr_Resize);
this.contextMenuStripListview.ResumeLayout(false);
this.groupBoxOcrMethod.ResumeLayout(false);
this.GroupBoxTesseractMethod.ResumeLayout(false);
this.GroupBoxTesseractMethod.PerformLayout();
this.groupBoxModiMethod.ResumeLayout(false);
this.groupBoxModiMethod.PerformLayout();
this.groupBoxNOCR.ResumeLayout(false);
this.groupBoxNOCR.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownNumberOfPixelsIsSpaceNOCR)).EndInit();
@ -1719,6 +1715,10 @@ namespace Nikse.SubtitleEdit.Forms.Ocr
this.groupBoxImageCompareMethod.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownMaxErrorPct)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownPixelsIsSpace)).EndInit();
this.GroupBoxTesseractMethod.ResumeLayout(false);
this.GroupBoxTesseractMethod.PerformLayout();
this.groupBoxModiMethod.ResumeLayout(false);
this.groupBoxModiMethod.PerformLayout();
this.groupBoxOCRControls.ResumeLayout(false);
this.groupBoxOCRControls.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownStartNumber)).EndInit();

View File

@ -8638,11 +8638,19 @@ namespace Nikse.SubtitleEdit.Forms.Ocr
LoadNOcrWithCurrentLanguage();
}
using (var form = new VobSubNOcrEdit(_nOcrDb.OcrCharacters, null))
using (var form = new VobSubNOcrEdit(_nOcrDb.OcrCharacters, null, _nOcrDb.FileName))
{
if (form.ShowDialog(this) == DialogResult.OK)
if (form.ShowDialog(this) == DialogResult.OK && form.Changed)
{
SaveNOcrWithCurrentLanguage();
Cursor = Cursors.WaitCursor;
try
{
SaveNOcrWithCurrentLanguage();
}
finally
{
Cursor = Cursors.Default;
}
}
else
{