我正在使用示例 iOS 项目中的一些通用 OpenCV 函数,并在cvFindFundamentalMAT
调用函数时出现以下错误:
OpenCV Error: Assertion failed (CV_IS_MASK_ARR(mask) && CV_IS_MAT_CONT(mask->type)
&& (mask->rows == 1 || mask->cols == 1) && mask->rows*mask->cols == count) in
cvFindFundamentalMat
该函数似乎发生了错误:
int calcFundamental(){
if(allPoints.size() != points_count) return -1;
// preparo la matrice delle corrispodenze
points1 = cvCreateMat(2,allPoints.size()/2,CV_32F);
points2 = cvCreateMat(2,allPoints.size()/2,CV_32F);
int count = std::max(points1->cols,points1->rows);
CvMat* status = cvCreateMat(1,count,CV_32F);
std::cout << "status->rows: " << status->rows <<"status->cols: " << status->cols << "count: "<< count << std::endl;
for(int j = 0; j < allPoints.size(); j++){
if(j%2==0){
std::cout << allPoints.at(j).x << ' ' << allPoints.at(j).y << std::endl;
cvSetReal2D(points1,0,j-(int)round(j/2),allPoints.at(j).x);
cvSetReal2D(points1,1,j-(int)round(j/2),allPoints.at(j).y);
}else{
std::cout << allPoints.at(j).x << ' ' << allPoints.at(j).y << std::endl;
cvSetReal2D(points2,0,j-(int)round(j/2)-1,allPoints.at(j).x);
cvSetReal2D(points2,1,j-(int)round(j/2)-1,allPoints.at(j).y);
}
}
fundMat = cvCreateMat(3,3,CV_32F);
int num = 0;
num = cvFindFundamentalMat(points1,points2,fundMat,CV_FM_8POINT,1.0,0.9999,status);
return num;
}
任何方向将不胜感激。