## vxl-users

 Re: [Vxl-users] A problem in New VIL Gaussian Convolution From: Guowei He - 2003-07-11 05:13:20 ```I am sorry for nor elaborating it clearly. Because I first use the program in VXL // create a normalized Gaussian kernel with standard deviation //sigma=2.0 // vcl_cout << "Creating kernel...\n"; float sigma = 4.0f; float scaleFactor = 1.f / ( 2.f * sigma * sigma ); const int halfSupport = 15; // build kernel float kernel[2*halfSupport+1]; float sum = 0; for ( int i = -halfSupport ; i <= halfSupport ; ++i ) { kernel[i+halfSupport] = vcl_exp( -i * i * scaleFactor ); sum += kernel[i+halfSupport]; } // normalize kernel for ( int i = -halfSupport ; i <= halfSupport ; ++i ) { kernel[i+halfSupport] /= sum; } // convolution of the input image in y-direction vcl_cout << "Convolving in y-direction...\n"; vil_convolve_1d(vil_transpose( imageIn ), tmp, &kernel[halfSupport], -halfSupport, halfSupport, float(), vil_convolve_constant_extend, vil_convolve_constant_extend ); // convolution of the input image in x-direction vcl_cout << "Convolving in x-direction...\n"; vil_convolve_1d(vil_transpose( tmp ), imageOut, &kernel[1], -halfSupport, halfSupport, float(), vil_convolve_constant_extend, vil_convolve_constant_extend ); to filter image. The result is the same as I use Gaussian filter in MATLAB. But when I use the program vil_gauss_filter_params t(sigma); vil_gauss_filter(imageIn,imageOut,t); when sigma is below 2.0, the result is the same as the previous program. But when I set sigma to 4.0, the result is different. I knew that in New Vil, the gaussian filtering is using the recursive gaussian filter algorithm. So maybe the method I call vil_gauss_filter is wrong? What is correct method to call function vil_gauss_filter? Thanks a lot! Guowei On Thu, 10 Jul 2003 15:24:43, Amitha Perera wrote: > On Wed 09 Jul 2003, Guowei He wrote: > > I have a problem in using guassian convolution. When I set sigma>4, > > the result is not good as MATLAB. > > Can you elaborate on what you mean by "not as good as MATLAB"? How did > you quantify "good"? > > Amitha. > > > ------------------------------------------------------- > This SF.Net email sponsored by: Parasoft > Error proof Web apps, automate testing & more. > Download & eval WebKing and get a free book. > http://www.parasoft.com/bulletproofapps1 > _______________________________________________ > Vxl-users mailing list > Vxl-users@... > https://lists.sourceforge.net/lists/listinfo/vxl-users > > ```
 RE: [Vxl-users] A problem in New VIL Gaussian Convolution From: Ian Scott - 2003-07-14 08:49:34 ```Guowei Your first post mentioned using vil_gauss_filter_5tap, your second post vil_gauss_filter. I can't find a function called vil_gauss_filter, so I assume that you are using vil_gauss_filter_5tap. You should not expect vil_gauss_filter_5tap to work particularly well with a large value (>1.5) for sigma, because there are only 5 taps per 1-d FIR filter (as opposed to the 15 taps in you original program). That function is designed to do fast rough gaussian filtering. If you want to do it the old way, i.e. specifying your own kernel, try using vil_convolve_1d http://paine.wiau.man.ac.uk/pub/doc_vxl/core/vil/html/classvil__image__view. html#vil__image__viewk0 Ian Scott. > -----Original Message----- > From: Guowei He [mailto:gzh101@...] > Sent: Friday, July 11, 2003 6:13 AM > To: Amitha Perera; Vxl-users@... > Subject: Re: [Vxl-users] A problem in New VIL Gaussian Convolution > > > I am sorry for nor elaborating it clearly. > Because I first use the program in VXL > // create a normalized Gaussian kernel with standard deviation > //sigma=2.0 > // vcl_cout << "Creating kernel...\n"; > float sigma = 4.0f; > float scaleFactor = 1.f / ( 2.f * sigma * sigma ); > const int halfSupport = 15; > > // build kernel > float kernel[2*halfSupport+1]; > float sum = 0; > for ( int i = -halfSupport ; i <= halfSupport ; ++i ) > { > kernel[i+halfSupport] = vcl_exp( -i * i * scaleFactor ); > sum += kernel[i+halfSupport]; > } > > // normalize kernel > for ( int i = -halfSupport ; i <= halfSupport ; ++i ) > { > kernel[i+halfSupport] /= sum; > } > > > // convolution of the input image in y-direction > vcl_cout << "Convolving in y-direction...\n"; > vil_convolve_1d(vil_transpose( imageIn ), tmp, > &kernel[halfSupport], -halfSupport, halfSupport, > float(), > vil_convolve_constant_extend, > vil_convolve_constant_extend ); > > // convolution of the input image in x-direction > vcl_cout << "Convolving in x-direction...\n"; > vil_convolve_1d(vil_transpose( tmp ), imageOut, > &kernel[1], -halfSupport, halfSupport, > float(), > vil_convolve_constant_extend, > vil_convolve_constant_extend ); > > to filter image. > The result is the same as I use Gaussian filter in MATLAB. > But when I use the program > vil_gauss_filter_params t(sigma); > vil_gauss_filter(imageIn,imageOut,t); > when sigma is below 2.0, the result is the same as the > previous program. > But when I set sigma to 4.0, the result is different. > I knew that in New Vil, the gaussian filtering is using the > recursive gaussian > filter algorithm. > So maybe the method I call vil_gauss_filter is wrong? What is > correct method to > call function vil_gauss_filter? > > Thanks a lot! > Guowei > > On Thu, 10 Jul 2003 15:24:43, Amitha Perera wrote: > > > On Wed 09 Jul 2003, Guowei He wrote: > > > I have a problem in using guassian convolution. When I > set sigma>4, > > > the result is not good as MATLAB. > > > > Can you elaborate on what you mean by "not as good as > MATLAB"? How did > > you quantify "good"? > > > > Amitha. > > > > > > ------------------------------------------------------- > > This SF.Net email sponsored by: Parasoft > > Error proof Web apps, automate testing & more. > > Download & eval WebKing and get a free book. > > http://www.parasoft.com/bulletproofapps1 > > _______________________________________________ > > Vxl-users mailing list > > Vxl-users@... > > https://lists.sourceforge.net/lists/listinfo/vxl-users > > > > > > > > ------------------------------------------------------- > This SF.Net email sponsored by: Parasoft > Error proof Web apps, automate testing & more. > Download & eval WebKing and get a free book. > http://www.parasoft.com/bulletproofapps1 > _______________________________________________ > Vxl-users mailing list > Vxl-users@... > https://lists.sourceforge.net/lists/listinfo/vxl-users > ```

No, thanks