Example #1
0
        private void toolStripMenuItemInspectNOcrMatches_Click(object sender, EventArgs e)
        {
            if (subtitleListView1.SelectedItems.Count != 1)
                return;

            if (_nOcrDb == null)
            {
                LoadNOcrWithCurrentLanguage();
                if (_nOcrDb == null)
                {
                    MessageBox.Show("Unable to load OCR database.", string.Empty, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
            }

            Cursor = Cursors.WaitCursor;
            Bitmap bitmap = GetSubtitleBitmap(subtitleListView1.SelectedItems[0].Index);
            bool oldPrompt = checkBoxPromptForUnknownWords.Checked;
            string result = OcrViaNOCR(bitmap, subtitleListView1.SelectedItems[0].Index);
            checkBoxPromptForUnknownWords.Checked = oldPrompt;
            Cursor = Cursors.Default;
            using (var inspect = new VobSubNOcrCharacterInspect())
            {
                bool oldCorrect = checkBoxNOcrCorrect.Checked;
                checkBoxNOcrCorrect.Checked = false;
                inspect.Initialize(bitmap, (int)numericUpDownNumberOfPixelsIsSpaceNOCR.Value, checkBoxRightToLeft.Checked, _nOcrDb, this);
                if (inspect.ShowDialog(this) == DialogResult.OK)
                {
                    Cursor = Cursors.WaitCursor;
                    SaveNOcrWithCurrentLanguage();
                    Cursor = Cursors.Default;
                }
                checkBoxNOcrCorrect.Checked = oldCorrect;
            }
        }
Example #2
0
        private void toolStripMenuItemInspectNOcrMatches_Click(object sender, EventArgs e)
        {
            if (subtitleListView1.SelectedItems.Count != 1)
                return;

            if (_nocrChars == null)
                LoadNOcrWithCurrentLanguage();

            Cursor = Cursors.WaitCursor;
            Bitmap bitmap = GetSubtitleBitmap(subtitleListView1.SelectedItems[0].Index);
            bool oldPrompt = checkBoxPromptForUnknownWords.Checked;
            string result = OcrViaNOCR(bitmap, subtitleListView1.SelectedItems[0].Index);
            checkBoxPromptForUnknownWords.Checked = oldPrompt;
            Cursor = Cursors.Default;
            var inspect = new VobSubNOcrCharacterInspect();
            bool oldCorrect = checkBoxNOcrCorrect.Checked;
            checkBoxNOcrCorrect.Checked = false;
            inspect.Initialize(bitmap, (int)numericUpDownNumberOfPixelsIsSpaceNOCR.Value, checkBoxRightToLeft.Checked, _nocrChars, this, _unItalicFactor);
            if (inspect.ShowDialog(this) == DialogResult.OK)
            {
                Cursor = Cursors.WaitCursor;
                SaveNOcrWithCurrentLanguage();
                Cursor = Cursors.Default;
            }
            checkBoxNOcrCorrect.Checked = oldCorrect;
        }