public ActionResult ConfiguraColonne([Bind(Exclude = "IDSezioneProp,IDlist")] CombinedModel obj)
        {
            DBElementwareCommesseEntities DB = new DBElementwareCommesseEntities();

            foreach (var IDSez in DB.TAB_COLONNE)
            {
                ID = IDSez.IDColonna;
            }

            ID = ID + 1;


            if (DB.TAB_COLONNE.Count().Equals(0))
            {
                ID = 0;
            }

            obj.ColonneModel.IDSez     = obj.SezModel.IDSez;
            obj.ColonneModel.IDColonna = ID;

            if (ModelState.IsValid)
            {
                DB.TAB_COLONNE.Add(obj.ColonneModel);
                DB.SaveChanges();
            }

            return(RedirectToAction("ConfiguraColonne", "Home"));
        }
        public ActionResult ConfiguraColonne()
        {
            DBElementwareCommesseEntities DB = new DBElementwareCommesseEntities();
            CombinedModel obj = new CombinedModel();


            if (Session["ISUsingConfig"] == null)
            {
                Session["ISUsingConfig"] = false;
            }

            int IDConf = int.Parse(Session["IDConfigurazione"].ToString());

            if (bool.Parse(Session["ISUsingConfig"].ToString()))
            {
                obj.ColonneModel = new TAB_COLONNE();
                var cf = DB.TAB_CONFIGURAZIONE_SEZIONI.Where(x => x.IDConfigurazione == IDConf).ToList();

                obj.ColonneModel.IDlist = new SelectList(cf, "IDSez", "IDSez");

                return(View(obj));
            }
            else
            {
                obj.ColonneModel        = new TAB_COLONNE();
                obj.ColonneModel.IDlist = new SelectList(DB.TAB_SEZ, "IDSez", "IDSez");
                return(View(obj));
            }
        }
Beispiel #3
0
        public ActionResult Create(CombinedModel cm, Enroll en)
        {
            try
            {
                db.Students.Add(cm.ViewStudent);
                db.SaveChanges();
                cm.ViewEnroll.StudentID = cm.ViewStudent.StudentId;
                cm.ViewEnroll.CourseID  = (int)en.CourseID;
                db.Enrolls.Add(cm.ViewEnroll);
                db.SaveChanges();
                cm.ViewInstallment.EnrollmentId = cm.ViewEnroll.EnrollId;
                db.Installments.Add(cm.ViewInstallment);
                db.SaveChanges();
                // TODO: Add insert logic here

                return(RedirectToAction("Index"));
            }
            catch
            {
                ViewBag.CourseID = new SelectList(db.Courses, "CourseId", "CourseName", cm.ViewEnroll.CourseID);
                return(View(cm));
            }

            return(View("index"));
        }
Beispiel #4
0
        public void TryThis()
        {
            bool save = false;

            if (res == null)
            {
                save     = true;
                res      = ScriptableObject.CreateInstance <ClusterMatResources>();
                res.name = "SceneManager";
                res.clusterProperties = new List <ClusterProperty>();
            }
            Func <ClusterProperty, ClusterProperty, bool> equalCompare = (a, b) =>
            {
                return(a.name == b.name);
            };
            ClusterProperty property = new ClusterProperty();

            property.name = modelName;
            foreach (var i in res.clusterProperties)
            {
                if (equalCompare(property, i))
                {
                    Debug.LogError("Already Contained Scene " + modelName);
                    return;
                }
            }
            LODGroup[] groups = GetComponentsInChildren <LODGroup>();
            Dictionary <MeshRenderer, bool> lowLevelDict = new Dictionary <MeshRenderer, bool>();

            foreach (var i in groups)
            {
                LOD[] lods = i.GetLODs();
                for (int j = 1; j < lods.Length; ++j)
                {
                    foreach (var k in lods[j].renderers)
                    {
                        if (k.GetType() == typeof(MeshRenderer))
                        {
                            lowLevelDict.Add(k as MeshRenderer, true);
                        }
                    }
                }
            }
            CombinedModel model = ProcessCluster(GetComponentsInChildren <MeshRenderer>(false), lowLevelDict);

            property.vm              = model.vm;
            property.clusterCount    = ClusterGenerator.GenerateCluster(model.allPoints, model.bound, modelName, voxelCount, res.clusterProperties.Count);
            res.maximumMaterialCount = Mathf.Max(1, res.maximumMaterialCount);
            res.maximumMaterialCount = Mathf.Max(res.maximumMaterialCount, model.vm.allProperties.Count);
            res.clusterProperties.Add(property);
            if (save)
            {
                AssetDatabase.CreateAsset(res, "Assets/SceneManager.asset");
            }
            else
            {
                EditorUtility.SetDirty(res);
            }
        }
