コード例 #1
0
ファイル: HOGDescriptor.cs プロジェクト: Rustemt/emgu_openCV
 /// <summary>
 /// Create a new HOGDescriptor
 /// </summary>
 public HOGDescriptor()
 {
    _ptr = CvHOGDescriptorCreateDefault();
    _rectStorage = new MemStorage();
    _rectSeq = new Seq<Rectangle>(_rectStorage);
    _vector = new VectorOfFloat();
 }
コード例 #2
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="image"></param>
 /// <param name="winStride"></param>
 /// <param name="locations"></param>
 /// <returns></returns>
 public float[] Compute(Image<Gray, Byte> image, Size winStride, Point[] locations)
 {
     using (VectorOfFloat vof = new VectorOfFloat())
      {
     GCHandle handle = GCHandle.Alloc(locations, GCHandleType.Pinned);
     CvSelfSimDescriptorCompute(_ptr, image, vof, ref winStride, handle.AddrOfPinnedObject(), locations.Length);
     handle.Free();
     return vof.ToArray();
      }
 }
コード例 #3
0
ファイル: HOGDescriptor.cs プロジェクト: Rustemt/emgu_openCV
 /// <summary>
 /// 
 /// </summary>
 /// <param name="image"></param>
 /// <param name="winStride"></param>
 /// <param name="padding"></param>
 /// <param name="locations">Locations for the computation. Can be null if not needed</param>
 /// <returns>The descriptor vector</returns>
 public float[] Compute(Image<Bgr, Byte> image, Size winStride, Size padding, Point[] locations)
 {
    using (VectorOfFloat desc = new VectorOfFloat())
    {
       if (locations == null)
          CvHOGDescriptorCompute(_ptr, image, desc, winStride, padding, IntPtr.Zero);
       else
       {
          using (MemStorage stor = new MemStorage())
          {
             Seq<Point> locationSeq = new Seq<Point>(stor);
             CvHOGDescriptorCompute(_ptr, image, desc, winStride, padding, locationSeq);
          }
       }
       return desc.ToArray();
    }
 }