Example #1
0
        public Viz3dPage()
        {
            var button = this.GetButton();

            button.Text     = "Show 3D Viz";
            button.Clicked += (sender, args) =>
            {
                using (Viz3d viz = new Viz3d("show_simple_widgets"))
                {
                    viz.SetBackgroundMeshLab();
                    using (WCoordinateSystem coor = new WCoordinateSystem())
                    {
                        viz.ShowWidget("coor", coor);
                        using (WCube cube = new WCube(
                                   new MCvPoint3D64f(-.5, -.5, -.5),
                                   new MCvPoint3D64f(.5, .5, .5),
                                   true,
                                   new MCvScalar(255, 255, 255)))
                        {
                            viz.ShowWidget("cube", cube);
                            using (WCube cube0 = new WCube(
                                       new MCvPoint3D64f(-1, -1, -1),
                                       new MCvPoint3D64f(-.5, -.5, -.5),
                                       false,
                                       new MCvScalar(123, 45, 200)))
                            {
                                viz.ShowWidget("cub0", cube0);
                                viz.Spin();
                            }
                        }
                    }
                }
            };
        }
Example #2
0
        static void Main(string[] args)
        {
            Viz3d viz = new Viz3d("show_simple_widgets");

            viz.SetBackgroundMeshLab();
            WCoordinateSystem coor = new WCoordinateSystem();

            viz.ShowWidget("coor", coor);
            WCube cube = new WCube(new MCvPoint3D64f(-.5, -.5, -.5), new MCvPoint3D64f(.5, .5, .5), true, new MCvScalar(255, 255, 255));

            viz.ShowWidget("cube", cube);
            WCube cube0 = new WCube(new MCvPoint3D64f(-1, -1, -1), new MCvPoint3D64f(-.5, -.5, -.5), false, new MCvScalar(123, 45, 200));

            viz.ShowWidget("cub0", cube0);
            viz.Spin();

            String win1 = "Test Window";                    //The name of the window

            CvInvoke.NamedWindow(win1);                     //Create the window using the specific name

            Mat img = new Mat(200, 400, DepthType.Cv8U, 3); //Create a 3 channel image of 400x200

            img.SetTo(new Bgr(255, 0, 0).MCvScalar);        // set it to Blue color

            //Draw "Hello, world." on the image using the specific font
            CvInvoke.PutText(
                img,
                "Hello, world",
                new System.Drawing.Point(10, 80),
                FontFace.HersheyComplex,
                1.0,
                new Bgr(0, 255, 0).MCvScalar);


            CvInvoke.Imshow(win1, img);   //Show the image
            CvInvoke.WaitKey(0);          //Wait for the key pressing event
            CvInvoke.DestroyWindow(win1); //Destroy the window if key is pressed
        }
 private void InitializeViz3D()
 {
     viz3d = new Viz3d("3D");
 }
