mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-22 19:22:53 +01:00
Work on OCR
This commit is contained in:
parent
39cb3adbaa
commit
23976bd38a
36
src/Forms/Ocr/BinaryOcrTrain.Designer.cs
generated
36
src/Forms/Ocr/BinaryOcrTrain.Designer.cs
generated
@ -42,15 +42,15 @@
|
||||
this.labelInfo = new System.Windows.Forms.Label();
|
||||
this.buttonTrain = new System.Windows.Forms.Button();
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.checkBoxItalic = new System.Windows.Forms.CheckBox();
|
||||
this.button1 = new System.Windows.Forms.Button();
|
||||
this.comboBoxFontSizeEnd = new System.Windows.Forms.ComboBox();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.groupBoxInput = new System.Windows.Forms.GroupBox();
|
||||
this.folderBrowserDialog1 = new System.Windows.Forms.FolderBrowserDialog();
|
||||
this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.textBoxMerged = new System.Windows.Forms.TextBox();
|
||||
this.checkBoxItalic = new System.Windows.Forms.CheckBox();
|
||||
this.folderBrowserDialog1 = new System.Windows.Forms.FolderBrowserDialog();
|
||||
this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog();
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.groupBoxInput.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
@ -75,9 +75,9 @@
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(6, 24);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(269, 13);
|
||||
this.label1.Size = new System.Drawing.Size(99, 13);
|
||||
this.label1.TabIndex = 8;
|
||||
this.label1.Text = "Subtitle to train with (must have spaces between letters)";
|
||||
this.label1.Text = "Subtitle to train with";
|
||||
//
|
||||
// textBoxInputFile
|
||||
//
|
||||
@ -299,6 +299,17 @@
|
||||
this.groupBox1.TabStop = false;
|
||||
this.groupBox1.Text = "Training options";
|
||||
//
|
||||
// checkBoxItalic
|
||||
//
|
||||
this.checkBoxItalic.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.checkBoxItalic.AutoSize = true;
|
||||
this.checkBoxItalic.Location = new System.Drawing.Point(114, 466);
|
||||
this.checkBoxItalic.Name = "checkBoxItalic";
|
||||
this.checkBoxItalic.Size = new System.Drawing.Size(93, 17);
|
||||
this.checkBoxItalic.TabIndex = 28;
|
||||
this.checkBoxItalic.Text = "Also train italic";
|
||||
this.checkBoxItalic.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// button1
|
||||
//
|
||||
this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
@ -443,9 +454,9 @@
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(5, 82);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(201, 13);
|
||||
this.label2.Size = new System.Drawing.Size(250, 13);
|
||||
this.label2.TabIndex = 11;
|
||||
this.label2.Text = "Letter combinations that might be merged";
|
||||
this.label2.Text = "Letter combinations that might be split as one image";
|
||||
//
|
||||
// textBoxMerged
|
||||
//
|
||||
@ -455,17 +466,6 @@
|
||||
this.textBoxMerged.TabIndex = 12;
|
||||
this.textBoxMerged.Text = "ff ft fi fj fy fl rf rt rv rw ry rt ryt tt TV tw yt yw";
|
||||
//
|
||||
// checkBoxItalic
|
||||
//
|
||||
this.checkBoxItalic.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.checkBoxItalic.AutoSize = true;
|
||||
this.checkBoxItalic.Location = new System.Drawing.Point(114, 466);
|
||||
this.checkBoxItalic.Name = "checkBoxItalic";
|
||||
this.checkBoxItalic.Size = new System.Drawing.Size(93, 17);
|
||||
this.checkBoxItalic.TabIndex = 28;
|
||||
this.checkBoxItalic.Text = "Also train italic";
|
||||
this.checkBoxItalic.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// BinaryOcrTrain
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
|
37
src/Forms/Ocr/VobSubNOcrEdit.Designer.cs
generated
37
src/Forms/Ocr/VobSubNOcrEdit.Designer.cs
generated
@ -42,10 +42,12 @@
|
||||
this.listBoxlinesBackground = new System.Windows.Forms.ListBox();
|
||||
this.contextMenuStripLinesBackground = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.removeBackToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.clearToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.labelLines = new System.Windows.Forms.Label();
|
||||
this.listBoxLinesForeground = new System.Windows.Forms.ListBox();
|
||||
this.contextMenuLinesForeground = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.removeForegroundToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.clearToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.buttonZoomOut = new System.Windows.Forms.Button();
|
||||
this.buttonZoomIn = new System.Windows.Forms.Button();
|
||||
this.labelCharacters = new System.Windows.Forms.Label();
|
||||
@ -59,8 +61,6 @@
|
||||
this.buttonCancel = new System.Windows.Forms.Button();
|
||||
this.buttonImport = new System.Windows.Forms.Button();
|
||||
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
|
||||
this.clearToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.clearToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.groupBoxCurrentCompareImage.SuspendLayout();
|
||||
this.groupBox2.SuspendLayout();
|
||||
this.contextMenuStripLinesBackground.SuspendLayout();
|
||||
@ -201,7 +201,7 @@
|
||||
this.removeBackToolStripMenuItem,
|
||||
this.clearToolStripMenuItem1});
|
||||
this.contextMenuStripLinesBackground.Name = "contextMenuStripLines";
|
||||
this.contextMenuStripLinesBackground.Size = new System.Drawing.Size(181, 70);
|
||||
this.contextMenuStripLinesBackground.Size = new System.Drawing.Size(118, 48);
|
||||
//
|
||||
// removeBackToolStripMenuItem
|
||||
//
|
||||
@ -210,6 +210,13 @@
|
||||
this.removeBackToolStripMenuItem.Text = "Remove";
|
||||
this.removeBackToolStripMenuItem.Click += new System.EventHandler(this.removeBackToolStripMenuItem_Click);
|
||||
//
|
||||
// clearToolStripMenuItem1
|
||||
//
|
||||
this.clearToolStripMenuItem1.Name = "clearToolStripMenuItem1";
|
||||
this.clearToolStripMenuItem1.Size = new System.Drawing.Size(117, 22);
|
||||
this.clearToolStripMenuItem1.Text = "Clear";
|
||||
this.clearToolStripMenuItem1.Click += new System.EventHandler(this.clearToolStripMenuItem1_Click);
|
||||
//
|
||||
// labelLines
|
||||
//
|
||||
this.labelLines.AutoSize = true;
|
||||
@ -241,10 +248,17 @@
|
||||
// removeForegroundToolStripMenuItem
|
||||
//
|
||||
this.removeForegroundToolStripMenuItem.Name = "removeForegroundToolStripMenuItem";
|
||||
this.removeForegroundToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
this.removeForegroundToolStripMenuItem.Size = new System.Drawing.Size(117, 22);
|
||||
this.removeForegroundToolStripMenuItem.Text = "Remove";
|
||||
this.removeForegroundToolStripMenuItem.Click += new System.EventHandler(this.removeForegroundToolStripMenuItem_Click);
|
||||
//
|
||||
// clearToolStripMenuItem
|
||||
//
|
||||
this.clearToolStripMenuItem.Name = "clearToolStripMenuItem";
|
||||
this.clearToolStripMenuItem.Size = new System.Drawing.Size(117, 22);
|
||||
this.clearToolStripMenuItem.Text = "Clear";
|
||||
this.clearToolStripMenuItem.Click += new System.EventHandler(this.clearToolStripMenuItem_Click);
|
||||
//
|
||||
// buttonZoomOut
|
||||
//
|
||||
this.buttonZoomOut.Location = new System.Drawing.Point(269, 110);
|
||||
@ -375,20 +389,6 @@
|
||||
//
|
||||
this.openFileDialog1.FileName = "openFileDialog1";
|
||||
//
|
||||
// clearToolStripMenuItem
|
||||
//
|
||||
this.clearToolStripMenuItem.Name = "clearToolStripMenuItem";
|
||||
this.clearToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
this.clearToolStripMenuItem.Text = "Clear";
|
||||
this.clearToolStripMenuItem.Click += new System.EventHandler(this.clearToolStripMenuItem_Click);
|
||||
//
|
||||
// clearToolStripMenuItem1
|
||||
//
|
||||
this.clearToolStripMenuItem1.Name = "clearToolStripMenuItem1";
|
||||
this.clearToolStripMenuItem1.Size = new System.Drawing.Size(180, 22);
|
||||
this.clearToolStripMenuItem1.Text = "Clear";
|
||||
this.clearToolStripMenuItem1.Click += new System.EventHandler(this.clearToolStripMenuItem1_Click);
|
||||
//
|
||||
// VobSubNOcrEdit
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
@ -404,6 +404,7 @@
|
||||
this.Controls.Add(this.listBoxFileNames);
|
||||
this.Controls.Add(this.comboBoxTexts);
|
||||
this.KeyPreview = true;
|
||||
this.MinimumSize = new System.Drawing.Size(720, 520);
|
||||
this.Name = "VobSubNOcrEdit";
|
||||
this.ShowIcon = false;
|
||||
this.ShowInTaskbar = false;
|
||||
|
22
src/Forms/Ocr/VobSubNOcrTrain.Designer.cs
generated
22
src/Forms/Ocr/VobSubNOcrTrain.Designer.cs
generated
@ -35,7 +35,6 @@
|
||||
this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.numericUpDownSegmentsPerCharacter = new System.Windows.Forms.NumericUpDown();
|
||||
this.checkBoxVeryAccurate = new System.Windows.Forms.CheckBox();
|
||||
this.labelSubtitleFontSize = new System.Windows.Forms.Label();
|
||||
this.comboBoxSubtitleFontSize = new System.Windows.Forms.ComboBox();
|
||||
this.labelSubtitleFont = new System.Windows.Forms.Label();
|
||||
@ -65,7 +64,6 @@
|
||||
this.groupBox1.Controls.Add(this.listViewFonts);
|
||||
this.groupBox1.Controls.Add(this.label3);
|
||||
this.groupBox1.Controls.Add(this.numericUpDownSegmentsPerCharacter);
|
||||
this.groupBox1.Controls.Add(this.checkBoxVeryAccurate);
|
||||
this.groupBox1.Controls.Add(this.labelSubtitleFontSize);
|
||||
this.groupBox1.Controls.Add(this.comboBoxSubtitleFontSize);
|
||||
this.groupBox1.Controls.Add(this.labelSubtitleFont);
|
||||
@ -153,17 +151,6 @@
|
||||
0,
|
||||
0});
|
||||
//
|
||||
// checkBoxVeryAccurate
|
||||
//
|
||||
this.checkBoxVeryAccurate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.checkBoxVeryAccurate.AutoSize = true;
|
||||
this.checkBoxVeryAccurate.Location = new System.Drawing.Point(9, 367);
|
||||
this.checkBoxVeryAccurate.Name = "checkBoxVeryAccurate";
|
||||
this.checkBoxVeryAccurate.Size = new System.Drawing.Size(303, 17);
|
||||
this.checkBoxVeryAccurate.TabIndex = 4;
|
||||
this.checkBoxVeryAccurate.Text = "Very accurate (be less general), require more line segments";
|
||||
this.checkBoxVeryAccurate.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// labelSubtitleFontSize
|
||||
//
|
||||
this.labelSubtitleFontSize.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
@ -290,9 +277,9 @@
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(6, 24);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(272, 13);
|
||||
this.label1.Size = new System.Drawing.Size(102, 13);
|
||||
this.label1.TabIndex = 0;
|
||||
this.label1.Text = "Subtitle to train with (must have spaces between letters)";
|
||||
this.label1.Text = "Subtitle to train with ";
|
||||
//
|
||||
// textBoxInputFile
|
||||
//
|
||||
@ -331,9 +318,9 @@
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(7, 82);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(201, 13);
|
||||
this.label2.Size = new System.Drawing.Size(250, 13);
|
||||
this.label2.TabIndex = 3;
|
||||
this.label2.Text = "Letter combinations that might be merged";
|
||||
this.label2.Text = "Letter combinations that might be split as one image";
|
||||
//
|
||||
// textBoxMerged
|
||||
//
|
||||
@ -411,7 +398,6 @@
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.GroupBox groupBox1;
|
||||
private System.Windows.Forms.CheckBox checkBoxVeryAccurate;
|
||||
private System.Windows.Forms.Button buttonInputChoose;
|
||||
private System.Windows.Forms.TextBox textBoxInputFile;
|
||||
private System.Windows.Forms.Label label1;
|
||||
|
@ -200,7 +200,7 @@ namespace Nikse.SubtitleEdit.Forms.Ocr
|
||||
MarginTop = item.Top,
|
||||
Italic = italic,
|
||||
};
|
||||
VobSubOcrNOcrCharacter.GenerateLineSegments((int)numericUpDownSegmentsPerCharacter.Value + (doubleLetter ? 20 : 0), checkBoxVeryAccurate.Checked, nOcrChar, item.NikseBitmap);
|
||||
VobSubOcrNOcrCharacter.GenerateLineSegments((int)numericUpDownSegmentsPerCharacter.Value + (doubleLetter ? 20 : 0), false, nOcrChar, item.NikseBitmap);
|
||||
nOcrD.Add(nOcrChar);
|
||||
|
||||
numberOfCharactersLeaned++;
|
||||
@ -234,7 +234,7 @@ namespace Nikse.SubtitleEdit.Forms.Ocr
|
||||
Italic = italic,
|
||||
ExpandCount = 2,
|
||||
};
|
||||
VobSubOcrNOcrCharacter.GenerateLineSegments((int)numericUpDownSegmentsPerCharacter.Value + 5, checkBoxVeryAccurate.Checked, nOcrChar, expandItem.NikseBitmap);
|
||||
VobSubOcrNOcrCharacter.GenerateLineSegments((int)numericUpDownSegmentsPerCharacter.Value + 5, false, nOcrChar, expandItem.NikseBitmap);
|
||||
nOcrD.Add(nOcrChar);
|
||||
return;
|
||||
}
|
||||
@ -259,7 +259,7 @@ namespace Nikse.SubtitleEdit.Forms.Ocr
|
||||
ExpandCount = 3,
|
||||
};
|
||||
nOcrD.Add(nOcrChar);
|
||||
VobSubOcrNOcrCharacter.GenerateLineSegments((int)numericUpDownSegmentsPerCharacter.Value + 10, checkBoxVeryAccurate.Checked, nOcrChar, expandItem.NikseBitmap);
|
||||
VobSubOcrNOcrCharacter.GenerateLineSegments((int)numericUpDownSegmentsPerCharacter.Value + 10, false, nOcrChar, expandItem.NikseBitmap);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -4892,7 +4892,7 @@ namespace Nikse.SubtitleEdit.Forms.Ocr
|
||||
};
|
||||
bw.DoWork += NOcrThreadDoWork;
|
||||
bw.RunWorkerCompleted += NOcrThreadRunWorkerCompleted;
|
||||
bw.RunWorkerAsync(p);
|
||||
// bw.RunWorkerAsync(p);
|
||||
Application.DoEvents();
|
||||
}
|
||||
}
|
||||
@ -7438,6 +7438,7 @@ namespace Nikse.SubtitleEdit.Forms.Ocr
|
||||
|
||||
private void ResetTesseractThread()
|
||||
{
|
||||
_ocrThreadStop = true;
|
||||
_tesseractThreadRunner?.Cancel();
|
||||
if (_tesseractAsyncStrings != null)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user