junxnone / aiwiki

AI Wiki
https://junxnone.github.io/aiwiki
18 stars 2 forks source link

OpenCV IP Filter Sobel #443

Open junxnone opened 1 year ago

junxnone commented 1 year ago

用于边缘检测的线性滤波器 Sobel

void cv::Sobel(InputArray   src,
            OutputArray     dst,
            int     ddepth,
            int     dx,
            int     dy,
            int     ksize = 3,
            double  scale = 1,
            double  delta = 0,
            int     borderType = BORDER_DEFAULT 
)       
参数 描述
ddepth 输出图像的深度
dx x 方向的差分阶数 0/1
dy y 方向的差分阶数 0/1
ksize 边缘检测时模板大小, 默认为 3
scale 对导数计算结果缩放,默认为 1
delta 计算结果 默认偏值
borderType 图像边界填充方法, 见 BorderTypes
横向边缘(dx) 纵向边缘(dy)
Image Image

Sobel 算子

x 方向

-1 0 1
-2 0 2
-1 0 1

y 方向

-1 -2 -1
0 0 0
1 2 1

Scharr 算子

x 方向

-3 0 3
-10 0 10
-3 0 3

y 方向

-3 -10 -3
0 0 0
3 10 3

perf test 中的 ROI

When the source image is a part (ROI) of a bigger image, the function will try to use the pixels outside of the ROI to form a border. To disable this feature and always do extrapolation, as if src was not a ROI, use borderType | BORDER_ISOLATED.

Reference