opencv 矩阵的掩摸操作

#include
#include


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_(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;
}

你可能感兴趣的:(opencv)