Size width changed to a negative number during runtime while copying array to Mat

0

I was running this code. It has a float array "descriptors" of length 4665600, but when I want to copy it to Mat "d.SetTo(descriptors)", I get this error:

Emgu.CV.Util.CvException HResult=0x80131500 Message=OpenCV: > (expected: 'sz.width >= 0'), where 'sz.width' is -693124096 must be greater than or equal to '0' is 0

for (i = 0; i < img_lst.Count; i++)
{
    CvInvoke.CvtColor(img_lst[i], gray, ColorConversion.Bgr2Gray);
    float[] descriptors = hog.Compute(gray, new Size(8, 8), new Size(0, 0), location);
    Mat d = new Mat(1, descriptors.Length, DepthType.Cv32F, 0xC1);
    d.SetTo(descriptors);
    gradient_lst.Add(d.Clone());
    d.Dispose();
}

I want to know how can I successfully copy the array to Mat.

c#
emgucv

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0