[英]OpenCV: Unknown Array Type error in Matrix.cpp
I'm using EmguCV Matrix.Add method to append one matrix to another matrix. 我正在使用EmguCV Matrix.Add方法将一个矩阵附加到另一个矩阵。
Emgu.CV.Matrix<float> descriptors = new Emgu.CV.Matrix<float>(0, dictionarySize);
Emgu.CV.Matrix<float> BOWDescriptor = imageDescriptorExtractor.Compute(trainingImage, keyPoints);
descriptors.Add(BOWDescriptor);
The corresponding OpenCV code is given below: 相应的OpenCV代码如下所示:
Mat bowDescriptor(0, dictionarySize, CV_32FC1);
Mat bowDescriptor;
bowDE.compute(img, keypoints, bowDescriptor);
descriptors.push_back(bowDescriptor);
During compilation, I will not get any exception. 在编译期间,我不会得到任何异常。 But, when running the app I get the following error: 但是,在运行应用程序时,出现以下错误:
An unhandled exception of type 'Emgu.CV.Util.CvException' occurred in Emgu.CV.dll Additional information: OpenCV: Unknown array type Emgu.CV.dll中发生了类型为'Emgu.CV.Util.CvException'的未处理异常其他信息:OpenCV:未知数组类型
Does this have something to do with CV_32FC1 data type? 这与CV_32FC1数据类型有关吗? Is my OpenCV to EmguCV conversion correct? 我的OpenCV到EmguCV转换正确吗?
Appreciate your help on this. 感谢您的帮助。
Thanks Jay 谢谢杰伊
CV_32FC1 just means a single channel, 32-bit floating point array, and since you can't have zero channels, the default Matrix constructor should be fine. CV_32FC1仅表示一个通道,32位浮点数组,并且由于您不能具有零通道,因此默认的Matrix构造函数应该可以。
Have you tried putting a breakpoint on your "Add" call and examining the two matrices? 您是否尝试过在“添加”调用上设置断点并检查这两个矩阵? I'm not sure when EmguCV throws that exception, but perhaps there is a mismatch in the matrix sizes. 我不确定EmguCV何时会引发该异常,但是矩阵大小可能不匹配。
Also, I just noticed that your constructor for the "descriptors" object has 0 rows; 另外,我只是注意到您的“描述符”对象的构造函数有0行; was this a typo? 这是错字吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.