get_2D_gaussian_mask - Constructs a 2D Gaussian mask


#include "m/m_convolve.h"

Example compile flags (system dependent):
   -L/home/kobus/misc/load/linux_x86_64_opteron -L/usr/lib/x86_64-linux-gnu
  -lKJB                               -lfftw3  -lgsl -lgslcblas -ljpeg  -lSVM -lstdc++                    -lpthread -lSLATEC -lg2c    -lacml -lacml_mv -lblas -lg2c      -lncursesw 

int get_2D_gaussian_mask
	Matrix **mask_mpp,
	int mask_size,
	double sigma


Matrix **mask_mpp
Output gaussian smoothing mask.
int mask_size
Number of elements per axis.
double sigma
Standard deviation in bin units.


This routine constructs a 2D Gaussian mask, putting the result into *out_mpp. If the size of the mask is odd, then the center of the Gaussian is in the center of the mask. If it is even, the center is as though the mask was one larger. For example, if your mask size is 6, then the center is the third pixel, which is the same pixel as it it would be if the mask size was 5. If you want a have a mask which contains most of the Gaussian (excluded values are close to zero), then you need to make the mask size at least 6 times sigma. Regardless of the size and sigma, the mask is normalized so that its sum 1. If *out_vpp is NULL, then a vector of the appropriate size is created, if it is the wrong size, then it is resized, and if it is the right size, the storage is recycled.


NO_ERROR on success, and ERROR on failure, with an appropriate error message being set.


It seems that the handling of even size masks is due to lazy programming. We might consider making it so that values for the center pair of pixels are the same, and the true center value is not represented as it is between them in real valued coordinates.


This software is not adequatedly tested. It is recomended that results are checked independantly where appropriate.


Kobus Barnard


Kobus Barnard


gauss_convolve_matrix , convolve_matrix , x_convolve_matrix , y_convolve_matrix , convolve_vector , get_2D_gaussian_mask_dispatch , get_2D_gaussian_mask_2 , get_2D_gaussian_dx_mask , get_2D_gaussian_dy_mask , get_1D_gaussian_mask