Beispiel #5
0
        // Generate return model
        async Task <CombinedModel> GetCombinedModel(Calculation calculation)
        {
            CombinedModel combinedModel = new CombinedModel();

            combinedModel.Calculation = calculation;
            combinedModel.RequestLogs = await _context.RequestLog.OrderByDescending(m => m.Id).Take(RequestLog.Limit).ToListAsync();

            return(combinedModel);
        }
Beispiel #6
0
        //
        // GET: /Main/

        public ActionResult Index()
        {
            CombinedModel cm = new CombinedModel();

            cm.ViewListCourse      = db.Courses.ToList();
            cm.ViewListEnroll      = db.Enrolls.ToList();
            cm.ViewListInstallment = db.Installments.ToList();
            cm.ViewListStudent     = db.Students.ToList();
            return(View(cm));
        }
Beispiel #7
0
        public async Task <IActionResult> Completed()
        {
            ApplicationUser currentUser = await _userManager.GetUserAsync(HttpContext.User);

            CombinedModel combined = new CombinedModel
            {
                CompletedViewModel = new CompletedViewModel(await _repository.GetCompleted(new Guid(currentUser.Id)))
            };

            return(View(combined));
        }
Beispiel #8
0
        /// <summary>
        /// Gets combined model data created by Apply().
        /// </summary>
        /// <param name="combinedModelOut">Combined model data out.</param>
        /// <returns>True if successful.</returns>
        public bool GetCombinedModel(out CombinedModel combinedModelOut)
        {
            // Must be sealed
            if (!isSealed)
            {
                combinedModelOut = new CombinedModel();
                return(false);
            }

            combinedModelOut = combinedModel;

            return(true);
        }
Beispiel #9
0
        public IActionResult BrutoIndex()
        {
            UserModel     user     = _session.GetObjectFromJson <UserModel>("session");
            CombinedModel combined = new CombinedModel();

            combined.user = user;

            if (user != null)
            {
                return(View("Bruto", combined));
            }

            return(RedirectToAction("LogIn"));
        }
Beispiel #10
0
        public async Task <IActionResult> Calculate([Bind("Neto")] BrutoModel brutoModel)
        {
            UserModel user = _session.GetObjectFromJson <UserModel>("session");

            if (ModelState.IsValid)
            {
                int neto = brutoModel.Neto;

                double brutoJedan = neto / _bruto;

                double pioCalc   = brutoJedan * _pio;
                double zoCalc    = brutoJedan * _zo;
                double odnCalc   = brutoJedan * _odn;
                double porezCalc = brutoJedan * _porez;

                // Sve zajedno = bruto
                int bruto = (int)Math.Round(pioCalc + zoCalc + odnCalc + neto + porezCalc);

                BrutoViewModel brutoCalc = new BrutoViewModel(
                    neto,
                    bruto,
                    pioCalc,
                    zoCalc,
                    odnCalc,
                    porezCalc,
                    bruto
                    );

                CombinedModel combined = new CombinedModel();
                combined.user      = user;
                combined.viewModel = brutoCalc;

                brutoModel.UserId = user.Id;
                brutoModel.Bruto  = bruto;
                brutoModel.Date   = DateTime.Now;

                _context.models.Add(brutoModel);
                await _context.SaveChangesAsync();


                return(View("Result", combined));
            }
            else
            {
                return(View());
            }
        }
