sepFilter2D

Description

Applies a separable linear filter to an image.

Signature

cv2.sepFilter2D(src, ddepth, kernelX, kernelY[, dst[, anchor[, delta[, borderType]]]])  → dst

Parameters

Explanation

The function applies a separable linear filter to the image in two steps. That is, first, every row of src is filtered with the 1D kernel, kernelX. Then, every column of the result is filtered with the 1D kernel, kernelY. The final result is shifted by delta is stored in dst.

For example, consider the following image. Original
We can apply sepFilter2D with kernelX=[1,2,1] and kernelY=[0,1,0] (the identity kernel) to get the following image, illustrating a 1-dimensional kernel across X. 1D across X
Alternatively, we can apply sepFilter2D with kernelX=[0,1,0] (the identity kernel) and kernelY=[1,0,-1] to get the following image, illustrating a 1-dimensional kernel across Y. 1D across Y
Lastly, we can apply both non-identity 1-dimensional kernels at the same time using sepFilter2D with kernelX=[1,2,1] and kernelY=[1,0,-1] to get the following image, illustrating a 2-dimensional kernel across X and Y. 2D sequentially across X and Y

Notes


References

Created with OpenCV 4.4.0