#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();
}
OpenCV学习
最新推荐文章于 2024-01-20 19:20:37 发布