您的位置:首页 > 运维架构

OpenCV自带例子(九)Sobel运用

2011-12-05 21:57 274 查看
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;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: