简体   繁体   中英

OpenCV: Unknown Array Type error in Matrix.cpp

I'm using EmguCV Matrix.Add method to append one matrix to another matrix.

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:

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

Does this have something to do with CV_32FC1 data type? Is my OpenCV to EmguCV conversion correct?

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.

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.

Also, I just noticed that your constructor for the "descriptors" object has 0 rows; was this a typo?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM