OpenCV学习

来源:互联网 发布:python 线程传递消息 编辑:程序博客网 时间:2024/05/16 14:05
#include<iostream>#include "opencv2/opencv.hpp"#include <opencv2/core/core.hpp>#include <opencv2/highgui/highgui.hpp>using namespace cv;using namespace std;int main(int argc, char** argv){Mat img,gray;// 读入一张图片(游戏原画)img=imread("test.jpg");//若是没有图像被加载if (!img.data) {// no image has been created…}// 创建一个名为 "游戏原画"窗口namedWindow("游戏原画");// 在窗口中显示游戏原画imshow("游戏原画",img);//图像高度和宽度cout << "size: " << img.size().height << " , "<< img.size().width << std::endl;//获取轮廓图cvtColor(img, gray, COLOR_BGR2GRAY);GaussianBlur(gray, gray, Size(7, 7), 1.5);Canny(gray, gray, 0, 50);imshow("edges", gray);Mat result;flip(img,result,1);namedWindow("Output Image");imshow("Output Image", result);imwrite("output.bmp", result);waitKey();}

0 0
原创粉丝点击