Ask Your Question
0

What is kernelX and kernelY means in sepFilter2D?

asked 2019-04-26 10:28:09 -0600

hua gravatar image

Below is my code, and am I right using like this?

vector<double> filter1; //row vector

sepFilter2D(src, convolvedImg, CV_64FC3, filter1, filter1, Point(-1, -1), 0.0, BORDER_DEFAULT);


//filter1 = [0.00443305      0.0540056       0.242036        0.39905       0.242036        0.0540056       0.00443305]
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2019-04-26 11:16:41 -0600

Always refer to the documentation. According to it,

Applies a separable linear filter to an image.

The function applies a separable linear filter to the image. 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 shifted by delta is stored in dst .

edit flag offensive delete link more

Comments

So, kernleX = [ 1, 2, 3, 4, 5] and

kernelY = [ 1
2
3
4
5]

I am confused about it. It's that I need to change the vector to Mat?

hua gravatar imagehua ( 2019-04-27 08:40:31 -0600 )edit

You are the one defining the values of kernelX and kernelY. If you look into the documentation, you'll see they are of type InputArray. This explains the data structure of InputArray. In short, kernelX and kernelY can either be Mat, Mat_<T>, Matx<T, m, n>, std::vector<T>, std::vector<std::vector<T>>, std::vector<Mat>, std::vector<Mat_<T>>, UMat, std::vector<UMat> or double

eshirima gravatar imageeshirima ( 2019-04-29 21:55:34 -0600 )edit

Thank you, sir! So, I can use my std::vector directly in the sepFilter2D function.

hua gravatar imagehua ( 2019-04-30 11:06:11 -0600 )edit

that's right

eshirima gravatar imageeshirima ( 2019-04-30 12:26:36 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2019-04-26 10:28:09 -0600

Seen: 184 times

Last updated: Apr 26 '19