【问题标题】:OpenCV Assertion Failed CV_IS_MASK_ARR(mask)OpenCV 断言失败 CV_IS_MASK_ARR(mask)
【发布时间】:2013-01-16 10:54:32
【问题描述】:

我正在使用示例 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;

}

任何方向都将不胜感激。

【问题讨论】:

  • 你用的是什么类型的垫子?
  • 我正在计算方法“detectFaces”中“ViewController.m”类中的 8 个点。然后在“Utility.mm”类中,我在“callMainFunctionWithImage”方法中初始化“allPoints”向量。然后将这些点进一步用于创建发生崩溃的 basicMat。
  • 让我知道它是否有效..

标签: ios image-processing opencv morphing


【解决方案1】:

CvMat* status = cvCreateMat(1,count,CV_32F); 更改为CvMat* status = cvCreateMat(1,count,CV_8UC1);

【讨论】:

  • 调试区域现在显示变形完成,但仍然发生崩溃 - 变形完成 SampleOpenCVCodeDemo(7944,0xac5212c0) malloc: *** 对象 0x7c75804 错误:已释放对象的校验和不正确 - 对象可能已修改被释放后。 *** 在 malloc_error_break 中设置断点来调试运行
  • 谢谢,在解决校验和错误后,崩溃似乎已修复。
  • 抱歉没能及时回复。如果我的回答对您有任何帮助,请接受它让我高兴:)
猜你喜欢
  • 2014-02-10
  • 2012-11-26
  • 2014-11-24
  • 2014-05-28
  • 2020-12-31
  • 2015-09-12
  • 2015-04-25
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多