美文网首页
2019-07-13(day032_Sobel: 实现索贝尔梯度

2019-07-13(day032_Sobel: 实现索贝尔梯度

作者: 雨住多一横 | 来源:发表于2019-07-13 09:50 被阅读0次

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: 实现索贝尔梯度挖掘的方法

相关文章

网友评论

      本文标题:2019-07-13(day032_Sobel: 实现索贝尔梯度

      本文链接:https://www.haomeiwen.com/subject/sfrpkctx.html