Example #4
0
        public App()
        {
            Button helloWorldButton = new Button();

            helloWorldButton.Text = "Hello world";

            Button planarSubdivisionButton = new Button();

            planarSubdivisionButton.Text = "Planar Subdivision";

            Button faceDetectionButton = new Button();

            faceDetectionButton.Text = "Face Detection (CascadeClassifier)";

            Button faceLandmarkDetectionButton = new Button();

            faceLandmarkDetectionButton.Text = "Face Landmark Detection (DNN Module)";

            Button featureDetectionButton = new Button();

            featureDetectionButton.Text = "Feature Matching";

            Button shapeDetectionButton = new Button();

            shapeDetectionButton.Text = "Shape Detection";

            Button pedestrianDetectionButton = new Button();

            pedestrianDetectionButton.Text = "Pedestrian Detection";

            Button ocrButton = new Button();

            ocrButton.Text = "OCR";

            Button maskRcnnButton = new Button();

            maskRcnnButton.Text = "Mask RCNN (DNN module)";

            Button yoloButton = new Button();

            yoloButton.Text = "Yolo (DNN module)";

            Button stopSignDetectionButton = new Button();

            stopSignDetectionButton.Text = "Stop Sign Detection (DNN module)";

            List <View> buttonList = new List <View>()
            {
                helloWorldButton,
                planarSubdivisionButton,
                faceDetectionButton,
                faceLandmarkDetectionButton,
                featureDetectionButton,
                shapeDetectionButton,
                pedestrianDetectionButton,
                ocrButton,
                maskRcnnButton,
                stopSignDetectionButton,
                yoloButton,
            };

            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && Emgu.Util.Platform.ClrType != Emgu.Util.Platform.Clr.NetFxCore)
            {
                Button viz3dButton = new Button();
                viz3dButton.Text = "Simple 3D reconstruction";

                buttonList.Add(viz3dButton);

                viz3dButton.Clicked += (sender, args) =>
                {
                    Mat   left  = CvInvoke.Imread("imL.png", ImreadModes.Color);
                    Mat   right = CvInvoke.Imread("imR.png", ImreadModes.Color);
                    Viz3d v     = Simple3DReconstruct.GetViz3d(left, right);
                    v.Spin();
                };
            }

            StackLayout buttonsLayout = new StackLayout
            {
                VerticalOptions = LayoutOptions.Start,
            };

            foreach (View b in buttonList)
            {
                buttonsLayout.Children.Add(b);
            }

            // The root page of your application
            ContentPage page =
                new ContentPage()
            {
                Content = new ScrollView()
                {
                    Content = buttonsLayout,
                }
            };

            String aboutIcon = null;

            /*
             * String aboutIcon;
             * if (Emgu.Util.Platform.OperationSystem == Emgu.Util.Platform.OS.IOS)
             * {
             *  aboutIcon = null;
             * }
             * else if (Emgu.Util.Platform.ClrType == Emgu.Util.Platform.Clr.NetFxCore)
             *  aboutIcon = null;
             * else
             *  aboutIcon = "questionmark.png";*/

            MainPage =
                new NavigationPage(
                    page
                    );

            ToolbarItem aboutItem = new ToolbarItem("About", aboutIcon,
                                                    () =>
            {
                MainPage.Navigation.PushAsync(new AboutPage());
                //page.DisplayAlert("Emgu CV Examples", "App version: ...", "Ok");
            }
                                                    );

            page.ToolbarItems.Add(aboutItem);

            helloWorldButton.Clicked += (sender, args) =>
            {
                MainPage.Navigation.PushAsync(new HelloWorldPage());
            };

            planarSubdivisionButton.Clicked += (sender, args) =>
            {
                MainPage.Navigation.PushAsync(new PlanarSubdivisionPage());
            };

            faceDetectionButton.Clicked += (sender, args) =>
            {
                MainPage.Navigation.PushAsync(new FaceDetectionPage());
            };

            shapeDetectionButton.Clicked += (sender, args) =>
            {
                MainPage.Navigation.PushAsync(new ShapeDetectionPage());
            };

            pedestrianDetectionButton.Clicked += (sender, args) =>
            {
                MainPage.Navigation.PushAsync(new PedestrianDetectionPage());
            };

            featureDetectionButton.Clicked += (sender, args) =>
            {
                MainPage.Navigation.PushAsync(new FeatureMatchingPage());
            };

            if (Emgu.Util.Platform.ClrType == Emgu.Util.Platform.Clr.NetFxCore)
            {
                //No DNN module for UWP apps
                maskRcnnButton.IsVisible = false;
                faceLandmarkDetectionButton.IsVisible = false;
                stopSignDetectionButton.IsVisible     = false;
                yoloButton.IsVisible = false;
            }
            else
            {
                maskRcnnButton.Clicked += (sender, args) => { MainPage.Navigation.PushAsync(new MaskRcnnPage()); };
                faceLandmarkDetectionButton.Clicked += (sender, args) => { MainPage.Navigation.PushAsync(new FaceLandmarkDetectionPage()); };
                stopSignDetectionButton.Clicked     += (sender, args) =>
                {
                    MaskRcnnPage stopSignDetectionPage = new MaskRcnnPage();
                    stopSignDetectionPage.DefaultImage      = "stop-sign.jpg";
                    stopSignDetectionPage.ObjectsOfInterest = new string[] { "stop sign" };
                    MainPage.Navigation.PushAsync(stopSignDetectionPage);
                };
                yoloButton.Clicked += (sender, args) => { MainPage.Navigation.PushAsync(new YoloPage()); };
            }

            ocrButton.Clicked += (sender, args) =>
            {
                MainPage.Navigation.PushAsync(new OcrPage());
            };
        }
