Beispiel #1
0
        public void FromImageTest()
        {
            foreach (int bitsPerPixel in new[] { 8 /*, 16*/ })
            {
                Image src = new Image(23, 20, bitsPerPixel, 200, 200);
                src.Randomize(this.random);

                IntegralImage dst = IntegralImage.FromImage(src);
                Assert.AreEqual(src.Width + 1, dst.Width);
                Assert.AreEqual(src.Height + 1, dst.Height);

                for (int x = 0; x < src.Width; x++)
                {
                    for (int y = 0; y < src.Height; y++)
                    {
                        int actual = dst[x + 1, y + 1];

                        int expected = 0;
                        for (int ix = 0; ix <= x; ix++)
                        {
                            for (int iy = 0; iy <= y; iy++)
                            {
                                expected += (int)src.GetPixel(ix, iy);
                            }
                        }

                        Assert.AreEqual(expected, actual);
                    }
                }
            }
        }
Beispiel #2
0
 public void build_integral_image()
 {
     System.Drawing.Bitmap img = new System.Drawing.Bitmap(path);
     iimg = IntegralImage.FromImage(img);
     img.Dispose();
     integral_image = true;
 }
Beispiel #3
0
        private void btnRunSurf_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.ShowDialog();
            string pathToFile = openFileDialog.FileName;

            Stopwatch watch = new Stopwatch();

            watch.Start();

            try
            {
                // Load an Image
                Bitmap img = new Bitmap(pathToFile);
                pbMainPicture.Image = img;

                // Create Integral Image
                IntegralImage iimg = IntegralImage.FromImage(img);

                // Extract the interest points
                ipts = FastHessian.getIpoints(0.0002f, 5, 2, iimg);

                // Describe the interest points
                SurfDescriptor.DecribeInterestPoints(ipts, false, false, iimg);

                // Draw points on the image
                PaintSURF(img, ipts);
            }
            catch
            {
            }

            watch.Stop();
            this.Text = "DemoSURF - Elapsed time: " + watch.Elapsed +
                        " for " + ipts.Count + "points";
        }