From 7171bd097346bde0f0c39b27dfc47e83c311f389 Mon Sep 17 00:00:00 2001 From: Nikolaj Olsson Date: Sat, 4 Jun 2016 15:52:49 +0200 Subject: [PATCH] Working on ocr --- Dictionaries/deu_OCRFixReplaceList.xml | 14 ++ src/Forms/VobSubCharactersImport.Designer.cs | 235 +++++++++++++++++++ src/Forms/VobSubCharactersImport.cs | 220 +++++++++++++++++ src/Forms/VobSubCharactersImport.resx | 126 ++++++++++ src/Forms/VobSubEditCharacters.Designer.cs | 16 ++ src/Forms/VobSubEditCharacters.cs | 15 +- src/Logic/OCR/Binary/BinaryOcrBitmap.cs | 9 +- src/SubtitleEdit.csproj | 9 + 8 files changed, 639 insertions(+), 5 deletions(-) create mode 100644 src/Forms/VobSubCharactersImport.Designer.cs create mode 100644 src/Forms/VobSubCharactersImport.cs create mode 100644 src/Forms/VobSubCharactersImport.resx diff --git a/Dictionaries/deu_OCRFixReplaceList.xml b/Dictionaries/deu_OCRFixReplaceList.xml index 472325923..514ad4943 100644 --- a/Dictionaries/deu_OCRFixReplaceList.xml +++ b/Dictionaries/deu_OCRFixReplaceList.xml @@ -6792,6 +6792,20 @@ + + + + + + + + + + + + + + diff --git a/src/Forms/VobSubCharactersImport.Designer.cs b/src/Forms/VobSubCharactersImport.Designer.cs new file mode 100644 index 000000000..0a362a19e --- /dev/null +++ b/src/Forms/VobSubCharactersImport.Designer.cs @@ -0,0 +1,235 @@ +namespace Nikse.SubtitleEdit.Forms +{ + sealed partial class VobSubCharactersImport + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.listView1 = new System.Windows.Forms.ListView(); + this.ColumnImport = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.ColumnText = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.buttonImport = new System.Windows.Forms.Button(); + this.buttonCancel = new System.Windows.Forms.Button(); + this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog(); + this.imageList1 = new System.Windows.Forms.ImageList(this.components); + this.buttonFixesSelectAll = new System.Windows.Forms.Button(); + this.buttonFixesInverse = new System.Windows.Forms.Button(); + this.labelInfo = new System.Windows.Forms.Label(); + this.groupBoxCurrentImage = new System.Windows.Forms.GroupBox(); + this.pictureBox1 = new System.Windows.Forms.PictureBox(); + this.labelCurrentImage = new System.Windows.Forms.Label(); + this.buttonDone = new System.Windows.Forms.Button(); + this.groupBoxCurrentImage.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); + this.SuspendLayout(); + // + // listView1 + // + this.listView1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left))); + this.listView1.CheckBoxes = true; + this.listView1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.ColumnImport, + this.ColumnText}); + this.listView1.FullRowSelect = true; + this.listView1.GridLines = true; + this.listView1.HideSelection = false; + this.listView1.Location = new System.Drawing.Point(12, 56); + this.listView1.MultiSelect = false; + this.listView1.Name = "listView1"; + this.listView1.Size = new System.Drawing.Size(450, 426); + this.listView1.TabIndex = 0; + this.listView1.UseCompatibleStateImageBehavior = false; + this.listView1.View = System.Windows.Forms.View.Details; + this.listView1.SelectedIndexChanged += new System.EventHandler(this.listView1_SelectedIndexChanged); + // + // ColumnImport + // + this.ColumnImport.Text = "Import"; + this.ColumnImport.Width = 80; + // + // ColumnText + // + this.ColumnText.Text = "Text"; + this.ColumnText.Width = 340; + // + // buttonImport + // + this.buttonImport.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.buttonImport.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.buttonImport.Location = new System.Drawing.Point(337, 493); + this.buttonImport.Name = "buttonImport"; + this.buttonImport.Size = new System.Drawing.Size(125, 21); + this.buttonImport.TabIndex = 4; + this.buttonImport.Text = "I&mport"; + this.buttonImport.UseVisualStyleBackColor = true; + this.buttonImport.Click += new System.EventHandler(this.buttonImport_Click); + // + // buttonCancel + // + 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.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.buttonCancel.Location = new System.Drawing.Point(759, 493); + this.buttonCancel.Name = "buttonCancel"; + this.buttonCancel.Size = new System.Drawing.Size(75, 21); + this.buttonCancel.TabIndex = 5; + this.buttonCancel.Text = "C&ancel"; + this.buttonCancel.UseVisualStyleBackColor = true; + // + // openFileDialog1 + // + this.openFileDialog1.FileName = "openFileDialog1"; + // + // imageList1 + // + this.imageList1.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit; + this.imageList1.ImageSize = new System.Drawing.Size(16, 16); + this.imageList1.TransparentColor = System.Drawing.Color.Transparent; + // + // buttonFixesSelectAll + // + this.buttonFixesSelectAll.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.buttonFixesSelectAll.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.buttonFixesSelectAll.Location = new System.Drawing.Point(12, 493); + this.buttonFixesSelectAll.Name = "buttonFixesSelectAll"; + this.buttonFixesSelectAll.Size = new System.Drawing.Size(75, 21); + this.buttonFixesSelectAll.TabIndex = 105; + this.buttonFixesSelectAll.Text = "Select &all"; + this.buttonFixesSelectAll.UseVisualStyleBackColor = true; + this.buttonFixesSelectAll.Click += new System.EventHandler(this.buttonFixesSelectAll_Click); + // + // buttonFixesInverse + // + this.buttonFixesInverse.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.buttonFixesInverse.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.buttonFixesInverse.Location = new System.Drawing.Point(93, 493); + this.buttonFixesInverse.Name = "buttonFixesInverse"; + this.buttonFixesInverse.Size = new System.Drawing.Size(100, 21); + this.buttonFixesInverse.TabIndex = 106; + this.buttonFixesInverse.Text = "&Inverse selection"; + this.buttonFixesInverse.UseVisualStyleBackColor = true; + this.buttonFixesInverse.Click += new System.EventHandler(this.buttonFixesInverse_Click); + // + // labelInfo + // + this.labelInfo.AutoSize = true; + this.labelInfo.Location = new System.Drawing.Point(12, 22); + this.labelInfo.Name = "labelInfo"; + this.labelInfo.Size = new System.Drawing.Size(47, 13); + this.labelInfo.TabIndex = 107; + this.labelInfo.Text = "labelInfo"; + // + // groupBoxCurrentImage + // + this.groupBoxCurrentImage.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.groupBoxCurrentImage.Controls.Add(this.pictureBox1); + this.groupBoxCurrentImage.Controls.Add(this.labelCurrentImage); + this.groupBoxCurrentImage.Location = new System.Drawing.Point(469, 56); + this.groupBoxCurrentImage.Name = "groupBoxCurrentImage"; + this.groupBoxCurrentImage.Size = new System.Drawing.Size(365, 426); + this.groupBoxCurrentImage.TabIndex = 108; + this.groupBoxCurrentImage.TabStop = false; + this.groupBoxCurrentImage.Text = "Current image"; + // + // pictureBox1 + // + this.pictureBox1.BackColor = System.Drawing.Color.Red; + this.pictureBox1.Location = new System.Drawing.Point(19, 107); + this.pictureBox1.Name = "pictureBox1"; + this.pictureBox1.Size = new System.Drawing.Size(52, 52); + this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage; + this.pictureBox1.TabIndex = 109; + this.pictureBox1.TabStop = false; + // + // labelCurrentImage + // + this.labelCurrentImage.AutoSize = true; + this.labelCurrentImage.Location = new System.Drawing.Point(16, 30); + this.labelCurrentImage.Name = "labelCurrentImage"; + this.labelCurrentImage.Size = new System.Drawing.Size(88, 13); + this.labelCurrentImage.TabIndex = 108; + this.labelCurrentImage.Text = "CurrentImageInfo"; + // + // buttonDone + // + this.buttonDone.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonDone.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.buttonDone.Location = new System.Drawing.Point(628, 493); + this.buttonDone.Name = "buttonDone"; + this.buttonDone.Size = new System.Drawing.Size(125, 21); + this.buttonDone.TabIndex = 109; + this.buttonDone.Text = "&Done"; + this.buttonDone.UseVisualStyleBackColor = true; + this.buttonDone.Click += new System.EventHandler(this.buttonDone_Click); + // + // VobSubCharactersImport + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(846, 526); + this.Controls.Add(this.buttonDone); + this.Controls.Add(this.groupBoxCurrentImage); + this.Controls.Add(this.labelInfo); + this.Controls.Add(this.buttonFixesSelectAll); + this.Controls.Add(this.buttonFixesInverse); + this.Controls.Add(this.buttonImport); + this.Controls.Add(this.buttonCancel); + this.Controls.Add(this.listView1); + this.Name = "VobSubCharactersImport"; + this.ShowIcon = false; + this.ShowInTaskbar = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Shown += new System.EventHandler(this.VobSubCharactersImport_Shown); + this.groupBoxCurrentImage.ResumeLayout(false); + this.groupBoxCurrentImage.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.ListView listView1; + private System.Windows.Forms.Button buttonImport; + private System.Windows.Forms.Button buttonCancel; + private System.Windows.Forms.OpenFileDialog openFileDialog1; + private System.Windows.Forms.ColumnHeader ColumnImport; + private System.Windows.Forms.ColumnHeader ColumnText; + private System.Windows.Forms.ImageList imageList1; + private System.Windows.Forms.Button buttonFixesSelectAll; + private System.Windows.Forms.Button buttonFixesInverse; + private System.Windows.Forms.Label labelInfo; + private System.Windows.Forms.GroupBox groupBoxCurrentImage; + private System.Windows.Forms.Label labelCurrentImage; + private System.Windows.Forms.PictureBox pictureBox1; + private System.Windows.Forms.Button buttonDone; + } +} \ No newline at end of file diff --git a/src/Forms/VobSubCharactersImport.cs b/src/Forms/VobSubCharactersImport.cs new file mode 100644 index 000000000..2084f98dc --- /dev/null +++ b/src/Forms/VobSubCharactersImport.cs @@ -0,0 +1,220 @@ +using System; +using System.Collections.Generic; +using System.Drawing; +using System.IO; +using System.Linq; +using System.Windows.Forms; +using Nikse.SubtitleEdit.Core; +using Nikse.SubtitleEdit.Logic.Ocr.Binary; + +namespace Nikse.SubtitleEdit.Forms +{ + public sealed partial class VobSubCharactersImport : Form + { + + public class ListViewData + { + public bool Checked { get; set; } + public BinaryOcrBitmap BinaryOcrBitmap { get; set; } + } + + private readonly BinaryOcrDb _existingDb; + private readonly List _data = new List(); + private int _selectCount; + + public VobSubCharactersImport(BinaryOcrDb binaryOcrDb) + { + InitializeComponent(); + + _existingDb = binaryOcrDb; + + labelInfo.Text = string.Empty; + labelCurrentImage.Text = string.Empty; + Text = string.Format("Import OCR images into \"{0}\"", Path.GetFileName(_existingDb.FileName)); + buttonCancel.Text = Configuration.Settings.Language.General.Cancel; + } + + private void VobSubCharactersImport_Shown(object sender, EventArgs e) + { + openFileDialog1.Filter = "Binary OCR db files|*.db"; + if (openFileDialog1.ShowDialog(this) == DialogResult.OK) + { + imageList1.ImageSize = new Size(40, 40); + LoadImagesInListView(); + } + else + { + Close(); + } + listView1.ItemChecked += listView1_ItemChecked; + UpdateSelectCount(); + } + + private void LoadImagesInListView() + { + int existingMatches = 0; + listView1.SmallImageList = imageList1; + listView1.BeginUpdate(); + var importDb = new BinaryOcrDb(openFileDialog1.FileName, true); + var list = new List(); + list.AddRange(importDb.CompareImages); + list.AddRange(importDb.CompareImagesExpanded); + foreach (var bob in list.OrderBy(p => p.Text)) + { + if (bob.ExpandCount > 0 && _existingDb.FindExactMatchExpanded(bob) < 0) + { + AddToListView(bob); + } + else if (bob.ExpandCount == 0 && _existingDb.FindExactMatch(bob) < 0) + { + AddToListView(bob); + } + else + { + existingMatches++; + } + } + listView1.EndUpdate(); + if (listView1.Items.Count > 0) + { + listView1.Items[0].Selected = true; + listView1.Items[0].Focused = true; + } + labelInfo.Text = string.Format("Images found not in current db: {0:#,##0} ({1:#,##0} matches already in current db)", imageList1.Images.Count, existingMatches); + } + + private void AddToListView(BinaryOcrBitmap bob) + { + _data.Add(new ListViewData { Checked = true, BinaryOcrBitmap = bob }); + + var item = new ListViewItem(string.Empty) { Tag = bob, Checked = true }; + item.SubItems.Add(bob.ToString()); + listView1.Items.Add(item); + imageList1.Images.Add(bob.ToOldBitmap(Color.Black)); + item.ImageIndex = imageList1.Images.Count - 1; + } + + private void listView1_SelectedIndexChanged(object sender, EventArgs e) + { + if (listView1.SelectedItems.Count < 1) + return; + + var item = listView1.SelectedItems[0]; + var bob = (BinaryOcrBitmap)item.Tag; + labelCurrentImage.Text = "Text: " + bob.Text + Environment.NewLine + + "Size: " + bob.Width + "x" + bob.Height + Environment.NewLine + + "Italic: " + (bob.Italic ? "Yes" : "No") + Environment.NewLine; + + if (pictureBox1.Image != null) + { + try + { + var b = (Bitmap)pictureBox1.Image; + b.Dispose(); + } + catch (Exception) + { + + } + } + + var bmp = bob.ToOldBitmap(); + pictureBox1.Image = bmp; + pictureBox1.Width = bmp.Width + 2; + pictureBox1.Height = bmp.Height + 2; + pictureBox1.SizeMode = PictureBoxSizeMode.CenterImage; + } + + private void buttonFixesSelectAll_Click(object sender, EventArgs e) + { + listView1.ItemChecked -= listView1_ItemChecked; + + foreach (ListViewItem item in listView1.Items) + item.Checked = true; + + foreach (ListViewData d in _data) + d.Checked = true; + + UpdateSelectCount(); + + listView1.ItemChecked += listView1_ItemChecked; + + } + + private void buttonFixesInverse_Click(object sender, EventArgs e) + { + listView1.ItemChecked -= listView1_ItemChecked; + + foreach (ListViewItem item in listView1.Items) + item.Checked = !item.Checked; + + foreach (ListViewData d in _data) + d.Checked = !d.Checked; + + UpdateSelectCount(); + + listView1.ItemChecked += listView1_ItemChecked; + } + + private void buttonDone_Click(object sender, EventArgs e) + { + DialogResult = DialogResult.OK; + } + + private void listView1_ItemChecked(object sender, ItemCheckedEventArgs e) + { + if (e.Item == null) + return; + + var idx = e.Item.Index; + _data[idx].Checked = listView1.Items[idx].Checked; + UpdateSelectCount(); + } + + private void UpdateSelectCount() + { + _selectCount = 0; + foreach (ListViewData d in _data) + { + if (d.Checked) + { + _selectCount++; + } + } + buttonImport.Text = string.Format("Import {0:#,##0}", _selectCount); + } + + private void buttonImport_Click(object sender, EventArgs e) + { + int count = 0; + foreach (ListViewData d in _data) + { + if (d.Checked) + { + if (d.BinaryOcrBitmap.ExpandCount == 0 && _existingDb.FindExactMatch(d.BinaryOcrBitmap) < 0) + { + count++; + _existingDb.Add(d.BinaryOcrBitmap); + } + else if (d.BinaryOcrBitmap.ExpandCount > 0 && _existingDb.FindExactMatchExpanded(d.BinaryOcrBitmap) < 0) + { + count++; + _existingDb.Add(d.BinaryOcrBitmap); + } + } + } + _existingDb.Save(); + MessageBox.Show(string.Format("{0:#,##0} images imported", count)); + + // reload + listView1.ItemChecked -= listView1_ItemChecked; + listView1.Items.Clear(); + _data.Clear(); + imageList1.Images.Clear(); + LoadImagesInListView(); + listView1.ItemChecked += listView1_ItemChecked; + UpdateSelectCount(); + } + + } +} diff --git a/src/Forms/VobSubCharactersImport.resx b/src/Forms/VobSubCharactersImport.resx new file mode 100644 index 000000000..e55f0fe0c --- /dev/null +++ b/src/Forms/VobSubCharactersImport.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + + 157, 17 + + \ No newline at end of file diff --git a/src/Forms/VobSubEditCharacters.Designer.cs b/src/Forms/VobSubEditCharacters.Designer.cs index cc52c8402..9f9411277 100644 --- a/src/Forms/VobSubEditCharacters.Designer.cs +++ b/src/Forms/VobSubEditCharacters.Designer.cs @@ -50,6 +50,7 @@ this.buttonCancel = new System.Windows.Forms.Button(); this.labelCount = new System.Windows.Forms.Label(); this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog(); + this.button1 = new System.Windows.Forms.Button(); this.groupBoxCurrentCompareImage.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); @@ -262,11 +263,25 @@ this.labelCount.TabIndex = 8; this.labelCount.Text = "labelCount"; // + // button1 + // + this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.button1.DialogResult = System.Windows.Forms.DialogResult.OK; + this.button1.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.button1.Location = new System.Drawing.Point(453, 27); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(123, 21); + this.button1.TabIndex = 9; + this.button1.Text = "&Import"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // // VobSubEditCharacters // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(588, 426); + this.Controls.Add(this.button1); this.Controls.Add(this.labelCount); this.Controls.Add(this.buttonCancel); this.Controls.Add(this.groupBoxCurrentCompareImage); @@ -319,5 +334,6 @@ private System.Windows.Forms.ToolStripMenuItem saveImageAsToolStripMenuItem; private System.Windows.Forms.SaveFileDialog saveFileDialog1; private System.Windows.Forms.Label labelExpandCount; + private System.Windows.Forms.Button button1; } } \ No newline at end of file diff --git a/src/Forms/VobSubEditCharacters.cs b/src/Forms/VobSubEditCharacters.cs index 3b709e61b..ea40d18bd 100644 --- a/src/Forms/VobSubEditCharacters.cs +++ b/src/Forms/VobSubEditCharacters.cs @@ -278,9 +278,9 @@ namespace Nikse.SubtitleEdit.Forms bmp = bob.ToOldBitmap(); labelImageInfo.Text = string.Format("Top:{0}, {1} colored pixels of {2}", bob.Y, bob.NumberOfColoredPixels, (bob.Width * bob.Height)); - //bool italicI; - //var isI = bob.IsLowercaseI(out italicI); - //labelImageInfo.Text = string.Format("T:{0} j{1} :{2} i{3}{4} '{5} #{6}/{7}", bob.Y, bob.IsLowercaseJ(), bob.IsColon(), isI, italicI ? "i" : "", bob.IsApostrophe(), bob.NumberOfColoredPixels, (bob.Width * bob.Height)); + bool italicI; + var isI = bob.IsLowercaseI(out italicI); + labelImageInfo.Text = string.Format("T:{0} j{1} :{2} i{3}{4} '{5} #{6}/{7}", bob.Y, bob.IsLowercaseJ(), bob.IsColon(), isI, italicI ? "i" : "", bob.IsApostrophe(), bob.NumberOfColoredPixels, (bob.Width * bob.Height)); if (bob.ExpandCount > 0) { @@ -635,5 +635,14 @@ namespace Nikse.SubtitleEdit.Forms } } + private void button1_Click(object sender, EventArgs e) + { + using (var form = new VobSubCharactersImport(_binOcrDb)) + { + form.ShowDialog(this); + DialogResult = DialogResult.OK; + } + } + } } diff --git a/src/Logic/OCR/Binary/BinaryOcrBitmap.cs b/src/Logic/OCR/Binary/BinaryOcrBitmap.cs index 61977a4b3..39822c92a 100644 --- a/src/Logic/OCR/Binary/BinaryOcrBitmap.cs +++ b/src/Logic/OCR/Binary/BinaryOcrBitmap.cs @@ -239,6 +239,11 @@ namespace Nikse.SubtitleEdit.Logic.Ocr.Binary } public Bitmap ToOldBitmap() + { + return ToOldBitmap(Color.White); + } + + public Bitmap ToOldBitmap(Color color) { if (ExpandedList != null && ExpandedList.Count > 0) { @@ -274,7 +279,7 @@ namespace Nikse.SubtitleEdit.Logic.Ocr.Binary } } - return nbmp.ToOldBitmap(); // Resursive + return nbmp.ToOldBitmap(color); // Resursive } else { @@ -285,7 +290,7 @@ namespace Nikse.SubtitleEdit.Logic.Ocr.Binary { Color c = Color.Transparent; if (GetPixel(x, y) > 0) - c = Color.White; + c = color; nbmp.SetPixel(x, y, c); } } diff --git a/src/SubtitleEdit.csproj b/src/SubtitleEdit.csproj index e2767c813..751a3b6c5 100644 --- a/src/SubtitleEdit.csproj +++ b/src/SubtitleEdit.csproj @@ -721,6 +721,12 @@ VisualSync.cs + + Form + + + VobSubCharactersImport.cs + Form @@ -1206,6 +1212,9 @@ VisualSync.cs Designer + + VobSubCharactersImport.cs + VobSubNOcrCharacterInspect.cs