0
void IPyraNet2DSourceLayer<OutType>::preprocessImage(const cv::Mat& src, cv::Mat& dest)
{   

    // initialize the gabor filter (just once)
    if (gaborKernel.cols == 0 || gaborKernel.rows == 0) 
    {   
       cv::Mat unflippedKernel = cv::getGaborKernel(
                     cv::Size(gaborKernelSize,gaborKernelSize),
                     gaborSigma, gaborTheta,
                     gaborLambda, gaborGamma, 0.0, /*psi*/);

        // flip the kernel both orizontally and vertically (as required by cv::flip2D)
        cv::flip(unflippedKernel, gaborKernel, -1);

        // the generated values are very small. Scale them.
        gaborKernel /= 2.0 * cv::sum(gaborKernel).val[0];
     }     
     // apply Histogram Equalization
     cv::equalizeHist(src, dest); 
     // convert the image from 0-255 to [-1.0 +1.0] and apply the gabor filter
     cv::Mat scaledTo1;
     dest.convertTo(scaledTo1, CV_64F, 2.0 / 255.0, -1.0); // (maxVal - minVal) / 255.0, minVal);

     if (gaborEnabled) {
         cv::Mat gaboredData;
         cv::filter2D(scaledTo1, dest, CV_64F, gaborKernel);
     } else {
         dest = scaledTo1;
     }
}

当我编译它时,它给了我以下错误,任何人都可以帮助删除这些,将不胜感激

\ipyranet2dsourcelayer.cxx(200): 错误 C2059: 语法错误: ')'

\ipyranet2dsourcelayer.cxx(196) : 在使用 [OutType=float] 编译类模板成员函数 'void IPyraNet2DSourceLayer::preprocessImage(const cv::Mat &,cv::Mat &)' 时

\source\ipyranet2dsourcelayer.cxx(224) :参见使用 [ OutType=float ] 编译的类模板实例化 'IPyraNet2DSourceLayer' 的参考

\ipyranet2dsourcelayer.cxx(200): 错误 C2059: 语法错误: ')'

\ipyranet2dsourcelayer.cxx(196) : 在使用 [ OutType=double ] 编译类模板成员函数 'void IPyraNet2DSourceLayer::preprocessImage(const cv::Mat &,cv::Mat &)

\ipyranet2dsourcelayer.cxx(225) :参见使用 [ OutType=double ] 编译的类模板实例化“IPyraNet2DSourceLayer”的参考

========== 构建:0 成功,1 失败,0 最新,0 跳过 ==========

4

1 回答 1

0

您注释掉了 psi,但忘记删除逗号!

   cv::Mat unflippedKernel = cv::getGaborKernel(cv::Size(gaborKernelSize,gaborKernelSize) , gaborSigma, gaborTheta, gaborLambda, gaborGamma, 0.0, /*psi*/);  // the comma has to go, too !

顺便说一句,错误只有在正确格式化代码后才会显示,所以要学会爱上“{}”按钮!

于 2013-09-23T14:57:54.913 回答