void Application_Idle(object sender, EventArgs e) { if (vc != null && !pause) { SIFT detector = new SIFT(); Emgu.CV.Util.VectorOfKeyPoint keypoints = new Emgu.CV.Util.VectorOfKeyPoint(); vc.Read(frame); System.Threading.Thread.Sleep((int)(1000.0 / rate - 5)); //imageBox1.Image = frame; frLbl.Text = rate.ToString(); cfLbl.Text = currentFrame.ToString(); fcLbl.Text = frameCount.ToString(); vc.Read(frame); imageBox1.Image = frame; //detector.Detect(frame); detector.DetectRaw(frame, keypoints); numOfKeyPoints = keypoints.Size; kpLbl.Text = numOfKeyPoints.ToString(); Features2DToolbox.DrawKeypoints(frame, keypoints, siftFrame, new Bgr(Color.Blue)); imageBox2.Image = siftFrame; GC.Collect(); currentFrame++; if (currentFrame >= frameCount) { pause = true; button4.Enabled = false; } } }
public void SIFTDraw(Mat image, Mat testImage) { SIFT siftCPU = new SIFT(); VectorOfKeyPoint keyPoint = new VectorOfKeyPoint(); siftCPU.DetectRaw(image, keyPoint); Features2DToolbox.DrawKeypoints(image, keyPoint, testImage, new Bgr(Color.GreenYellow), Features2DToolbox.KeypointDrawType.NotDrawSinglePoints); }
public static UMat Run(Mat img) { var modelKeyPoints = new VectorOfKeyPoint(); var result = new UMat(); using (UMat uModelImage = img.ToUMat(AccessType.Read)) { SIFT siftfCPU = new SIFT(); UMat modelDescriptors = new UMat(); siftfCPU.DetectRaw(uModelImage, modelKeyPoints); Features2DToolbox.DrawKeypoints(img, modelKeyPoints, result, new Bgr(Color.Red), Features2DToolbox.KeypointDrawType.NotDrawSinglePoints); } return(result); }