Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

if you read docs , it's actually an 1d filter (a single row or col in a 2d Mat), suitable for sepFilter2D()

if you read docs , it's actually an 1d filter (a single row or col in a 2d Mat), suitable for sepFilter2D() see:

>>> x = cv2.getGaussianKernel(3,1.2)
array([[0.29281452],
       [0.41437096],
       [0.29281452]])
>>> y = cv2.getGaussianKernel(5,1.2)
array([[0.08562916],
       [0.2426676 ],
       [0.34340648],
       [0.2426676 ],
       [0.08562916]])

so, if you need a "rectangular" kernel, you would apply 2 gaussians with different size

 blurred = cv.sepFilter2D(img, -1,  x, y)

you could also use the outer product of the kernels, to produce a 2d filter matrix:

kxy = x.T * y

and use filter2D(), but this is clearly less optimal than the seperated version