Example #5
0
        public App()
        {
            Button helloWorldButton = new Button();

            helloWorldButton.Text = "Hello world";

            Button planarSubdivisionButton = new Button();

            planarSubdivisionButton.Text = "Planar Subdivision";

            Button faceDetectionButton = new Button();

            faceDetectionButton.Text = "Face Detection (CascadeClassifier)";

            Button faceLandmarkDetectionButton = new Button();

            faceLandmarkDetectionButton.Text = "Face Landmark Detection (DNN Module)";

            Button sceneTextDetectionButton = new Button();

            sceneTextDetectionButton.Text = "Scene Text detection (DNN Module)";

            Button featureDetectionButton = new Button();

            featureDetectionButton.Text = "Feature Matching";

            Button shapeDetectionButton = new Button();

            shapeDetectionButton.Text = "Shape Detection";

            Button pedestrianDetectionButton = new Button();

            pedestrianDetectionButton.Text = "Pedestrian Detection";

            Button ocrButton = new Button();

            ocrButton.Text = "OCR";

            Button maskRcnnButton = new Button();

            maskRcnnButton.Text = "Mask RCNN (DNN module)";

            Button yoloButton = new Button();

            yoloButton.Text = "Yolo (DNN module)";

            Button stopSignDetectionButton = new Button();

            stopSignDetectionButton.Text = "Stop Sign Detection (DNN module)";

            Button licensePlateRecognitionButton = new Button();

            licensePlateRecognitionButton.Text = "License Plate Recognition (DNN Module)";

            List <View> buttonList = new List <View>()
            {
                helloWorldButton,
                planarSubdivisionButton,
                faceDetectionButton,
                faceLandmarkDetectionButton,
                sceneTextDetectionButton,
                featureDetectionButton,
                shapeDetectionButton,
                pedestrianDetectionButton,
                ocrButton,
                maskRcnnButton,
                stopSignDetectionButton,
                yoloButton,
                licensePlateRecognitionButton
            };

            var  openCVConfigDict = CvInvoke.ConfigDict;
            bool haveViz          = (openCVConfigDict["HAVE_OPENCV_VIZ"] != 0);
            bool haveDNN          = (openCVConfigDict["HAVE_OPENCV_DNN"] != 0);
            bool haveFreetype     = (openCVConfigDict["HAVE_OPENCV_FREETYPE"] != 0);

            bool hasInferenceEngine = false;

            if (haveDNN)
            {
                var dnnBackends = DnnInvoke.AvailableBackends;
                hasInferenceEngine = Array.Exists(dnnBackends, dnnBackend =>
                                                  (dnnBackend.Backend == Dnn.Backend.InferenceEngine ||
                                                   dnnBackend.Backend == Dnn.Backend.InferenceEngineNgraph ||
                                                   dnnBackend.Backend == Dnn.Backend.InferenceEngineNnBuilder2019));
            }

            if (haveViz)
            {
                Button viz3dButton = new Button();
                viz3dButton.Text = "Simple 3D reconstruction";

                buttonList.Add(viz3dButton);

                viz3dButton.Clicked += (sender, args) =>
                {
                    using (Mat left = CvInvoke.Imread("imL.png", ImreadModes.Color))
                        using (Mat right = CvInvoke.Imread("imR.png", ImreadModes.Color))
                            using (Mat points = new Mat())
                                using (Mat colors = new Mat())
                                {
                                    Simple3DReconstruct.GetPointAndColor(left, right, points, colors);
                                    Viz3d v = Simple3DReconstruct.GetViz3d(points, colors);
                                    v.Spin();
                                }
                };
            }

            if (haveFreetype)
            {
                Button freetypeButton = new Button();
                freetypeButton.Text = "Free Type";

                buttonList.Add(freetypeButton);

                freetypeButton.Clicked += (sender, args) =>
                {
                    MainPage.Navigation.PushAsync(new FreetypePage());
                };
            }

            StackLayout buttonsLayout = new StackLayout
            {
                VerticalOptions = LayoutOptions.Start,
            };

            foreach (View b in buttonList)
            {
                buttonsLayout.Children.Add(b);
            }

            // The root page of your application
            ContentPage page =
                new ContentPage()
            {
                Content = new ScrollView()
                {
                    Content = buttonsLayout,
                }
            };

            String aboutIcon = null;

            /*
             * String aboutIcon;
             * if (Emgu.Util.Platform.OperationSystem == Emgu.Util.Platform.OS.IOS)
             * {
             *  aboutIcon = null;
             * }
             * else if (Emgu.Util.Platform.ClrType == Emgu.Util.Platform.Clr.NetFxCore)
             *  aboutIcon = null;
             * else
             *  aboutIcon = "questionmark.png";*/

            NavigationPage navigationPage = new NavigationPage(page);

            MainPage = navigationPage;

            //Fix for UWP navigation text
            if (Device.RuntimePlatform == Device.WPF)
            {
                navigationPage.BarTextColor = Color.Green;
            }


            ToolbarItem aboutItem = new ToolbarItem("About", aboutIcon,
                                                    () =>
            {
                MainPage.Navigation.PushAsync(new AboutPage());
                //page.DisplayAlert("Emgu CV Examples", "App version: ...", "Ok");
            }
                                                    );

            page.ToolbarItems.Add(aboutItem);

            helloWorldButton.Clicked += (sender, args) => { MainPage.Navigation.PushAsync(new HelloWorldPage()); };

            planarSubdivisionButton.Clicked += (sender, args) =>
            {
                MainPage.Navigation.PushAsync(new PlanarSubdivisionPage());
            };

            faceDetectionButton.Clicked += (sender, args) =>
            {
                ProcessAndRenderPage faceAndEyeDetectorPage = new ProcessAndRenderPage(
                    new CascadeFaceAndEyeDetector(),
                    "Face and eye detection (Cascade classifier)",
                    "lena.jpg",
                    "Cascade classifier");
                MainPage.Navigation.PushAsync(faceAndEyeDetectorPage);
            };

            shapeDetectionButton.Clicked += (sender, args) =>
            {
                ProcessAndRenderPage shapeDetectionPage = new ProcessAndRenderPage(
                    new ShapeDetector(),
                    "Shape detection",
                    "pic3.png",
                    "Shape detection");
                MainPage.Navigation.PushAsync(shapeDetectionPage);
            };

            pedestrianDetectionButton.Clicked += (sender, args) =>
            {
                ProcessAndRenderPage pedestrianDetectorPage = new ProcessAndRenderPage(
                    new PedestrianDetector(),
                    "Pedestrian detection",
                    "pedestrian.png",
                    "HOG pedestrian detection");
                MainPage.Navigation.PushAsync(pedestrianDetectorPage);
            };

            featureDetectionButton.Clicked += (sender, args) =>
            {
                MainPage.Navigation.PushAsync(new FeatureMatchingPage());
            };

            licensePlateRecognitionButton.Clicked += (sender, args) =>
            {
                ProcessAndRenderPage vehicleLicensePlateDetectorPage = new ProcessAndRenderPage(
                    new VehicleLicensePlateDetector(),
                    "Perform License Plate Recognition",
                    "cars_license_plate.png",
                    "This demo is based on the security barrier camera demo in the OpenVino model zoo. The models is trained with BIT-vehicle dataset. License plate is trained based on Chinese license plate that has white character on blue background. You will need to re-train your own model if you intend to use this in other countries.");
                MainPage.Navigation.PushAsync(vehicleLicensePlateDetectorPage);
            };

            maskRcnnButton.Clicked += (sender, args) =>
            {
                ProcessAndRenderPage maskRcnnPage = new ProcessAndRenderPage(
                    new MaskRcnn(),
                    "Mask-rcnn Detection",
                    "dog416.png",
                    "");
                MainPage.Navigation.PushAsync(maskRcnnPage);
            };

            faceLandmarkDetectionButton.Clicked += (sender, args) =>
            {
                ProcessAndRenderPage faceLandmarkDetectionPage = new ProcessAndRenderPage(
                    new FaceAndLandmarkDetector(),
                    "Perform Face Landmark Detection",
                    "lena.jpg",
                    "");
                MainPage.Navigation.PushAsync(faceLandmarkDetectionPage);
            };
            sceneTextDetectionButton.Clicked += (sender, args) =>
            {
                ProcessAndRenderPage sceneTextDetectionPage = new ProcessAndRenderPage(
                    new SceneTextDetector(),
                    "Perform Scene Text Detection",
                    "cars_license_plate.png",
                    "This model is trained on MSRA-TD500, so it can detect both English and Chinese text instances.");
                MainPage.Navigation.PushAsync(sceneTextDetectionPage);
            };
            stopSignDetectionButton.Clicked += (sender, args) =>
            {
                MaskRcnn model = new MaskRcnn();
                model.ObjectsOfInterest = new string[] { "stop sign" };
                ProcessAndRenderPage stopSignDetectionPage = new ProcessAndRenderPage(
                    model,
                    "Mask-rcnn Detection",
                    "stop-sign.jpg",
                    "Stop sign detection using Mask RCNN");

                MainPage.Navigation.PushAsync(stopSignDetectionPage);
            };
            yoloButton.Clicked += (sender, args) =>
            {
                ProcessAndRenderPage yoloPage = new ProcessAndRenderPage(
                    new Yolo(),
                    "Yolo Detection",
                    "dog416.png",
                    "");
                MainPage.Navigation.PushAsync(yoloPage);
            };

            ocrButton.Clicked += (sender, args) =>
            {
                MainPage.Navigation.PushAsync(new OcrPage());
            };

            maskRcnnButton.IsVisible = haveDNN;
            faceLandmarkDetectionButton.IsVisible = haveDNN;
            stopSignDetectionButton.IsVisible     = haveDNN;
            yoloButton.IsVisible = haveDNN;
            sceneTextDetectionButton.IsVisible      = haveDNN && haveFreetype;
            licensePlateRecognitionButton.IsVisible = hasInferenceEngine;
        }
