public static extern void cvExtractSURF(
  IntPtr image, IntPtr mask,
  ref IntPtr keypoints,
  ref IntPtr descriptors,
  IntPtr storage,
  SurfDetector parameters,
  int useProvidedKeyPoints);
        public DetectorResult Process(Image<Bgr, byte> rawFrame, Image<Gray, byte> grayFrame)
        {
            var surfParam = new SurfDetector(900, true);

            var modelImage = new Image<Gray, byte>("iphone\\signin.jpg");
            var modelFeatures = surfParam.DetectFeatures(modelImage, null);
            var tracker = new Features2DTracker(modelFeatures);

            var imageFeatures = surfParam.DetectFeatures(grayFrame, null);
            var homographyMatrix = tracker.Detect(imageFeatures, 100.0);

            Image<Bgr, Byte> processedImage = modelImage.Convert<Bgr, Byte>().ConcateVertical(rawFrame);

            if (homographyMatrix != null)
            {
                var rect = modelImage.ROI;
                var pts = new[]
                              {
                                  new PointF(rect.Left, rect.Bottom),
                                  new PointF(rect.Right, rect.Bottom),
                                  new PointF(rect.Right, rect.Top),
                                  new PointF(rect.Left, rect.Top)
                              };
                homographyMatrix.ProjectPoints(pts);

                for (int i = 0; i < pts.Length; i++)
                    pts[i].Y += modelImage.Height;

                processedImage.DrawPolyline(Array.ConvertAll(pts, Point.Round), true, new Bgr(Color.DarkOrange), 1);
            }
            return new DetectorResult(){RawImage = rawFrame, ProcessedImage = processedImage};
        }
Beispiel #3
0
        /// <summary>
        /// Create a MCvSURFParams using the specific values
        /// </summary>
        /// <param name="hessianThresh">
        /// Only features with keypoint.hessian larger than that are extracted.
        /// good default value is ~300-500 (can depend on the average local contrast and sharpness of the image).
        /// user can further filter out some features based on their hessian values and other characteristics
        /// </param>
        /// <param name="extendedFlag">
        /// false means basic descriptors (64 elements each),
        /// true means extended descriptors (128 elements each)
        /// </param>
        public SurfDetector(double hessianThresh, bool extendedFlag)
        {
            SurfDetector p = CvInvoke.cvSURFParams(hessianThresh, extendedFlag ? 1 : 0);

            extended         = p.extended;
            hessianThreshold = p.hessianThreshold;
            nOctaves         = p.nOctaves;
            nOctaveLayers    = p.nOctaveLayers;
        }
Beispiel #4
0
 private static extern void CvSURFDetectorDetectKeyPoints(
  ref SurfDetector detector,
  IntPtr image,
  IntPtr mask,
  IntPtr keypoints);
Beispiel #5
0
 private static extern void CvSURFDetectorDetectFeature(
  ref SurfDetector detector,
  IntPtr image,
  IntPtr mask,
  IntPtr keypoints,
  IntPtr descriptors);
Beispiel #6
0
 private static extern void CvSURFDetectorComputeDescriptors(
  ref SurfDetector detector,
  IntPtr image,
  IntPtr mask,
  IntPtr keypoints,
  IntPtr descriptors);
Beispiel #7
0
 private extern static void CvSURFDetectorComputeDescriptors(
     ref SurfDetector detector,
     IntPtr image,
     IntPtr mask,
     IntPtr keypoints,
     IntPtr descriptors);
Beispiel #8
0
 private extern static void CvSURFDetectorDetectFeature(
     ref SurfDetector detector,
     IntPtr image,
     IntPtr mask,
     IntPtr keypoints,
     IntPtr descriptors);
Beispiel #9
0
 private extern static void CvSURFDetectorDetectKeyPoints(
     ref SurfDetector detector,
     IntPtr image,
     IntPtr mask,
     IntPtr keypoints);