Beispiel #11
0
        public async Task <IActionResult> Index()
        {
            UserModel     user     = _session.GetObjectFromJson <UserModel>("session");
            CombinedModel combined = new CombinedModel();

            if (user != null)
            {
                var update = await _context.Users
                             .Include(u => u.models)
                             .Where(u => u.Email == user.Email)
                             .FirstOrDefaultAsync();

                combined.user = update;

                return(View(combined));
            }

            return(RedirectToAction("LogIn"));
        }
    private void Do()
    {
        Scene scene = SceneManager.GetActiveScene();

        sceneName = scene.name.Replace("workscene_", "");

        LODGroup[] groups = GetComponentsInChildren <LODGroup>();
        Dictionary <MeshRenderer, bool> lowLevelDict = new Dictionary <MeshRenderer, bool>();

        foreach (var i in groups)
        {
            LOD[] lods = i.GetLODs();
            for (int j = 1; j < lods.Length; ++j)
            {
                foreach (var k in lods[j].renderers)
                {
                    if (k.GetType() == typeof(MeshRenderer))
                    {
                        lowLevelDict.Add(k as MeshRenderer, true);
                    }
                }
            }
        }

        resPath = PATH_FOLDER + sceneName + "/";

        CombinedModel model        = ProcessCluster(GetComponentsInChildren <MeshRenderer>(false), lowLevelDict);
        int           clusterCount = GetCluster(model.allPoints, model.bound, out NativeList <Cluster> boxes, out NativeList <Point> points, voxelCount);

        ClusterUtils.CheckPath(PATH_FOLDER);
        ClusterUtils.CheckPath(resPath.ToString());
        ClusterUtils.WriteBytes(resPath + PATH_VERTEX + sceneName, points);
        ClusterUtils.WriteBytes(resPath + PATH_CLUSTER + sceneName, boxes);

        AddSceneStreaming(model.vm, clusterCount);

        SaveAsGameScene();
    }
Beispiel #13
0
        public void TryThis()
        {
            string fileName = ClusterMatResources.infosPath + modelName + ".mpipe";

            if (!property)
            {
                Debug.LogError("Property Empty!");
            }

            if (string.IsNullOrEmpty(modelName))
            {
                Debug.LogError("Name Empty!");
                return;
            }
            if (File.Exists(fileName))
            {
                Debug.LogError("File Already Exists!");
                return;
            }


            bool save = false;

            if (!res)
            {
                res = AssetDatabase.LoadAssetAtPath <ClusterMatResources>("Assets/SceneManager.asset");
            }
            if (!res)
            {
                save     = true;
                res      = ScriptableObject.CreateInstance <ClusterMatResources>();
                res.name = "SceneManager";
            }
            SceneStreamLoader loader = new SceneStreamLoader();

            loader.fsm        = new FileStream(fileName, FileMode.OpenOrCreate, FileAccess.ReadWrite);
            property.fileName = modelName;
            LODGroup[] groups = GetComponentsInChildren <LODGroup>();
            Dictionary <MeshRenderer, bool> lowLevelDict = new Dictionary <MeshRenderer, bool>();

            foreach (var i in groups)
            {
                LOD[] lods = i.GetLODs();
                for (int j = 1; j < lods.Length; ++j)
                {
                    foreach (var k in lods[j].renderers)
                    {
                        if (k.GetType() == typeof(MeshRenderer))
                        {
                            lowLevelDict.Add(k as MeshRenderer, true);
                        }
                    }
                }
            }
            CombinedModel model = ProcessCluster(GetComponentsInChildren <MeshRenderer>(false), ref loader, lowLevelDict);

            loader.clusterCount = ClusterGenerator.GenerateCluster(model.allPoints, model.allMatIndex, model.bound, voxelCount, ref loader);

            res.maximumMaterialCount = Mathf.Max(1, res.maximumMaterialCount);
            res.maximumMaterialCount = Mathf.Max(res.maximumMaterialCount, loader.allProperties.Length);
            if (save)
            {
                AssetDatabase.CreateAsset(res, "Assets/SceneManager.asset");
            }
            else
            {
                EditorUtility.SetDirty(res);
            }
            loader.SaveAll();
            loader.Dispose();
        }
        public void TryThis()
        {
            bool save = false;

            if (res == null)
            {
                save     = true;
                res      = ScriptableObject.CreateInstance <ClusterMatResources>();
                res.name = "SceneManager";
                res.clusterProperties = new List <ClusterProperty>();
            }

            ClusterProperty property = new ClusterProperty();

            property.name = modelName;
            int containIndex = -1;

            for (int i = 0; i < res.clusterProperties.Count; ++i)
            {
                if (property.name == res.clusterProperties[i].name)
                {
                    containIndex = i;
                    break;
                }
            }
            LODGroup[] groups = GetComponentsInChildren <LODGroup>();
            Dictionary <MeshRenderer, bool> lowLevelDict = new Dictionary <MeshRenderer, bool>();

            foreach (var i in groups)
            {
                LOD[] lods = i.GetLODs();
                for (int j = 1; j < lods.Length; ++j)
                {
                    foreach (var k in lods[j].renderers)
                    {
                        if (k.GetType() == typeof(MeshRenderer))
                        {
                            lowLevelDict.Add(k as MeshRenderer, true);
                        }
                    }
                }
            }
            CombinedModel model = ProcessCluster(GetComponentsInChildren <MeshRenderer>(false), lowLevelDict);

            property.vm              = model.vm;
            property.clusterCount    = ClusterGenerator.GenerateCluster(model.allPoints, model.allMatIndex, model.bound, modelName, voxelCount, containIndex < 0 ? res.clusterProperties.Count : containIndex);
            res.maximumMaterialCount = Mathf.Max(1, res.maximumMaterialCount);
            res.maximumMaterialCount = Mathf.Max(res.maximumMaterialCount, model.vm.allProperties.Count);
            if (containIndex < 0)
            {
                res.clusterProperties.Add(property);
            }
            else
            {
                res.clusterProperties[containIndex] = property;
            }
            if (save)
            {
                AssetDatabase.CreateAsset(res, "Assets/SceneManager.asset");
            }
            else
            {
                EditorUtility.SetDirty(res);
            }
        }
