简体   繁体   English

OpenCV:Matrix.cpp中的未知数组类型错误

[英]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.

相关问题 无法创建未知类型错误 - Cannot create unknown type error cvGetCol抛出“ OpenCV:无法识别或不受支持的数组类型” - cvGetCol throwing “OpenCV: Unrecognized or unsupported array type” 创建未知类型的数组。 C# - Creating array of unknown type. C# 将一维数组值分配给维度/类型未知的多维数组 - Assign 1D array values to multidimensional array, of unknown dimensions / type 如何将未知类型的 IList(类型在运行时已知)转换为数组? - How to convert IList of unknown type (type is known at runtime) to array? 在C#中将字节数组转换为具有未知类型的原始类型的数组 - Converting a byte array to an array of primitive types with unknown type in C# C#使用CPP中未知数量的args调用CPP函数 - C# invoking CPP function with unknown number of args from CPP C#如何访问对象内的数组信息未知类型 - C# how to access array info unknown type within object 如果类类型未知,如何创建类样本数组并使用其方法 - How to create array of class exemplars and use their methods if type of class is unknown C#:有没有一种方法可以使用反射来调整未知类型的数组的大小? - C#: Is there a way to resize an array of unknown type using reflection?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM