sakshi tiwari

sakshi tiwari

  • NA
  • 16
  • 5.9k

Image to text conversion

Feb 9 2017 5:00 AM
I am trying to convert image to text using emguCV but it is showing me error tess.reconize instance not set for reference. My code is
 
using Emgu.CV;
using Emgu.Util;
using Emgu.CV.CvEnum;
using Emgu.CV.OCR;
using Emgu.CV.Structure;
using Emgu.CV.UI;
using Emgu.CV.Util;
namespace jo
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
Tesseract tess;
Image img;
private void button1_Click(object sender, EventArgs e)
{
DialogResult dr = openFileDialog1.ShowDialog();
if (dr == DialogResult.OK)
{
textBox1.Text = openFileDialog1.FileName;
}
img = Image.FromFile(openFileDialog1.FileName);
pictureBox1.Image = img; pro(); textBox2.Text = tess.GetText();
}
        public void load()
{
try
{
tess = new Tesseract("tessdata", "eng", Tesseract.OcrEngineMode.OEM_DEFAULT);
}
catch (Exception ex)
{
MessageBox.Show(ex.GetBaseException().ToString());
} }
private void Form1_Load(object sender, EventArgs e)
{ load(); }
public void pro() { tess.Recognize<Bgr>(new Image<Bgr, byte>(textBox1.Text)); } } }? 

Answers (1)