Example #6
0
        public App()
        {
            Button helloWorldButton = new Button();

            helloWorldButton.Text = "Hello world";

            Button planarSubdivisionButton = new Button();

            planarSubdivisionButton.Text = "Planar Subdivision";

            Button faceDetectionButton = new Button();

            faceDetectionButton.Text = "Face Detection (CascadeClassifier)";

            Button faceLandmarkDetectionButton = new Button();

            faceLandmarkDetectionButton.Text = "Face Landmark Detection (DNN Module)";

            Button featureDetectionButton = new Button();

            featureDetectionButton.Text = "Feature Matching";

            Button shapeDetectionButton = new Button();

            shapeDetectionButton.Text = "Shape Detection";

            Button pedestrianDetectionButton = new Button();

            pedestrianDetectionButton.Text = "Pedestrian Detection";

            Button ocrButton = new Button();

            ocrButton.Text = "OCR";

            Button maskRcnnButton = new Button();

            maskRcnnButton.Text = "Mask RCNN (DNN module)";

            Button yoloButton = new Button();

            yoloButton.Text = "Yolo (DNN module)";

            Button stopSignDetectionButton = new Button();

            stopSignDetectionButton.Text = "Stop Sign Detection (DNN module)";

            Button licensePlateRecognitionButton = new Button();

            licensePlateRecognitionButton.Text = "License Plate Recognition";

            List <View> buttonList = new List <View>()
            {
                helloWorldButton,
                planarSubdivisionButton,
                faceDetectionButton,
                faceLandmarkDetectionButton,
                featureDetectionButton,
                shapeDetectionButton,
                pedestrianDetectionButton,
                ocrButton,
                maskRcnnButton,
                stopSignDetectionButton,
                yoloButton,
                licensePlateRecognitionButton
            };

            var  openCVConfigDict   = CvInvoke.ConfigDict;
            bool haveViz            = (openCVConfigDict["HAVE_OPENCV_VIZ"] != 0);
            bool haveDNN            = (openCVConfigDict["HAVE_OPENCV_DNN"] != 0);
            bool hasInferenceEngine = false;

            if (haveDNN)
            {
                var dnnBackends = DnnInvoke.AvailableBackends;
                hasInferenceEngine = Array.Exists(dnnBackends, dnnBackend =>
                                                  (dnnBackend.Backend == Dnn.Backend.InferenceEngine ||
                                                   dnnBackend.Backend == Dnn.Backend.InferenceEngineNgraph ||
                                                   dnnBackend.Backend == Dnn.Backend.InferenceEngineNnBuilder2019));
            }

            if (haveViz)
            {
                Button viz3dButton = new Button();
                viz3dButton.Text = "Simple 3D reconstruction";

                buttonList.Add(viz3dButton);

                viz3dButton.Clicked += (sender, args) =>
                {
                    Mat   left  = CvInvoke.Imread("imL.png", ImreadModes.Color);
                    Mat   right = CvInvoke.Imread("imR.png", ImreadModes.Color);
                    Viz3d v     = Simple3DReconstruct.GetViz3d(left, right);
                    v.Spin();
                };
            }

            StackLayout buttonsLayout = new StackLayout
            {
                VerticalOptions = LayoutOptions.Start,
            };

            foreach (View b in buttonList)
            {
                buttonsLayout.Children.Add(b);
            }

            // The root page of your application
            ContentPage page =
                new ContentPage()
            {
                Content = new ScrollView()
                {
                    Content = buttonsLayout,
                }
            };

            String aboutIcon = null;

            /*
             * String aboutIcon;
             * if (Emgu.Util.Platform.OperationSystem == Emgu.Util.Platform.OS.IOS)
             * {
             *  aboutIcon = null;
             * }
             * else if (Emgu.Util.Platform.ClrType == Emgu.Util.Platform.Clr.NetFxCore)
             *  aboutIcon = null;
             * else
             *  aboutIcon = "questionmark.png";*/

            NavigationPage navigationPage = new NavigationPage(page);

            MainPage = navigationPage;

            //Fix for UWP navigation text
            if (Device.RuntimePlatform == Device.WPF)
            {
                navigationPage.BarTextColor = Color.Green;
            }


            ToolbarItem aboutItem = new ToolbarItem("About", aboutIcon,
                                                    () =>
            {
                MainPage.Navigation.PushAsync(new AboutPage());
                //page.DisplayAlert("Emgu CV Examples", "App version: ...", "Ok");
            }
                                                    );

            page.ToolbarItems.Add(aboutItem);

            helloWorldButton.Clicked += (sender, args) => { MainPage.Navigation.PushAsync(new HelloWorldPage()); };

            planarSubdivisionButton.Clicked += (sender, args) =>
            {
                MainPage.Navigation.PushAsync(new PlanarSubdivisionPage());
            };

            faceDetectionButton.Clicked += (sender, args) =>
            {
                MainPage.Navigation.PushAsync(new FaceDetectionPage());
            };

            shapeDetectionButton.Clicked += (sender, args) =>
            {
                MainPage.Navigation.PushAsync(new ShapeDetectionPage());
            };

            pedestrianDetectionButton.Clicked += (sender, args) =>
            {
                MainPage.Navigation.PushAsync(new PedestrianDetectionPage());
            };

            featureDetectionButton.Clicked += (sender, args) =>
            {
                MainPage.Navigation.PushAsync(new FeatureMatchingPage());
            };

            licensePlateRecognitionButton.Clicked += (sender, args) =>
            {
                MainPage.Navigation.PushAsync(new LicensePlateRecognitionPage());
            };

            maskRcnnButton.Clicked += (sender, args) => { MainPage.Navigation.PushAsync(new MaskRcnnPage()); };
            faceLandmarkDetectionButton.Clicked += (sender, args) => { MainPage.Navigation.PushAsync(new FaceLandmarkDetectionPage()); };
            stopSignDetectionButton.Clicked     += (sender, args) =>
            {
                MaskRcnnPage stopSignDetectionPage = new MaskRcnnPage();
                stopSignDetectionPage.DefaultImage      = "stop-sign.jpg";
                stopSignDetectionPage.ObjectsOfInterest = new string[] { "stop sign" };
                MainPage.Navigation.PushAsync(stopSignDetectionPage);
            };
            yoloButton.Clicked += (sender, args) => { MainPage.Navigation.PushAsync(new YoloPage()); };

            ocrButton.Clicked += (sender, args) =>
            {
                MainPage.Navigation.PushAsync(new OcrPage());
            };

            maskRcnnButton.IsVisible = haveDNN;
            faceLandmarkDetectionButton.IsVisible = haveDNN;
            stopSignDetectionButton.IsVisible     = haveDNN;
            yoloButton.IsVisible = haveDNN;
            licensePlateRecognitionButton.IsVisible = hasInferenceEngine;
        }
