c++
#include"all.h"
using namespace std;
using namespace cv;
void MyClass::day032() {
Mat img = read(PATH + "images\\test.jpg");
imshow("input", img);
Mat grad_x, grad_y, dst;
Sobel(img, grad_x, CV_32F, 1, 0, 3, 1, 0, BORDER_DEFAULT);
Sobel(img, grad_y, CV_32F, 0, 1, 3, 1, 0, BORDER_DEFAULT);
convertScaleAbs(grad_x, grad_x);
convertScaleAbs(grad_y, grad_y);
add(grad_x, grad_y, dst, Mat(), CV_16S);
convertScaleAbs(dst, dst);
imshow("grad_x", grad_x);
imshow("grad_y", grad_y);
imshow("grad_xy", dst);
waitKey(0);
}
c++中新知识点
Sobel: 实现索贝尔梯度挖掘的方法