protected override void OnCreate(Bundle savedInstanceState)
        {
            Log.Info(TAG, "called onCreate");
            base.OnCreate(savedInstanceState);

            //string APPLICATION_RAW_PATH = "android.resource://" + PackageName + "/";
            ISharedPreferences preference = Android.Preferences.PreferenceManager.GetDefaultSharedPreferences(ApplicationContext);
            FileInfo           eyeFile    = Emgu.Util.AndroidFileAsset.WritePermanantFileAsset(this, "haarcascade_eye.xml", "cascade", 0);
            FileInfo           faceFile   = Emgu.Util.AndroidFileAsset.WritePermanantFileAsset(this, "haarcascade_frontalface_alt_tree.xml", "cascade", 0);

            //string[] items = System.IO.Directory.GetFiles("../../Resources/raw"); //BREAKS S***E

            try
            {
                //using (var istr = Resources.OpenRawResource(Resource.Raw.haarcascade_frontalface_alt_tree))
                //{

                /*
                 * Java.IO.File cascadeDir = GetDir("raw", FileCreationMode.Private);
                 * Java.IO.File mCascadeFile = new Java.IO.File(cascadeDir, "haarcascade_frontalface_alt_tree.xml");
                 * using (Java.IO.FileOutputStream os = new Java.IO.FileOutputStream(mCascadeFile))
                 * {
                 *  int byteRead;
                 *  while ((byteRead = istr.ReadByte()) != -1)
                 *      os.Write(byteRead);
                 * }*/
                //var tmp = Resource.Raw.haarcascade_frontalface_alt_tree;
                FACE = new CascadeClassifier(faceFile.FullName); // preference.GetString("cascade-face-data-path", null));  //(APPLICATION_RAW_PATH + tmp);

                /*
                 * mCascadeFile = new Java.IO.File(cascadeDir, "haarcascade_eye.xml");
                 * using (Java.IO.FileOutputStream os = new Java.IO.FileOutputStream(mCascadeFile))
                 * {
                 *  int byteRead;
                 *  while ((byteRead = istr.ReadByte()) != -1)
                 *      os.Write(byteRead);
                 * }*/
                //tmp = Resource.Raw.haarcascade_eye;
                EYE = new CascadeClassifier(eyeFile.FullName);
                //}

                //if (FACE.isEmpty| EYE.isEmpty)
                //   Log.Error(TAG, "Empty cascade");
            }
            catch (IOException e)
            {
                Log.Error(TAG, "Failed to load cascade. Exception thrown: " + e.StackTrace);
            }

            RequestWindowFeature(WindowFeatures.NoTitle);
            Window.AddFlags(WindowManagerFlags.Fullscreen);
            Window.AddFlags(WindowManagerFlags.KeepScreenOn);

            SetContentView(Resource.Layout.color_blob_detection_surface_view);

            mOpenCvCameraView            = FindViewById <CameraBridgeViewBase>(Resource.Id.color_blob_detection_activity_surface_view);
            mOpenCvCameraView.Visibility = ViewStates.Visible;
            mOpenCvCameraView.SetCvCameraViewListener2(this);
            mLoaderCallback = new Callback(this, this);
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            Log.Info(TAG, "called onCreate");
            base.OnCreate(savedInstanceState);
            mLoaderCallback = new Callback(this, this);
            Window.AddFlags(WindowManagerFlags.KeepScreenOn);
            SetContentView(Resource.Layout.tutorial2_surface_view);

            mOpenCvCameraView            = FindViewById <CameraBridgeViewBase>(Resource.Id.tutorial2_activity_surface_view);
            mOpenCvCameraView.Visibility = ViewStates.Visible;
            mOpenCvCameraView.SetCvCameraViewListener2(this);
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            Log.Info("BlobDetection", "called onCreate");
            base.OnCreate(savedInstanceState);
            RequestWindowFeature(WindowFeatures.NoTitle);

            Window.AddFlags(WindowManagerFlags.KeepScreenOn);

            SetContentView(Resource.Layout.color_blob_detection_surface_view);

            mOpenCvCameraView            = FindViewById <CameraBridgeViewBase>(Resource.Id.color_blob_detection_activity_surface_view);
            mOpenCvCameraView.Visibility = ViewStates.Visible;
            mOpenCvCameraView.SetCvCameraViewListener2(this);
            mLoaderCallback = new Callback(this, this);
        }
示例#4
0
        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

            mLoaderCallback = new Callback(this);
            if (IsThereAnAppToTakePictures())
            {
                CreateDirectoryForPictures();

                Button button = FindViewById <Button>(Resource.Id.myButton);
                _imageView        = FindViewById <ImageView>(Resource.Id.imageView1);
                _edgeDetectedView = FindViewById <ImageView>(Resource.Id.imageView2);
                button.Click     += TakeAPicture;
            }
        }