Example #1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            adapter = new TabsAdapter(this, SupportFragmentManager);
            pager   = FindViewById <ViewPager>(Resource.Id.viewpager);
            var tabs = FindViewById <TabLayout>(Resource.Id.tabs);

            pager.Adapter = adapter;
            tabs.SetupWithViewPager(pager);
            pager.OffscreenPageLimit = 3;

            pager.PageSelected += (sender, args) =>
            {
                var fragment = adapter.InstantiateItem(pager, args.Position) as IFragmentVisible;

                fragment?.BecameVisible();
            };

            Toolbar.MenuItemClick += (sender, e) =>
            {
                var intent = new Intent(this, typeof(AddItemActivity));;
                StartActivity(intent);
            };

            SupportActionBar.SetDisplayHomeAsUpEnabled(false);
            SupportActionBar.SetHomeButtonEnabled(false);

            var src         = new Mat[2];
            var dst         = new Mat[2];
            var keyPoints1  = new MatOfKeyPoint();
            var keyPoints2  = new MatOfKeyPoint();
            var descripter1 = new Mat();
            var descripter2 = new Mat();
            var dmatch      = new MatOfDMatch();
            var output      = new Mat();

            src[0] = Imgcodecs.Imread("path/to/source/1.png");
            src[1] = Imgcodecs.Imread("path/to/source/2.png");
            dst[0] = new Mat();
            dst[1] = new Mat();
            Imgproc.CvtColor(src[0], dst[0], Imgproc.COLORBayerGR2GRAY);
            Imgproc.CvtColor(src[1], dst[1], Imgproc.COLORBayerGR2GRAY);

            var akaze    = FeatureDetector.Create(FeatureDetector.Akaze);
            var executor = DescriptorExtractor.Create(DescriptorExtractor.Akaze);

            akaze.Detect(dst[0], keyPoints1);
            akaze.Detect(dst[1], keyPoints2);

            executor.Compute(dst[0], keyPoints1, descripter1);
            executor.Compute(dst[1], keyPoints2, descripter2);

            var matcher = DescriptorMatcher.Create(DescriptorMatcher.BruteforceHamming);

            matcher.Match(descripter1, descripter2, dmatch);

            Features2d.DrawMatches(src[0], keyPoints1, src[1], keyPoints2, dmatch, output);
        }