我有一个项目是读取捕获图像中的字符,但我被困在扫描图像的按钮上。我最终在 c# 中使用了 tesseract dll,但我不知道如何编码。我是这个编程的新手。
private void Browse_Click(object sender, EventArgs e)
{
//FileInfo fi = new FileInfo(string.Format(@"C:\Documents and Settings\JOrce0201610\My Documents\Visual Studio 2005\Projects\OCR Reader\{0}", imageName));
OpenFileDialog fi = new OpenFileDialog();
fi.InitialDirectory = @"C:\\Documents and Settings\JOrce0201610\My Documents\Visual Studio 2005\Projects\OCR Reader\Card";
fi.Filter = "BMP Image|*.bmp";
fi.FilterIndex = 2;
fi.RestoreDirectory = true;
if (fi.ShowDialog() == DialogResult.OK)
{
//image file path
textBox1.Text = fi.FileName;
//display image in picture box
pictureBox1.Image = new Bitmap(fi.FileName);
}
}
private void Scan_Click(object sender, EventArgs e)
{
Bitmap temp = source.Clone() as Bitmap; //Clone image to keep original image
FiltersSequence seq = new FiltersSequence();
seq.Add(Grayscale.CommonAlgorithms.BT709); //First add GrayScaling filter
seq.Add(new OtsuThreshold()); //Then add binarization(thresholding) filter
temp = seq.Apply(source); // Apply filters on source image