sobel函数
sobel函數、
主要對圖像進行求x或者y方向上的導數
使用擴展 Sobel 算子計算一階、二階、三階或混合圖像差分
void?Sobel(InputArray?src, OutputArray?dst, int?ddepth, int?dx, int?dy, int?ksize=3, double?scale=1, double?delta=0, int?borderType=BORDER_DEFAULT?) src
opencv代碼:
<span style="font-size:18px;">#include <opencv2/core/core.hpp> #include <opencv2/highgui/highgui.hpp> #include <opencv2/imgproc/imgproc.hpp> #include <iostream> #include<cv.h> #include<stdlib.h> using namespace cv; using namespace std;int main() {Mat src, dst;src = imread("D:6.jpg");/*Mat kx = (Mat_<float>(1, 3) << 0,-1,0);Mat ky = (Mat_<float>(1, 3) << -1,0, -1);sepFilter2D(src, dst, src.depth(),kx,ky,Point(-1,-1),0,BORDER_DEFAULT );*/Sobel(src, dst, src.depth(), 1, 1, 3, 1, 0);imshow("shiyan", dst);waitKey(0);return 0; }</span>
總結