使用EMGU CV C#中的HOGDescriptor获取图像的HOG描述符

如何使用EMGU CV和C#计算图像的猪描述符向量。

如果我做这样的事情:

float[] f; Image img1 = new Image(fullPath); f = hog.Compute(img1, Size.Empty, Size.Empty,null ); 

它没有用,它给了一个

你调用的对象是空的。

例外。 我想用默认参数计算hog描述符。

有人知道怎么做吗?

Emgu cv的记录非常糟糕。

我修改了代码,现在我收到以下错误:“外部组件抛出exception”代码如下所示

 public float[] GetVector(Image im) { HOGDescriptor hog = new HOGDescriptor(); // with defaults values // Image pImage = new Image(; //pImage.ROI = new Rectangle(new Point(0, 0), new Size(64, 128)); Point[] p = new Point[im.Width * im.Height]; int k = 0; for (int i = 0; i < im.Width; i++) { for (int j = 0; j < im.Height; j++) { Point p1 = new Point(i, j); p[k++] = p1; } } return hog.Compute(im, new Size(8, 8), new Size(0, 0), p); } 

只是为了记录,他回答说:

 public Image Resize(Image im) { return im.Resize(64, 128, Emgu.CV.CvEnum.INTER.CV_INTER_LINEAR); } public float[] GetVector(Image im) { HOGDescriptor hog = new HOGDescriptor(); // with defaults values Image imageOfInterest = Resize(im); Point[] p = new Point[imageOfInterest.Width * imageOfInterest.Height]; int k = 0; for (int i = 0; i < imageOfInterest.Width; i++) { for (int j = 0; j < imageOfInterest.Height; j++) { Point p1 = new Point(i, j); p[k++] = p1; } } return hog.Compute(imageOfInterest, new Size(8, 8), new Size(0, 0), p); } 

如果有人会需要它:)