Beispiel #15
0
        /// <summary>
        /// Apply all model combines and seal builder.
        /// </summary>
        public void Apply()
        {
            // Do nothing if sealed
            if (isSealed)
            {
                return;
            }

            // Count total vertices and indices
            int totalVertices = 0;
            int totalIndices  = 0;

            foreach (var item in builderDictionary)
            {
                totalVertices += item.Value.Vertices.Count;
                totalIndices  += item.Value.Indices.Count;
            }

            // Create combined data
            combinedModel           = new CombinedModel();
            combinedModel.Vertices  = new Vector3[totalVertices];
            combinedModel.Normals   = new Vector3[totalVertices];
            combinedModel.UVs       = new Vector2[totalVertices];
            combinedModel.Indices   = new int[totalIndices];
            combinedModel.SubMeshes = new SubMesh[builderDictionary.Count];

            // Populate static arrays
            int currentVertex = 0;
            int currentIndex  = 0;
            int subMeshIndex  = 0;

            foreach (var item in builderDictionary)
            {
                // Save current highest vertex and index
                int highestVertex = currentVertex;
                int highestIndex  = currentIndex;

                // Copy vertex data
                for (int i = 0; i < item.Value.Vertices.Count; i++)
                {
                    combinedModel.Vertices[currentVertex] = item.Value.Vertices[i];
                    combinedModel.Normals[currentVertex]  = item.Value.Normals[i];
                    combinedModel.UVs[currentVertex]      = item.Value.UVs[i];
                    currentVertex++;
                }

                // Copy index data
                for (int i = 0; i < item.Value.Indices.Count; i++)
                {
                    combinedModel.Indices[currentIndex++] = highestVertex + i;
                }

                // Add submesh
                int     frame;
                SubMesh sm = new SubMesh();
                sm.StartIndex     = highestIndex;
                sm.PrimitiveCount = item.Value.Indices.Count / 3;
                MaterialReader.ReverseTextureKey(item.Key, out sm.TextureArchive, out sm.TextureRecord, out frame);
                combinedModel.SubMeshes[subMeshIndex++] = sm;
            }

            Seal();
        }
