How can I compute the hog descriptor vector of an image using EMGU CV and C#.
If i make something like this:
float[] f;
Image<Bgr, Byte> img1 = new Image<Bgr, Byte>(fullPath);
f = hog.Compute(img1, Size.Empty, Size.Empty,null );
it doesn't work, it gives a
Object reference not set to an instance of an object.
exception. I want to compute the hog descriptor with default parameters.
Does someone know how to do this ?
Emgu cv is very poorly documented.
I have modified the code and now I am getting the following error: "External component has thrown an exception" The code is listed below
public float[] GetVector(Image<Bgr, Byte> im)
{
HOGDescriptor hog = new HOGDescriptor(); // with defaults values
// Image<Bgr, Byte> pImage = new Image<Bgr, Byte>(;
//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);
}