【问题标题】:'cvSmooth': identifier not found'cvSmooth':找不到标识符
【发布时间】:2014-03-23 12:28:52
【问题描述】:

我正在尝试使用 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;
};

错误列表是: 错误 C2065:“CV_GAUSSIAN”:未声明的标识符 错误 C3861:“cvSmooth”:找不到标识符

【问题讨论】:

  • 您的代码中包含哪些内容?
  • OpenCV C++ and cvSmooth的可能重复
  • 我有两个包括:#include #include
  • 你使用什么版本的 OpenCV?我使用的是 2.4.8,你的代码可以编译得很好。
  • 2.4.3 with visual c++ 2010

标签: c++ opencv


【解决方案1】:

Rule1 - 不要使用过时的 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;
}

【讨论】:

  • 真的不想这样,但是主管强迫我使用Iplimage而不是cvmat,所以别无选择:)
  • 请把你的主管指向current reality
猜你喜欢
  • 1970-01-01
  • 2013-03-17
  • 2015-03-01
  • 2015-07-13
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2023-03-20
相关资源
最近更新 更多