异常内核库.dll.

Exception KernelBase.dll

本文关键字:dll 内核 异常      更新时间:2023-10-16

我正在使用Visual Studio 2010和OpenCV 3.0。

以下代码尝试提取 HOG 特征以训练 SVM 分类器。但是,当我尝试在行中使用 HOG 的函数"计算"时

hog.compute(grayImg,descriptor,Size(),Size(),position);

出现以下错误:

TrainSVM.exe 中 0x000007fefd9bb16d (KernelBase.dll) 中的未处理异常:Exception de Microsoft C++: cv::Exception at memory location 0x0026e1b0.

            String imagesPath = "Positivas/*.jpg"; 
            vector<String> fn;
            glob(imagesPath, fn, true); // recursive, if you want
            for (size_t i=0; i<fn.size(); i++)
            {
                Mat img = imread(fn[i]);     
                std::vector<cv::Point> positions;
                positions.push_back(cv::Point(0,0));
                std::vector<float> descriptor;
                cv::Mat grayImg;//(patchHeight,patchWidth,CV_8UC1,0);
                cvtColor( img, grayImg, COLOR_BGR2GRAY );
                hog.compute(grayImg,descriptor,Size(),Size(),positions);
                Mat auxDescriptor = cv::Mat(descriptor);
                Mat descriptorMat(1,auxDescriptor.rows,CV_32FC1);
                transpose(auxDescriptor, descriptorMat);
                trainingData.push_back(descriptorMat);
                trainingLabels.push_back(labelPositive);
            }

对此有什么想法吗?提前感谢!

收到异常消息后,我们发现对alignSize的调用中断言失败。alignSize的文档要求参数为2的幂。从那里,我们查看了hog.compute的文档,发现它需要的窗口大小是 2 的幂。