This interface provide functionalities of various image filtering operations. More...
Public Member Functions | |
void | EdgePreserveDenoise (ILImage *img, ILImage *result, int speedupFactor, ILImage *refImg) |
void | EdgePreserveTextureEnhance (ILImage *img, ILImage *result, int speedupFactor, ILImage *refImg) |
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 filter kernel. More... | |
int | KernelHeight [get] |
The height of the kernel size. More... | |
double | KernelSigma [get] |
The sigma value for filter 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) \]
@math_eq{k(i,j)} is called the filtering kernel.
To use this interface, you should create a LImageFilter object.
Smooth out image noise while retaining sharp edges. The smoothness of the denoising process is controlled by KernelSigma value with recommended value in 0.01 ~ 0.1.
[in] | img | The input image |
[out] | result | Return result image |
[in] | speedupFactor | To speed-up the algorithm, the suggested values are factors of the kernel's size or 1 (no speed-up). |
[in] | refImg | Optional. The reference image provides additional edge information such as the approximate location and intensity of the edges that need to be preserved for the noise reduction process. It should have the same size as the input image. |
void EdgePreserveTextureEnhance | ( | ILImage * | img, |
ILImage * | result, | ||
int | speedupFactor, | ||
ILImage * | refImg | ||
) |
Enhance the texture on image while retaining sharp edges. The smoothness of the enhancing process is controlled by KernelSigma value with recommended value in 0.01 ~ 0.1.
[in] | img | The input image |
[out] | result | Return result image |
[in] | speedupFactor | To speed-up the algorithm, the suggested values are factors of the kernel's size or 1 (no speed-up). |
[in] | refImg | Optional. The reference image provides additional edge information such as the approximate location and intensity of the edges that need to be preserved for the texture enhancing process. It should have the same size as the input image. |
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 @math_eq{\texttt{ksize} \times 1} matrix of coefficients:
\[ G_i= \alpha *e^{-(i-( \texttt{ksize} -1)/2)^2/(2* \texttt{sigma}^2)}, \]
where @math_eq{i=0..\texttt{ksize}-1} , @math_eq{\alpha} is the scale factor chosen so that @math_eq{\sum_i G_i=1} , @math_eq{sigma} is set via SetKernelSigma() or computed from ksize as @math_eq{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 @math_eq{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 @math_eq{45*(ln(255) - ln(I))} for a 8bit image, and @math_eq{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 filter kernel's smoothness. For HighPass(), Gaussian() and Sharpen() functions, if the sigma value is set to 0 then it's computed as @math_eq{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 @math_eq{6 \times kSigma} . For EdgePreserveDenoise() and EdgePreserveTextureEnhance(), set sigma value to 0 means no extra smoothing. |
[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 @math_eq{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, KernelSigma and KernelGain value.
[in] | img | The input image |
[out] | result | Return result image |
|
get |
The gain value for filter kernel.
|
get |
The height of the kernel size.
|
get |
The sigma value for filter kernel.
|
get |
The width of the kernel size.