错误C2100:非法间接

时间:2013-07-04 06:50:10

标签: c++ .net visual-studio-2010 visual-c++ opencv

请查看以下代码

double RTMotionDetector::getMSE(Mat I1, Mat I2)
{
    Mat *s1;
    cv::absdiff(*I1, *I2, *s1);       // |I1 - I2|
    *s1->convertTo(*s1, CV_32F);  // cannot make a square on 8 bits
    *s1 = s1->mul(*s1);           // |I1 - I2|^2

    Scalar s = sum(*s1);         // sum elements per channel

    double sse = s.val[0] + s.val[1] + s.val[2]; // sum channels

    if( sse <= 1e-10) // for small values return zero
        return 0;
    else
    {
        double  mse =sse /(double)(I1.channels() * I1.total());
        return mse;
        // Instead of returning MSE, the tutorial code returned PSNR (below).
        //double psnr = 10.0*log10((255*255)/mse);
        //return psnr;
    }
}

这就是它的名称

getMSE(*currentGrey,*next)

这是初始化currentGreynext Mat对象的方式

Mat *current, *currentGrey

当我运行上述方法时,我收到错误error C2100: illegal indirection

错误来自这两行

cv::absdiff(*I1, *I2, *s1);       // |I1 - I2|
        *s1->convertTo(*s1, CV_32F);  // cannot make a square on 8 bits

我最好解决这个问题,但失败了。无论如何,我对Windows编程还是个新手。请帮忙。

0 个答案:

没有答案