/ 没事折腾

读opencv图像处理变成实例时的一些问题

这篇文章的阅读量为

opencv3.0.0以后的版本内部库的储存和3.0.0以前的不同,比如CV_RGB2GRAY与原来头文件不同需要重新引用。

详情:

安装opencv3.0.0-alpha 后出现“CV_BGR2GRAY”: 未声明的标识符的解决办法 转载 2015年09月22日 21:22:08

include <opencv2/core/core.hpp>

include <opencv2/highgui/highgui.hpp>

include <opencv2/imgproc/imgproc.hpp>

include

include <opencv2\opencv.hpp>

include <opencv2\objdetect\objdetect.hpp>

include <opencv2\imgproc\types_c.h>

include <opencv2\objdetect\objdetect_c.h>

int main ()
{
cv::Mat srcImage = cv::imread("len_top.jpg");
if (srcImage.empty())
return -1;
cv::Mat srcGray;
cv::cvtColor(srcImage, srcGray, CV_RGB2GRAY);
cv::imshow("srcGrat", srcGray);
cv::Mat blurDstImage;
blur(srcGray, blurDstImage, cv::Size(5,5), cv::Point(-1, -1));
cv::imshow("blur", blurDstImage);
cv::imwrite ("blurDstImage.png", blurDstImage);
cv::waitKey(0);
return 0;

}