"cvSmooth":未找到标识符

'cvSmooth': identifier not found

本文关键字:标识符 cvSmooth      更新时间:2023-10-16

我试图使用cvSmooth函数平滑图像,但当我运行程序时,我得到一个错误!我的代码是:

using namespace std;
using namespace cv;
int main(){
IplImage* img ;
img = cvLoadImage ("c:\try.png");
cvSmooth( img, img, CV_GAUSSIAN,11,11);
cvShowImage("",img);
cv::waitKey( 15000 ) ;
return 0;
};

错误列表如下:'CV_GAUSSIAN':未声明的标识符错误C3861: 'cvSmooth':标识符未找到

规则1 -不要使用过时的c-api

请忘了它吧,它已经死了。

#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp> 
int main()
{
  cv::Mat img = cv:imread("c:\try.png");
  cv::Mat blurred;
  // see [docs](http://docs.opencv.org/modules/imgproc/doc/filtering.html#gaussianblur)
  cv::GaussianBlur(img,blurred(cv::Size(11,11),0); 
  cv::imshow("lala", blurred);
  cv::waitKey();
  return 0;
}