예제 #1
0
        private void imToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form1 f1 = NewForm1();

            IplImage dstImg1 = new IplImage("box.png", LoadMode.GrayScale);
            Bitmap   ibmp    = BitmapConverter.ToBitmap(dstImg1);

            //Bitmap obmp = new Bitmap(ibmp.Width, ibmp.Height, System.Drawing.Imaging.PixelFormat.);

            SURF2 surf = new SURF2();

            List <CvSURFPoint> points = surf.FastHessianDetector(ibmp);


            //for (int i = 0; i < points; i++)
            foreach (CvSURFPoint r in points)
            {
//                CvSURFPoint r = Cv.GetSeqElem<CvSURFPoint>(points, i).Value;
                CvPoint center;
                int     radius;
                center.X = (int)Math.Round(r.Pt.X);
                center.Y = (int)Math.Round(r.Pt.Y);
                radius   = (int)Math.Round(r.Size * 1.2 / 9 * 2);
                CvInvoke.cvCircle(dstImg1.CvPtr, center, radius, new CvScalar(0, 0, 255), 1, LineType.Link8, 0);


                //Cv.Circle(img, pt, 2, new CvColor(255, 0, 0), -1);
            }

            ibmp = BitmapConverter.ToBitmap(dstImg1);

            f1.pictureBoxIpl1.Image = ibmp;
        }
예제 #2
0
        private void imToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form1 f1 = NewForm1();

            IplImage dstImg1 = new IplImage("box.png", LoadMode.GrayScale);
            Bitmap ibmp = BitmapConverter.ToBitmap(dstImg1);

            //Bitmap obmp = new Bitmap(ibmp.Width, ibmp.Height, System.Drawing.Imaging.PixelFormat.);

            SURF2 surf = new SURF2();

            List<CvSURFPoint> points = surf.FastHessianDetector(ibmp);


            //for (int i = 0; i < points; i++)
            foreach (CvSURFPoint r in points) 
            {


//                CvSURFPoint r = Cv.GetSeqElem<CvSURFPoint>(points, i).Value;
                 CvPoint center;
                int radius;
                center.X = (int)Math.Round(r.Pt.X);
                center.Y = (int)Math.Round(r.Pt.Y);
                radius = (int)Math.Round(r.Size*1.2/9*2);
                CvInvoke.cvCircle(dstImg1.CvPtr,center, radius,new CvScalar(0,0,255), 1, LineType.Link8,0);   


                //Cv.Circle(img, pt, 2, new CvColor(255, 0, 0), -1);
                

            }

            ibmp = BitmapConverter.ToBitmap(dstImg1);

            f1.pictureBoxIpl1.Image = ibmp;

                


            
        }