Пример #1
0
        private void button16_Click(object sender, EventArgs e)
        {
            string fileName = Application.StartupPath + "\\" + textSubsystemBMP.Text;
            Bitmap bmp      = new Bitmap(fileName);
            IntPtr hBmp     = bmp.GetHbitmap();

            byte[] data = new byte[1024];
            if (!ANNWrapper.RecognitionBlackText(hBmp,
                                                 int.Parse(textLeft.Text),
                                                 int.Parse(textTop.Text),
                                                 int.Parse(textRight.Text),
                                                 int.Parse(textBottom.Text),
                                                 int.Parse(textInputInt.Text),
                                                 Application.StartupPath + "\\" + textInputTIF.Text,
                                                 data))
            {
                MessageBox.Show("Recognition Black File Failed");
            }
            else
            {
                string text = System.Text.Encoding.GetEncoding("GB2312").GetString(data, 0, data.Length);
                text = text.Substring(0, text.IndexOf("\0"));
                textOCRContent.Text = text;
            }
            DeleteObject(hBmp);
        }