【发布时间】:2021-08-18 07:37:58
【问题描述】:
我试图在 opencv 4.5.1 中使用 SIFT 提取图像的特征,但是当我尝试使用 drawKeypoints() 检查结果时,我不断收到这个神秘的错误:
OpenCV(4.5.1) Error: Assertion failed (!fixedType() || ((Mat*)obj)->type() == mtype) in cv::debug_build_guard::_OutputArray::create, file C:\build\master_winpack-build-win64-vc14\opencv\modules\core\src\matrix_wrap.cpp, line 1147
D:\School\IP2\OpenCVApplication-VS2019_OCV451_basic\x64\Debug\OpenCVApplication.exe (process 6140) exited with code -1.
To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the console when debugging stops.
问题似乎出在 drawKeypoints() 函数上,但我不确定是什么导致了问题。
功能:
vector<KeyPoint> extractFeatures(String path) {
Mat_<uchar> source = imread(path, 0);
Mat_<uchar> output(source.rows, source.cols);
vector<KeyPoint> keypoints;
Ptr<SIFT> sift = SIFT::create();
sift->detect(source, keypoints);
drawKeypoints(source, keypoints, output);
imshow("sift_result", output);
return keypoints;
}
【问题讨论】:
-
您是否检查过您是否从 SIFT 获得任何分数?
标签: c++ opencv image-processing sift