コード例 #1
0
        public void get_recog(byte[] p_bt, int p_len, int w, int h, int p_stride)
        {
            try
            {
                se.smartid.Image sm_img = new se.smartid.Image(p_bt, (uint)Math.Abs(p_stride) * 3, w, h, Math.Abs(p_stride), 3);
                recog_result = session.ProcessImage(sm_img);
            }
            catch (Exception e)
            {
                MessageBox.Show("Error " + e);
            }

            if (recog_result.IsTerminal() || cnt >= RecogCnt.Value)
            {
                if (File.Exists(curr_dir + @"\recognize.log"))
                {
                    File.Delete(curr_dir + @"\recognize.log");
                }

                System.IO.FileStream ostrm = new FileStream(curr_dir + @"\recognize.log", FileMode.OpenOrCreate, FileAccess.Write);
                StreamWriter         writer;
                TextWriter           oldOut = Console.Out;

                writer = new StreamWriter(ostrm);
                Console.SetOut(writer);

                Console.WriteLine("Start recognize application");
                Console.WriteLine("--------------------------------");

                reporter = new CsReporter();

                // this is important: GC works differently with native-heap objects
                OutputRecognitionResult(recog_result);

                recog_result.Dispose();
                session.Dispose();
                engine.Dispose();
                reporter.Dispose();

                Console.WriteLine("End application!");
                Console.SetOut(oldOut);

                writer.Close();
                ostrm.Close();
                destroy();
            }
            else
            {
                cnt++;
                pBar.PerformStep();
                Capture();
            }
        }
コード例 #2
0
        private void destroy()
        {
            mediaCtrl.Stop();

            if (recog_result != null)
            {
                recog_result.Dispose();
            }

            if (session != null)
            {
                session.Dispose();
            }

            if (settings != null)
            {
                settings.Dispose();
            }

            if (engine != null)
            {
                engine.Dispose();
            }

            if (reporter != null)
            {
                reporter.Dispose();
            }

            capDevices = null;
            savedArray = null;

            videoPanel.Dispose();
            //pBar.Dispose();
            //Form1.Dispose();

            Application.Exit();
        }