欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Roberts

程序员文章站 2022-03-22 16:55:33
...

Roberts

Mat src = imread("test.png", IMREAD_GRAYSCALE);
imshow("src", src);

//X方向—Robert算子
Mat imgx;
Mat kernel_x = (Mat_<int>(2, 2) << 1, 0, 0, -1);
filter2D(src, imgx, -1, kernel_x, Point(-1, -1), 0, 0);
imshow("x方向", imgx);

Mat imgy;
//Y方向—Robert算子
Mat kernel_y = (Mat_<int>(2, 2) << 0, 1, -1, 0);
filter2D(src, imgy, -1, kernel_y, Point(-1, -1), 0, 0);
imshow("y方向", imgy);

waitKey();

 

Roberts

 

Roberts

Roberts

 

 

 

相关标签: opencv