Ask Your Question
0

Gaussian smoothing of cv::Mat column

asked 2013-09-10 06:24:46 -0600

Hi,

I'm very new to OpenCV and I have a short Question:

I have a cv::Mat with 3 columns and I want to smooth each column with gaussian blur.

Can anyone help me?

edit retag flag offensive close merge delete

Comments

Moster gravatar imageMoster ( 2013-09-10 06:29:30 -0600 )edit

No, I thought this would work only for images... Im trying to pass each column seperately into cv::GaussianBlur, but how to find out ksize and sigma?

mgcthhh gravatar imagemgcthhh ( 2013-09-10 07:00:17 -0600 )edit

You determine the ksize and sigma. Maybe try Size(2,2) and 1.

Moster gravatar imageMoster ( 2013-09-10 07:23:38 -0600 )edit

It does not work. Should the ksize be also a single column?

mgcthhh gravatar imagemgcthhh ( 2013-09-10 09:10:18 -0600 )edit

My answer didnt make sense at all :D The kernel always has to be odd since you need a center point in your kernel to calculate the new value. If you have 2x2 you have no center . So size should be Size(3,3).

Moster gravatar imageMoster ( 2013-09-10 09:41:52 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2013-09-12 23:24:49 -0600

In the first select a column then specify kernel size with (1,n).

The following code shows you how to do it.

Mat input_img = imread("c:\\test.bmp",0);

int x = 100;
GaussianBlur(input_img.col(x),input_img.col(x),Size(1,13),0);

imshow("view",input_img);
waitKey(0);
edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-09-10 06:24:46 -0600

Seen: 419 times

Last updated: Sep 12 '13