This interface provide functionalities of various image filtering operations. More...
Public Member Functions | |
void | Equalize (ILImage *img, ILImage *result) |
void | Gaussian (ILImage *img, ILImage *result) |
void | HighPass (ILImage *img, ILImage *result) |
void | LocalMedian (ILImage *img, ILImage *result) |
void | LocalMedianNorm (ILImage *img, ILImage *result) |
void | MeanFilter (ILImage *img, ILImage *result) |
void | OpticalDensity (ILImage *img, ILImage *result) |
void | SetKernelSigma (double kSigma, double kGain) |
void | SetKernelSize (int kWidth, int kHeight) |
void | Sharpen (ILImage *img, ILImage *result) |
Public Member Functions inherited from ILObject | |
ILObject * | Copy () |
LPVErrorCode | Load (LString filename) |
void | Reset () |
LPVErrorCode | Save (LString filename) |
BOOL | Valid () |
Properties | |
double | KernelGain [get] |
The gain value for Gaussian-like kernel. More... | |
int | KernelHeight [get] |
The height of the kernel size. More... | |
double | KernelSigma [get] |
The sigma value for Gaussian-like kernel. More... | |
int | KernelWidth [get] |
The width of the kernel size. More... | |
This interface provide functionalities of various image filtering operations.
In a vision system, it's common to use image filtering operations to do pre-processing before detection and inspection task, in order to smooth, denoise, enhance or normalize the input image. The most common type of filters are linear, in which an output pixel's value is determined as a weighted sum of input pixel values:
\[ I'(x,y) = \sum_{i,j} f(x+i, y+j) k(i,j) \]
\( k(i,j) \) is called the filtering kernel.
To use this interface, you should create a LImageFilter object.
Equalizes the histogram of the input grayscale image. It will normalizes the brightness and increases the contrast of the image. This operation is not a linear filter, thus does not use the kernel size.
[in] | img | The input image |
[out] | result | Return result image |
Blurs an image using a Gaussian filter. Two x and y order Gaussian kernel is computed as a \( \texttt{ksize} \times 1 \) matrix of coefficients:
\[ G_i= \alpha *e^{-(i-( \texttt{ksize} -1)/2)^2/(2* \texttt{sigma}^2)}, \]
where \( i=0..\texttt{ksize}-1 \) , \( \alpha \) is the scale factor chosen so that \( \sum_i G_i=1 \) , \( sigma \) is computed from ksize as \( ksize \times 0.6 \) .
[in] | img | The input image |
[out] | result | Return result image |
Edges are enhanced relative to areas with more consistent greyscale gradient. High-pass filtering is the equivalent of subtracting Gaussian blur image from input image.
[in] | img | The input image |
[out] | result | Return result image |
Each output pixel represents the median pixel value of the pixel values in the kernel neighborhood.
[in] | img | The input image. For non-squared or kernel size larger than 5, only 8bit images are supported. |
[out] | result | Return result image |
Used to subtract the background from an image. This filter is the equivalent of subtracting the local median from the input image, shifts the result right by one, and then adds 128.
[in] | img | The input image. For non-squared or kernel size larger than 5, only 8bit images are supported. |
[out] | result | Return result image |
Each output pixel represents the mean pixel value of the pixel values in the kernel neighborhood. The \( 3 \times 3 \) kernel is as below:
[in] | img | The input image |
[out] | result | Return result image |
Reveals the density of objects and features in the input image by measuring the amount of light that passes through them. Denser objects and features are represented by lighter pixels in the output image. This filter is the equivalent of \( 45*(ln(255) - ln(I)) \) for a 8bit image, and \( 5909*(ln(65535) - ln(I)) \) for a 16bit image.
[in] | img | The input image |
[out] | result | Return result image |
void SetKernelSigma | ( | double | kSigma, |
double | kGain | ||
) |
Change the kernel using the specified sigma and gain value.
[in] | kSigma | The sigma value is used to control the Gaussian-like kernel's smoothness. For 0(default), the sigma value is computed as \( 1/6 \) of the kernel size. If the kernel size is set to all zeros, then we'll compute a proper size from the sigma value, it's around \( 6 \times kSigma \) . |
[in] | kGain | The gain value is used to for Sharpen() to controls the overall strength of the sharpening effect. |
void SetKernelSize | ( | int | kWidth, |
int | kHeight | ||
) |
Change kernel size used in the filter, by default it's a \( 3 \times 3 \) kernel. Large kernel size results usually in stronger filtering effect, but also slower.
You may set the kernel size to 0 then we'll compute a proper size from the sigma value.
[in] | kWidth | The width of the kernel size, should be an odd number, say, 3, 5, 7, etc. |
[in] | kHeight | The height of the kernel size, should be an odd number, say, 3, 5, 7, etc. |
Emphasize texture and make the edges crisper and better defined. The strength of the sharpening effect is controlled by the kernel's size, sigma and gain value.
[in] | img | The input image |
[out] | result | Return result image |
|
get |
The gain value for Gaussian-like kernel.
|
get |
The height of the kernel size.
|
get |
The sigma value for Gaussian-like kernel.
|
get |
The width of the kernel size.