void Sobel(InputArray src, OutputArray dst, int ddepth, int xorder, int yorder, int ksize=3, double
scale=1, double delta=0, int borderType=BORDER_DEFAULT )
ddepth 通常采用 src.depth();
xorder 和 yorder 通常用 1, 0, 或者 0, 1
int main( int argc, char** argv )
{
// Load an image
Mat src = imread("D:\\image\\aa.jpg", 0);
Mat dst_x, dst_y, dst;
Sobel(src, dst_x, src.depth(), 1, 0);
Sobel(src, dst_y, src.depth(), 0, 1);
convertScaleAbs(dst_x, dst_x);
convertScaleAbs(dst_y, dst_y);
addWeighted( dst_x, 0.5, dst_y, 0.5, 0, dst);
imshow("dst", dst);
imwrite("D:\\image\\aa_sobel.jpg", dst);
waitKey();
return 0;
}