mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-10-27 14:32:35 +01:00
Minor fixes for beta ocr method (for a future version...)
This commit is contained in:
parent
e96af61a15
commit
108a0ae6a5
@ -118,6 +118,7 @@
|
||||
<Word from="aga/nst" to="against" />
|
||||
<Word from="ahsolutes" to="absolutes" />
|
||||
<Word from="AI_I_" to="ALL" />
|
||||
<Word from="AIien" to="Alien" />
|
||||
<Word from="AIex" to="Alex" />
|
||||
<Word from="AII" to="All" />
|
||||
<Word from="AIIan" to="Allan" />
|
||||
@ -245,6 +246,7 @@
|
||||
<Word from="Cho/r" to="Choir" />
|
||||
<Word from="cHucKl_Es" to="CHUCKLES" />
|
||||
<Word from="CIark" to="Clark" />
|
||||
<Word from="CIass" to="Class" />
|
||||
<Word from="CIear" to="Clear" />
|
||||
<Word from="circumcised_" to="circumcised." />
|
||||
<Word from="ckay" to="okay" />
|
||||
@ -1102,6 +1104,7 @@
|
||||
<Word from="Persona/4/" to="Personally" />
|
||||
<Word from="Persona/y" to="Personally" />
|
||||
<Word from="persors" to="person's" />
|
||||
<Word from="PIace" to="Place" />
|
||||
<Word from="PIain" to="Plain" />
|
||||
<Word from="PIease" to="Please" />
|
||||
<Word from="PIeasure" to="Pleasure" />
|
||||
|
@ -2071,6 +2071,7 @@ Keep changes?</KeepChangesMessage>
|
||||
<Title>Inspect compare matches for current image</Title>
|
||||
<InspectItems>Inspect items</InspectItems>
|
||||
<AddBetterMatch>Add better match</AddBetterMatch>
|
||||
<Add>Add</Add>
|
||||
</VobSubOcrCharacterInspect>
|
||||
<VobSubOcrNewFolder>
|
||||
<Title>New folder</Title>
|
||||
|
@ -2386,6 +2386,7 @@ Keep changes?",
|
||||
Title = "Inspect compare matches for current image",
|
||||
InspectItems = "Inspect items",
|
||||
AddBetterMatch = "Add better match",
|
||||
Add = "Add",
|
||||
};
|
||||
|
||||
VobSubOcrNewFolder = new LanguageStructure.VobSubOcrNewFolder
|
||||
|
@ -5554,6 +5554,9 @@ namespace Nikse.SubtitleEdit.Core
|
||||
case "VobSubOcrCharacterInspect/AddBetterMatch":
|
||||
language.VobSubOcrCharacterInspect.AddBetterMatch = reader.Value;
|
||||
break;
|
||||
case "VobSubOcrCharacterInspect/Add":
|
||||
language.VobSubOcrCharacterInspect.Add = reader.Value;
|
||||
break;
|
||||
case "VobSubOcrNewFolder/Title":
|
||||
language.VobSubOcrNewFolder.Title = reader.Value;
|
||||
break;
|
||||
|
@ -2266,6 +2266,7 @@
|
||||
public string Title { get; set; }
|
||||
public string InspectItems { get; set; }
|
||||
public string AddBetterMatch { get; set; }
|
||||
public string Add { get; set; }
|
||||
}
|
||||
|
||||
public class VobSubOcrNewFolder
|
||||
|
8
src/Forms/OCRSpellCheck.Designer.cs
generated
8
src/Forms/OCRSpellCheck.Designer.cs
generated
@ -313,7 +313,7 @@
|
||||
this.groupBoxText.Location = new System.Drawing.Point(12, 170);
|
||||
this.groupBoxText.Name = "groupBoxText";
|
||||
this.groupBoxText.Size = new System.Drawing.Size(696, 72);
|
||||
this.groupBoxText.TabIndex = 1;
|
||||
this.groupBoxText.TabIndex = 500;
|
||||
this.groupBoxText.TabStop = false;
|
||||
this.groupBoxText.Text = "Text";
|
||||
//
|
||||
@ -325,7 +325,7 @@
|
||||
this.richTextBoxParagraph.Name = "richTextBoxParagraph";
|
||||
this.richTextBoxParagraph.ReadOnly = true;
|
||||
this.richTextBoxParagraph.Size = new System.Drawing.Size(296, 54);
|
||||
this.richTextBoxParagraph.TabIndex = 0;
|
||||
this.richTextBoxParagraph.TabIndex = 400;
|
||||
this.richTextBoxParagraph.Text = "";
|
||||
//
|
||||
// buttonEditWholeText
|
||||
@ -333,7 +333,7 @@
|
||||
this.buttonEditWholeText.Location = new System.Drawing.Point(308, 17);
|
||||
this.buttonEditWholeText.Name = "buttonEditWholeText";
|
||||
this.buttonEditWholeText.Size = new System.Drawing.Size(128, 21);
|
||||
this.buttonEditWholeText.TabIndex = 1;
|
||||
this.buttonEditWholeText.TabIndex = 401;
|
||||
this.buttonEditWholeText.Text = "Edit whole text";
|
||||
this.buttonEditWholeText.UseVisualStyleBackColor = true;
|
||||
this.buttonEditWholeText.Click += new System.EventHandler(this.ButtonEditWholeTextClick);
|
||||
@ -343,7 +343,7 @@
|
||||
this.buttonEditWord.Location = new System.Drawing.Point(308, 43);
|
||||
this.buttonEditWord.Name = "buttonEditWord";
|
||||
this.buttonEditWord.Size = new System.Drawing.Size(128, 21);
|
||||
this.buttonEditWord.TabIndex = 2;
|
||||
this.buttonEditWord.TabIndex = 402;
|
||||
this.buttonEditWord.Text = "Edit word";
|
||||
this.buttonEditWord.UseVisualStyleBackColor = true;
|
||||
this.buttonEditWord.Click += new System.EventHandler(this.ButtonEditWordClick);
|
||||
|
@ -245,7 +245,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
private void TextBoxWordKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.KeyCode == Keys.Enter)
|
||||
if (e.KeyCode == Keys.Enter && buttonChange.Enabled)
|
||||
{
|
||||
ButtonChangeClick(null, null);
|
||||
e.SuppressKeyPress = true;
|
||||
|
@ -1,5 +1,4 @@
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using Nikse.SubtitleEdit.Core;
|
||||
using Nikse.SubtitleEdit.Core;
|
||||
using Nikse.SubtitleEdit.Core.BluRaySup;
|
||||
using Nikse.SubtitleEdit.Core.SubtitleFormats;
|
||||
using Nikse.SubtitleEdit.Core.TransportStream;
|
||||
|
2
src/Forms/VobSubOcrCharacterInspect.Designer.cs
generated
2
src/Forms/VobSubOcrCharacterInspect.Designer.cs
generated
@ -90,7 +90,7 @@
|
||||
// buttonAddBetterMatch
|
||||
//
|
||||
this.buttonAddBetterMatch.ImeMode = System.Windows.Forms.ImeMode.NoControl;
|
||||
this.buttonAddBetterMatch.Location = new System.Drawing.Point(120, 98);
|
||||
this.buttonAddBetterMatch.Location = new System.Drawing.Point(120, 89);
|
||||
this.buttonAddBetterMatch.Name = "buttonAddBetterMatch";
|
||||
this.buttonAddBetterMatch.Size = new System.Drawing.Size(140, 21);
|
||||
this.buttonAddBetterMatch.TabIndex = 28;
|
||||
|
@ -17,10 +17,10 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
private List<VobSubOcr.CompareMatch> _matches;
|
||||
private List<Bitmap> _imageSources;
|
||||
private string _directoryPath;
|
||||
private XmlNode _selectedCompareNode = null;
|
||||
private BinaryOcrBitmap _selectedCompareBinaryOcrBitmap = null;
|
||||
private VobSubOcr.CompareMatch _selectedMatch = null;
|
||||
private BinaryOcrDb _binOcrDb = null;
|
||||
private XmlNode _selectedCompareNode;
|
||||
private BinaryOcrBitmap _selectedCompareBinaryOcrBitmap;
|
||||
private VobSubOcr.CompareMatch _selectedMatch;
|
||||
private BinaryOcrDb _binOcrDb;
|
||||
|
||||
public VobSubOcrCharacterInspect()
|
||||
{
|
||||
@ -159,7 +159,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
string name = node.InnerText;
|
||||
int pos = Convert.ToInt32(name);
|
||||
f.Position = pos;
|
||||
ManagedBitmap mbmp = new ManagedBitmap(f);
|
||||
var mbmp = new ManagedBitmap(f);
|
||||
var bitmap = mbmp.ToOldBitmap();
|
||||
pictureBoxCompareBitmap.Image = bitmap;
|
||||
pictureBoxCompareBitmapDouble.Width = bitmap.Width * 2;
|
||||
@ -181,7 +181,18 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
}
|
||||
|
||||
if (_selectedCompareNode == null && _selectedCompareBinaryOcrBitmap == null)
|
||||
buttonAddBetterMatch.Text = Configuration.Settings.Language.VobSubOcrCharacterInspect.AddBetterMatch;
|
||||
if (_selectedMatch.Text == Configuration.Settings.Language.VobSubOcr.NoMatch)
|
||||
{
|
||||
buttonUpdate.Enabled = false;
|
||||
buttonDelete.Enabled = false;
|
||||
buttonAddBetterMatch.Enabled = true;
|
||||
buttonAddBetterMatch.Text = Configuration.Settings.Language.VobSubOcrCharacterInspect.Add;
|
||||
textBoxText.Enabled = true;
|
||||
textBoxText.Text = string.Empty;
|
||||
checkBoxItalic.Enabled = true;
|
||||
}
|
||||
else if (_selectedCompareNode == null && _selectedCompareBinaryOcrBitmap == null)
|
||||
{
|
||||
buttonUpdate.Enabled = false;
|
||||
buttonDelete.Enabled = false;
|
||||
@ -296,6 +307,33 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
return;
|
||||
}
|
||||
|
||||
if (_selectedCompareBinaryOcrBitmap != null || (_binOcrDb != null && _selectedMatch.Text == Configuration.Settings.Language.VobSubOcr.NoMatch))
|
||||
{
|
||||
var nbmp = new NikseBitmap((pictureBoxInspectItem.Image as Bitmap));
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
if (_selectedMatch != null && _selectedMatch.ImageSplitterItem != null)
|
||||
{
|
||||
x = _selectedMatch.X;
|
||||
y = _selectedMatch.Y;
|
||||
}
|
||||
var bob = new BinaryOcrBitmap(nbmp, checkBoxItalic.Checked, 0, textBoxText.Text, x, y);
|
||||
_binOcrDb.Add(bob);
|
||||
|
||||
int index = listBoxInspectItems.SelectedIndex;
|
||||
_matches[index].Name = bob.Key;
|
||||
_matches[index].ExpandCount = 0;
|
||||
_matches[index].Italic = checkBoxItalic.Checked;
|
||||
_matches[index].Text = textBoxText.Text;
|
||||
listBoxInspectItems.Items.Clear();
|
||||
for (int i = 0; i < _matches.Count; i++)
|
||||
listBoxInspectItems.Items.Add(_matches[i].Text);
|
||||
listBoxInspectItems.SelectedIndex = index;
|
||||
listBoxInspectItems_SelectedIndexChanged(null, null);
|
||||
ShowCount();
|
||||
return;
|
||||
}
|
||||
|
||||
if (_selectedCompareNode != null)
|
||||
{
|
||||
XmlNode newNode = ImageCompareDocument.CreateElement("Item");
|
||||
@ -305,7 +343,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
string databaseName = Path.Combine(_directoryPath, "Images.db");
|
||||
FileStream f;
|
||||
long pos = 0;
|
||||
long pos;
|
||||
if (!File.Exists(databaseName))
|
||||
{
|
||||
using (f = new FileStream(databaseName, FileMode.Create))
|
||||
@ -340,39 +378,11 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
ShowCount();
|
||||
listBoxInspectItems_SelectedIndexChanged(null, null);
|
||||
}
|
||||
else if (_selectedCompareBinaryOcrBitmap != null)
|
||||
{
|
||||
var nbmp = new NikseBitmap((pictureBoxInspectItem.Image as Bitmap));
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
if (_selectedMatch != null && _selectedMatch.ImageSplitterItem != null)
|
||||
{
|
||||
x = _selectedMatch.X;
|
||||
y = _selectedMatch.Y;
|
||||
}
|
||||
var bob = new BinaryOcrBitmap(nbmp, checkBoxItalic.Checked, 0, textBoxText.Text, x, y);
|
||||
_binOcrDb.Add(bob);
|
||||
|
||||
int index = listBoxInspectItems.SelectedIndex;
|
||||
_matches[index].Name = bob.Key;
|
||||
_matches[index].ExpandCount = 0;
|
||||
_matches[index].Italic = checkBoxItalic.Checked;
|
||||
_matches[index].Text = textBoxText.Text;
|
||||
listBoxInspectItems.Items.Clear();
|
||||
for (int i = 0; i < _matches.Count; i++)
|
||||
listBoxInspectItems.Items.Add(_matches[i].Text);
|
||||
listBoxInspectItems.SelectedIndex = index;
|
||||
listBoxInspectItems_SelectedIndexChanged(null, null);
|
||||
ShowCount();
|
||||
}
|
||||
}
|
||||
|
||||
private void ShowCount()
|
||||
{
|
||||
if (listBoxInspectItems.Items.Count > 1)
|
||||
labelCount.Text = listBoxInspectItems.Items.Count.ToString();
|
||||
else
|
||||
labelCount.Text = string.Empty;
|
||||
labelCount.Text = listBoxInspectItems.Items.Count > 1 ? listBoxInspectItems.Items.Count.ToString(CultureInfo.InvariantCulture) : string.Empty;
|
||||
}
|
||||
|
||||
}
|
||||
|
1404
src/Forms/VobSubOcrNOcrCharacter.Designer.cs
generated
1404
src/Forms/VobSubOcrNOcrCharacter.Designer.cs
generated
File diff suppressed because it is too large
Load Diff
@ -737,5 +737,15 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
textBoxCharacters.SelectedText = (sender as ToolStripMenuItem).Text;
|
||||
}
|
||||
|
||||
private void toolStripMenuItemMusicSymbol1_Click(object sender, EventArgs e)
|
||||
{
|
||||
textBoxCharacters.SelectedText = (sender as ToolStripMenuItem).Text;
|
||||
}
|
||||
|
||||
private void toolStripMenuItemMusicSymbol2_Click(object sender, EventArgs e)
|
||||
{
|
||||
textBoxCharacters.SelectedText = (sender as ToolStripMenuItem).Text;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -719,9 +719,12 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
{
|
||||
right = false;
|
||||
bool left = false;
|
||||
int leftCount = 0;
|
||||
int rightCount = 0;
|
||||
clean = true;
|
||||
var points = new List<Point>();
|
||||
int y = 0;
|
||||
int maxSlide = bmp.Height / 4;
|
||||
while (y < bmp.Height)
|
||||
{
|
||||
if (bmp.GetAlpha(x, y) > 100)
|
||||
@ -754,7 +757,6 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
if (bmp.GetAlpha(x - 1, y) > 0)
|
||||
{
|
||||
x++; //(requires search for min/max x in points
|
||||
right = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -788,7 +790,13 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
return null;
|
||||
}
|
||||
|
||||
if (left && right)
|
||||
if (left)
|
||||
leftCount++;
|
||||
|
||||
if (right)
|
||||
rightCount++;
|
||||
|
||||
if (leftCount > maxSlide || rightCount > maxSlide)
|
||||
return null;
|
||||
}
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user