C++ 如何使用cv::findcontours和DFT?它会导致调试错误
我所做的是在对图像进行预处理(通过阈值)后找到图像的轮廓。 我想得到每个轮廓的离散傅里叶描述符(使用dft()函数) 我的代码如下:C++ 如何使用cv::findcontours和DFT?它会导致调试错误,c++,opencv,contour,dft,C++,Opencv,Contour,Dft,我所做的是在对图像进行预处理(通过阈值)后找到图像的轮廓。 我想得到每个轮廓的离散傅里叶描述符(使用dft()函数) 我的代码如下: vector<Mat> contourLines1; vector<Mat> contourLines2; getContourLine(exC1, contourLines1, binThreshold, numOfErosions); getContourLine(exC2, contourLines2, binThreshold,
vector<Mat> contourLines1;
vector<Mat> contourLines2;
getContourLine(exC1, contourLines1, binThreshold, numOfErosions);
getContourLine(exC2, contourLines2, binThreshold, numOfErosions);
// calculate fourier descriptor
Mat fd1 = makeFD(contourLines1.front());
Mat fd2 = makeFD(contourLines2.front());
/////////////////////////
void getContourLine(Mat& img, vector<Mat>& objList, int thresh, int k){
threshold(img,img,thresh,255,THRESH_BINARY);
erode(img,img,0,cv::Point(-1,-1),k);
cv::findContours(img,objList,CV_RETR_LIST,CV_CHAIN_APPROX_SIMPLE);
}
/////////////////////////
Mat makeFD(Mat& contour){
Mat result;
dft(contour,result,DFT_ROWS);
return result;
}
矢量轮廓线1;
矢量等值线2;
getContourLine(exC1、contourLines1、binThreshold、NumoFerrotions);
getContourLine(exC2、contourLines2、binThreshold、NumoFerrotions);
//计算傅里叶描述子
Mat fd1=makeFD(轮廓线1.front());
Mat fd2=makeFD(轮廓线2.front());
/////////////////////////
void getContourLine(Mat和img、向量和对象列表、int thresh、int k){
阈值(img,img,thresh,255,thresh_二进制);
侵蚀(img,img,0,cv::点(-1,-1),k);
cv::findContours(img、对象列表、cv报告列表、cv链近似简单);
}
/////////////////////////
Mat makeFD(Mat和轮廓){
Mat结果;
dft(轮廓、结果、dft_行);
返回结果;
}
有什么问题???我找不到。。我认为函数的参数类型(如cv::finContours或dft)是错误的……findContours的输出是vector
img = (img > thresh);
findContours的输出为vector
img = (img > thresh);