Beispiel #16
0
        public App()
        {
            Button helloWorldButton = new Button();

            helloWorldButton.Text = "Hello world";

            Button planarSubdivisionButton = new Button();

            planarSubdivisionButton.Text = "Planar Subdivision";

            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 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,
                sceneTextDetectionButton,
                featureDetectionButton,
                shapeDetectionButton,
                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 haveFace         = (openCVConfigDict["HAVE_OPENCV_FACE"] != 0);
            bool haveWechatQRCode = (openCVConfigDict["HAVE_OPENCV_WECHAT_QRCODE"] != 0);
            bool haveBarcode      = (openCVConfigDict["HAVE_OPENCV_BARCODE"] != 0);
            bool haveObjdetect    = (openCVConfigDict["HAVE_OPENCV_OBJDETECT"] != 0);
            bool haveTesseract    = (openCVConfigDict["HAVE_EMGUCV_TESSERACT"] != 0);


            if (haveTesseract)
            {
                Button ocrButton = new Button();
                ocrButton.Text = "Tesseract OCR";
                buttonList.Add(ocrButton);

                ocrButton.Clicked += (sender, args) =>
                {
                    ProcessAndRenderPage ocrPage = new ProcessAndRenderPage(
                        new TesseractModel(),
                        "Perform Text Detection",
                        "test_image.png",
                        "");
                    ocrPage.HasCameraOption = false;
                    MainPage.Navigation.PushAsync(ocrPage);
                };
            }

            if (haveObjdetect)
            {
                Button faceDetectionButton = new Button();
                faceDetectionButton.Text = "Face Detection (CascadeClassifier)";
                buttonList.Add(faceDetectionButton);

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

                Button pedestrianDetectionButton = new Button();
                pedestrianDetectionButton.Text = "Pedestrian Detection";
                buttonList.Add(pedestrianDetectionButton);

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

            if (haveFace && haveDNN)
            {
                Button faceLandmarkDetectionButton = new Button();
                faceLandmarkDetectionButton.Text = "Face Landmark Detection (DNN Module)";
                buttonList.Add(faceLandmarkDetectionButton);
                faceLandmarkDetectionButton.Clicked += (sender, args) =>
                {
                    ProcessAndRenderPage faceLandmarkDetectionPage = new ProcessAndRenderPage(
                        new FaceAndLandmarkDetector(),
                        "Perform Face Landmark Detection",
                        "lena.jpg",
                        "");
                    MainPage.Navigation.PushAsync(faceLandmarkDetectionPage);
                };
            }

            if (haveWechatQRCode && haveBarcode
                //TODO: WeChatQRCode detector doesn't work on iOS, probably a bug in iOS
                //Will need to figure out why.
                && (Xamarin.Forms.Device.RuntimePlatform != Device.iOS)
                )
            {
                Button barcodeQrcodeDetectionButton = new Button();
                barcodeQrcodeDetectionButton.Text = "Barcode and QRCode Detection";
                buttonList.Add(barcodeQrcodeDetectionButton);
                barcodeQrcodeDetectionButton.Clicked += (sender, args) =>
                {
                    BarcodeDetectorModel barcodeDetector = new BarcodeDetectorModel();
                    WeChatQRCodeDetector qrcodeDetector  = new WeChatQRCodeDetector();
                    CombinedModel        combinedModel   = new CombinedModel(barcodeDetector, qrcodeDetector);

                    ProcessAndRenderPage barcodeQrcodeDetectionPage = new ProcessAndRenderPage(
                        combinedModel,
                        "Perform Barcode and QRCode Detection",
                        "qrcode_barcode.png",
                        "");
                    MainPage.Navigation.PushAsync(barcodeQrcodeDetectionPage);
                };
            }


            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());
            };



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

            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.");
                Picker p = vehicleLicensePlateDetectorPage.Picker;
                p.IsVisible = true;
                p.Title     = "Preferred DNN backend & target";

                foreach (String option in GetDnnBackends(DnnBackendType.InferenceEngineOnly))
                {
                    p.Items.Add(option);
                }
                MainPage.Navigation.PushAsync(vehicleLicensePlateDetectorPage);
            };

            maskRcnnButton.Clicked += (sender, args) =>
            {
                ProcessAndRenderPage maskRcnnPage = new ProcessAndRenderPage(
                    new MaskRcnn(),
                    "Mask-rcnn Detection",
                    "dog416.png",
                    "");
                Picker p = maskRcnnPage.Picker;
                p.IsVisible = true;
                p.Title     = "Preferred DNN backend & target";

                foreach (String option in GetDnnBackends())
                {
                    p.Items.Add(option);
                }

                MainPage.Navigation.PushAsync(maskRcnnPage);
            };


            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");
                Picker p = stopSignDetectionPage.Picker;
                p.IsVisible = true;
                p.Title     = "Preferred DNN backend & target";

                foreach (String option in GetDnnBackends())
                {
                    p.Items.Add(option);
                }
                MainPage.Navigation.PushAsync(stopSignDetectionPage);
            };
            yoloButton.Clicked += (sender, args) =>
            {
                ProcessAndRenderPage yoloPage = new ProcessAndRenderPage(
                    new Yolo(),
                    "Yolo Detection",
                    "dog416.png",
                    "");
                Picker p = yoloPage.Picker;
                p.Title     = "Yolo model version";
                p.IsVisible = true;
                p.Items.Add("YoloV4");
                p.Items.Add("YoloV4Tiny");
                p.Items.Add("YoloV3");
                p.Items.Add("YoloV3Spp");
                p.Items.Add("YoloV3Tiny");
                MainPage.Navigation.PushAsync(yoloPage);
            };



            maskRcnnButton.IsVisible = haveDNN;
            //faceLandmarkDetectionButton.IsVisible = haveDNN;
            stopSignDetectionButton.IsVisible = haveDNN;
            yoloButton.IsVisible = haveDNN;
            sceneTextDetectionButton.IsVisible      = haveDNN && haveFreetype;
            licensePlateRecognitionButton.IsVisible = hasInferenceEngine;
        }
        /// <summary>
        /// Gets combined model data created by Apply().
        /// </summary>
        /// <param name="combinedModelOut">Combined model data out.</param>
        /// <returns>True if successful.</returns>
        public bool GetCombinedModel(out CombinedModel combinedModelOut)
        {
            // Must be sealed
            if (!isSealed)
            {
                combinedModelOut = new CombinedModel();
                return false;
            }

            combinedModelOut = combinedModel;

            return true;
        }
        /// <summary>
        /// Apply all model combines and seal builder.
        /// </summary>
        public void Apply()
        {
            // Do nothing if sealed
            if (isSealed)
                return;

            // Count total vertices and indices
            int totalVertices = 0;
            int totalIndices = 0;
            foreach (var item in builderDictionary)
            {
                totalVertices += item.Value.Vertices.Count;
                totalIndices += item.Value.Indices.Count;
            }

            // Create combined data
            combinedModel = new CombinedModel();
            combinedModel.Vertices = new Vector3[totalVertices];
            combinedModel.Normals = new Vector3[totalVertices];
            combinedModel.UVs = new Vector2[totalVertices];
            combinedModel.Indices = new int[totalIndices];
            combinedModel.SubMeshes = new SubMesh[builderDictionary.Count];

            // Populate static arrays
            int currentVertex = 0;
            int currentIndex = 0;
            int subMeshIndex = 0;
            foreach (var item in builderDictionary)
            {
                // Save current highest vertex and index
                int highestVertex = currentVertex;
                int highestIndex = currentIndex;

                // Copy vertex data
                for (int i = 0; i < item.Value.Vertices.Count; i++)
                {
                    combinedModel.Vertices[currentVertex] = item.Value.Vertices[i];
                    combinedModel.Normals[currentVertex] = item.Value.Normals[i];
                    combinedModel.UVs[currentVertex] = item.Value.UVs[i];
                    currentVertex++;
                }

                // Copy index data
                for (int i = 0; i < item.Value.Indices.Count; i++)
                {
                    combinedModel.Indices[currentIndex++] = highestVertex + i;
                }

                // Add submesh
                int frame;
                SubMesh sm = new SubMesh();
                sm.StartIndex = highestIndex;
                sm.PrimitiveCount = item.Value.Indices.Count / 3;
                MaterialReader.ReverseTextureKey(item.Key, out sm.TextureArchive, out sm.TextureRecord, out frame);
                combinedModel.SubMeshes[subMeshIndex++] = sm;
            }

            Seal();
        }