Using the information you gathered from analyzing your image, you may want to improve the quality of your image for inspection. You can improve your image with lookup tables, filters, grayscale morphology, and Fast Fourier transforms.
Apply lookup table (LUT) transformations to highlight image details in areas containing significant information at the expense of other areas. A LUT transformation converts input grayscale values in the source image into other grayscale values in the transformed image. NI Vision provides four VIs that directly or indirectly apply lookup tables to images:
Filter your image when you need to improve the sharpness of transitions in the image or increase the overall signal-to-noise ratio of the image. You can choose either a lowpass or highpass filter depending on your needs.
Lowpass filters remove insignificant details by smoothing the image, removing sharp details, and smoothing the edges between the objects and the background. You can use the IMAQ LowPass VI or define your own lowpass filter using the IMAQ Convolute or IMAQ NthOrder VI.
Highpass filters emphasize details, such as edges, object boundaries, or cracks. These details represent sharp transitions in intensity value. You can define your own highpass filter using the IMAQ Convolute or IMAQ NthOrder VI or use the IMAQ EdgeDetection or IMAQ CannyEdgeDetection VI. IMAQ EdgeDetection allows you to find edges in an image using predefined edge detection kernels, such as the Sobel, Prewitt, and Roberts kernels.
The IMAQ Convolute VI allows you to use a predefined set of lowpass and highpass filters. Each filter is defined by a kernel of coefficients. Use the IMAQ GetKernel VI to retrieve predefined kernels. If the predefined kernels do not meet your needs, define your own custom filter using a LabVIEW 2D array of floating point numbers.
IMAQ NthOrder allows you to define a lowpass or highpass filter depending on the value of N that you choose. One specific Nth order filter, the median filter, removes speckle noise, which appears as small black and white dots. Refer to the Image Processing section of the NI Vision Concepts Help for more information about Nth order filters.
Perform grayscale morphology when you want to filter grayscale features of an image. Grayscale morphology helps you remove or enhance isolated features, such as bright pixels on a dark background. Use these transformations on a grayscale image to enhance non-distinct features before thresholding the image in preparation for particle analysis.
Grayscale morphological transformations compare a pixel to those pixels surrounding it. The transformation keeps the smallest pixel values when performing an erosion or keeps the largest pixel values when performing a dilation.
Refer to the Image Processing section of the NI Vision Concepts Help for more information about grayscale morphology transformations.
Use the IMAQ GrayMorphology VI to perform one of the following seven transformations:
Use Fast Fourier Transforms (FFT) to convert an image into its frequency domain. In an image, details and sharp edges are associated with mid to high spatial frequencies because they introduce significant gray-level variations over short distances. Gradually varying patterns are associated with low spatial frequencies.
An image can have extraneous noise, such as periodic stripes, introduced during the digitization process. In the frequency domain, the periodic pattern is reduced to a limited set of high spatial frequencies. Also, the imaging setup may produce non-uniform lighting of the field of view, which produces an image with a light drift superimposed on the information you want to analyze. In the frequency domain, the light drift appears as a limited set of low frequencies around the average intensity of the image, called the DC component.
You can use algorithms working in the frequency domain to isolate and remove these unwanted frequencies from your image. Complete the following steps to obtain an image in which the unwanted pattern has disappeared but the overall features remain.
The IMAQ ImageToComplexPlane and IMAQ ComplexPlaneToImage VIs allow you to access, process, and update independently the magnitude, phase, real, and imaginary planes of a complex image. You also can convert a complex image to an array and back using the IMAQ ComplexImageToArray and IMAQ ArrayToComplexImage VIs.