Exemplo n.º 1
0
 /// <summary>
 /// Detect image features from the given image
 /// </summary>
 /// <param name="image">The image to detect features from</param>
 /// <param name="mask">The optional mask, can be null if not needed</param>
 /// <returns>The Image features detected from the given image</returns>
 public ImageFeature <TDescriptor>[] DetectFeatures(Image <Gray, Byte> image, Image <Gray, byte> mask)
 {
     using (VectorOfKeyPoint pts = new VectorOfKeyPoint())
         using (Matrix <TDescriptor> descVec = DetectAndCompute(image, mask, pts))
         {
             return(ImageFeature <TDescriptor> .ConvertFromRaw(pts, descVec));
         }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Detect image features from the given image
 /// </summary>
 /// <param name="image">The image to detect features from</param>
 /// <param name="mask">The optional mask, can be null if not needed</param>
 /// <returns>The Image features detected from the given image</returns>
 public ImageFeature <byte>[] DetectFeatures(Image <Gray, Byte> image, Image <Gray, byte> mask)
 {
     using (VectorOfKeyPoint pts = this.DetectKeyPointsRaw(image, mask))
         using (Matrix <byte> descVec = ComputeDescriptorsRaw(image, mask, pts))
         {
             return(ImageFeature <byte> .ConvertFromRaw(pts, descVec));
         }
 }
 /// <summary>
 /// Compute the descriptor given the image and the point location
 /// </summary>
 /// <param name="extractor">The descriptor extractor</param>
 /// <param name="image">The image where the descriptor will be computed from</param>
 /// <param name="mask">The optional mask, can be null if not needed</param>
 /// <param name="keyPoints">The keypoint where the descriptor will be computed from</param>
 /// <returns>The descriptors founded on the keypoint location</returns>
 public static ImageFeature <TDepth>[] ComputeDescriptors <TDepth>(this IDescriptorExtractor <TDepth> extractor, Image <Gray, Byte> image, Image <Gray, byte> mask, MKeyPoint[] keyPoints)
     where TDepth : struct
 {
     if (keyPoints.Length == 0)
     {
         return(new ImageFeature <TDepth> [0]);
     }
     using (VectorOfKeyPoint kpts = new VectorOfKeyPoint())
     {
         kpts.Push(keyPoints);
         using (Matrix <TDepth> descriptor = extractor.ComputeDescriptorsRaw(image, mask, kpts))
         {
             return(ImageFeature <TDepth> .ConvertFromRaw(kpts, descriptor));
         }
     }
 }