protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            // Get our button from the layout resource,
            // and attach an event to it
            Button button = FindViewById <Button>(Resource.Id.MyButton);

            button.Click += delegate
            {
                TessBaseAPI api    = new TessBaseAPI(new MyProcessNotifier());
                bool        result = api.Init("/mnt/sdcard/tesseract-ocr/", "eng");
                ///storage/emulated/0/DCIM/Camera/IMG_20150530_124916.jpg
                //ExifInterface exif = new ExifInterface("/storage/emulated/0/DCIM/Camera/IMG_20150530_124916.jpg");
                BitmapFactory.Options options = new BitmapFactory.Options();
                options.InSampleSize = 4;

                Bitmap bitmap = BitmapFactory.DecodeFile("/storage/emulated/0/DCIM/Camera/IMG_20150530_124916.jpg", options);
                api.SetImage(bitmap);
                String recognizedText = api.UTF8Text;
                api.End();
            };
        }
示例#2
0
        public void GetText(Bitmap bitmap = null)
        {
            TessBaseAPI api    = new TessBaseAPI();
            bool        result = api.Init("/storage/emulated/0/DCIM/Facebook", "por");

            BitmapFactory.Options options = new BitmapFactory.Options();
            options.InSampleSize = 4;


            Bitmap bit = BitmapFactory.DecodeFile("/storage/emulated/0/DCIM/Facebook/joao.jpg");

            api.SetImage(bit);
            String recognizedText = api.UTF8Text;

            txtView.Text = recognizedText;
            api.End();
        }