opencv 矩阵的掩摸操作

#include<opencv2\opencv.hpp>
#include<iostream>


using namespace cv;
using namespace std;
int main(){
Mat src;
src = imread("lena.jpg");
if (src.empty()){
cout << "没有找到图片!" << endl;
return -1;

}
namedWindow("原图", CV_WINDOW_NORMAL);
imshow("原图",src);
Mat dst;
Mat kernel = (Mat_<char>(3, 3) << 0, -1, 0, -1, 5, -1, 0, -1, 0);
filter2D(src, dst, src.depth(), kernel);
namedWindow("", CV_WINDOW_NORMAL);
imshow("", dst);
waitKey(0);
return 0;
}

猜你喜欢

转载自blog.csdn.net/gt18120588267/article/details/79902650