Example #7
0
        public App()
        {
            Button helloWorldButton = new Button();

            helloWorldButton.Text = "Hello world";

            Button planarSubdivisionButton = new Button();

            planarSubdivisionButton.Text = "Planar Subdivision";

            Button faceDetectionButton = new Button();

            faceDetectionButton.Text = "Face Detection";

            Button faceLandmarkDetectionButton = new Button();

            faceLandmarkDetectionButton.Text = "Face Landmark Detection";

            Button featureDetectionButton = new Button();

            featureDetectionButton.Text = "Feature Matching";

            Button pedestrianDetectionButton = new Button();

            pedestrianDetectionButton.Text = "Pedestrian Detection";

            Button ocrButton = new Button();

            ocrButton.Text = "OCR";

            Button dnnButton = new Button();

            dnnButton.Text = "DNN";

            List <View> buttonList = new List <View>()
            {
                helloWorldButton,
                planarSubdivisionButton,
                faceDetectionButton,
                faceLandmarkDetectionButton,
                featureDetectionButton,
                pedestrianDetectionButton,
                ocrButton,
                dnnButton
            };

            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && Emgu.Util.Platform.ClrType != ClrType.NetFxCore)
            {
                Button viz3dButton = new Button();
                viz3dButton.Text = "Viz3D";

                buttonList.Add(viz3dButton);

                viz3dButton.Clicked += (sender, args) =>
                {
                    using (Viz3d viz = new Viz3d("show_simple_widgets"))
                    {
                        viz.SetBackgroundMeshLab();
                        using (WCoordinateSystem coor = new WCoordinateSystem())
                        {
                            viz.ShowWidget("coor", coor);
                            using (WCube cube = new WCube(
                                       new MCvPoint3D64f(-.5, -.5, -.5),
                                       new MCvPoint3D64f(.5, .5, .5),
                                       true,
                                       new MCvScalar(255, 255, 255)))
                            {
                                viz.ShowWidget("cube", cube);
                                using (WCube cube0 = new WCube(
                                           new MCvPoint3D64f(-1, -1, -1),
                                           new MCvPoint3D64f(-.5, -.5, -.5),
                                           false,
                                           new MCvScalar(123, 45, 200)))
                                {
                                    viz.ShowWidget("cub0", cube0);
                                    viz.Spin();
                                }
                            }
                        }
                    }
                };
            }

            StackLayout buttonsLayout = new StackLayout
            {
                VerticalOptions = LayoutOptions.Start,
            };

            foreach (View b in buttonList)
            {
                buttonsLayout.Children.Add(b);
            }

            // The root page of your application
            ContentPage page =
                new ContentPage()
            {
                Content = new ScrollView()
                {
                    Content = buttonsLayout,
                }
            };

            String aboutIcon;

            if (Emgu.Util.Platform.ClrType != ClrType.NetFxCore)
            {
                aboutIcon = "questionmark.png";
            }
            else
            {
                aboutIcon = null;
            }

            MainPage =
                new NavigationPage(
                    page
                    );

            ToolbarItem aboutItem = new ToolbarItem("About", aboutIcon,
                                                    () =>
            {
                MainPage.Navigation.PushAsync(new AboutPage());
                //page.DisplayAlert("Emgu CV Examples", "App version: ...", "Ok");
            }
                                                    );

            page.ToolbarItems.Add(aboutItem);

            helloWorldButton.Clicked += (sender, args) =>
            {
                MainPage.Navigation.PushAsync(new HelloWorldPage());
            };

            planarSubdivisionButton.Clicked += (sender, args) =>
            {
                MainPage.Navigation.PushAsync(new PlanarSubdivisionPage());
            };

            faceDetectionButton.Clicked += (sender, args) =>
            {
                MainPage.Navigation.PushAsync(new FaceDetectionPage());
            };

            pedestrianDetectionButton.Clicked += (sender, args) =>
            {
                MainPage.Navigation.PushAsync(new PedestrianDetectionPage());
            };

            featureDetectionButton.Clicked += (sender, args) =>
            {
                MainPage.Navigation.PushAsync(new FeatureMatchingPage());
            };

            if (Emgu.Util.Platform.ClrType == ClrType.NetFxCore)
            {
                //No DNN module for UWP apps
                dnnButton.IsVisible = false;
                faceLandmarkDetectionButton.IsVisible = false;
            }
            else
            {
                dnnButton.Clicked += (sender, args) => { MainPage.Navigation.PushAsync(new DnnPage()); };
                faceLandmarkDetectionButton.Clicked += (sender, args) => { MainPage.Navigation.PushAsync(new FaceLandmarkDetectionPage()); };
            }

            ocrButton.Clicked += (sender, args) =>
            {
                MainPage.Navigation.PushAsync(new OcrPage());
            };
        }