#include <img.h>Go to the source code of this file.
Functions | |
| int | imgFillGaussKernel (float **kernel, float stdev, int size) |
| int | imgConvolute2D (float ***data, float **buffer, int frame, int width, int height, float **kernel, int size, int border, int verbose, char *errmsg) |
| int | imgGaussianFilter (IMG *img, float gauss_sd, int size, int border, int verbose, char *errmsg) |
| float ** | mallocMatrix (float w, float h) |
| float ** | imgGaussKernel (int size) |
| Make a gaussian convolution kernel. | |
| void | imgFreeKernel (float **kernel, int size) |
| Free a convolution kernel. | |
| void | imgConvoluteData (float ***data, float **buffer, int frame, int width, int height, float **kernel, int size) |
| Perform a convolution operation on float data. | |
| int | imgConvolute (IMG *img, int frame, int plane, float **kernel, int size) |
| Perform a convolution operation on image. | |
| int imgConvolute | ( | IMG * | img, |
| int | frame, | ||
| int | plane, | ||
| float ** | kernel, | ||
| int | size | ||
| ) |
Perform a convolution operation on image.
The bordering size/2 pixels of the image do not containg valid data. imgConvolute is quite memory efficient. Only (img->dimx+size)*size*sizeof(float) bytes are consumed by a temporary buffer. When processing multiple planes/frames/images with equal width and kernel size, efficiency can be improved further by allocating the temporary buffer yourself and calling imgConvoluteData directly.
| img | image |
| frame | frame to perform operation on |
| plane | plane to perform operation on |
| kernel | convolution kernel |
| size | convolution kernel size |
Definition at line 491 of file imgfilter.c.
References imgConvoluteData(), and mallocMatrix().
| int imgConvolute2D | ( | float *** | data, |
| float ** | buffer, | ||
| int | frame, | ||
| int | width, | ||
| int | height, | ||
| float ** | kernel, | ||
| int | size, | ||
| int | border, | ||
| int | verbose, | ||
| char * | errmsg | ||
| ) |
Perform a convolution operation on one image matrix.
| data | Image matrix data[height][width][frame] |
| buffer | Temporary preallocated memory buffer[size][width+size-1] |
| frame | frame [0..dimt] of data matrix which is processed |
| width | Width of image matrix (dimx) |
| height | Height of image matrix (dimy) |
| kernel | Convolution kernel[size][size] matrix |
| size | Convolution kernel size; must be an odd number and >=3 |
| border | Fill borders with zero (0) or with closest image pixel (<>0) |
| verbose | Verbose level; if zero, then only warnings are printed into stderr |
| errmsg | Pointer to error message, at least 128 characters; NULL, if not needed |
Definition at line 101 of file imgfilter.c.
Referenced by imgGaussianFilter().
| void imgConvoluteData | ( | float *** | data, |
| float ** | buffer, | ||
| int | frame, | ||
| int | width, | ||
| int | height, | ||
| float ** | kernel, | ||
| int | size | ||
| ) |
Perform a convolution operation on float data.
| data | data in format float[y][x][frame] |
| buffer | temporary buffer to use. Size must be float[size][data width+size] |
| frame | frame to extract from data |
| width | width of the image |
| height | height of the image |
| kernel | convolution kernel |
| size | convolution kernel size |
Definition at line 418 of file imgfilter.c.
Referenced by imgConvolute().
| int imgFillGaussKernel | ( | float ** | kernel, |
| float | stdev, | ||
| int | size | ||
| ) |
Make a gaussian convolution kernel.
| kernel | Gaussian convolution kernel matrix[size][size], filled here |
| stdev | Gaussian S.D. in pixels (decimals are ok) |
| size | Kernel dimension |
Definition at line 52 of file imgfilter.c.
Referenced by imgGaussianFilter().
| void imgFreeKernel | ( | float ** | kernel, |
| int | size | ||
| ) |
Free a convolution kernel.
| kernel | the convolution kernel |
| size | size of the kernel |
Definition at line 401 of file imgfilter.c.
| int imgGaussianFilter | ( | IMG * | img, |
| float | gauss_sd, | ||
| int | size, | ||
| int | border, | ||
| int | verbose, | ||
| char * | errmsg | ||
| ) |
Apply Gaussian filter to whole dynamic image in IMG struct.
| img | Image data to be processed; data is overwritten with filtered image |
| gauss_sd | Gaussian S.D. in pixels (decimals are ok) |
| size | Gaussian kernel size (must be odd number); typically 6*gauss_sd is sufficient |
| border | In filtering, fill borders with zero (0) or with closest image pixel (<>0) |
| verbose | Verbose level; if zero, then only warnings are printed into stderr |
| errmsg | Pointer to error message, at least 128 characters; NULL, if not needed |
Definition at line 251 of file imgfilter.c.
References imgConvolute2D(), and imgFillGaussKernel().
| float** imgGaussKernel | ( | int | size | ) |
Make a gaussian convolution kernel.
| size | kernel size |
Definition at line 376 of file imgfilter.c.
References mallocMatrix().
| float** mallocMatrix | ( | float | w, |
| float | h | ||
| ) |
Definition at line 352 of file imgfilter.c.
Referenced by imgConvolute(), and imgGaussKernel().
1.8.0