Analyze an Image

NI Vision for LabVIEW Basics

Analyze an Image

When you acquire and display an image, you may want to analyze the contents of the image for the following reasons:

  • To determine if the image quality is sufficient for your inspection task
  • To obtain the values of parameters that you want to use in processing functions during the inspection process

The histogram and line profile tools can help you analyze the quality of your images.

Use the IMAQ Histograph and IMAQ Histogram VIs to analyze the overall grayscale distribution in the image. Use the histogram of the image to analyze two important criteria that define the quality of an image saturation and contrast. If your image is underexposed because it was acquired in an environment without sufficient light, the majority of your pixels will have low intensity values, which appear as a concentration of peaks on the left side of your histogram. If your image is overexposed because it was acquired in an environment with too much light, the majority of the pixels will have high intensity values, which appear as a concentration of peaks on the right side of your histogram. If your image has an appropriate amount of contrast, your histogram will have distinct regions of pixel concentrations. Use the histogram information to decide if the image quality is sufficient enough to separate objects of interest from the background.

If the image quality meets your needs, use the histogram to determine the range of pixel values that correspond to objects in the image. You can use this range in processing functions, such as determining a threshold range during particle analysis.

If the image quality does not meet your needs, try to improve the imaging conditions to get the necessary image quality. You may need to re-evaluate and modify each component of your imaging setup: lighting equipment and setup, lens tuning, camera operation mode, and acquisition device parameters. If you reach the best possible conditions with your setup but the image quality still does not meet your needs, try to improve the image quality using the image processing techniques described in the section of this chapter.

Use the IMAQ LineProfile VI to get the pixel distribution along a line in the image, or use the IMAQ ROIProfile VI to get the pixel distribution along a one-dimensional path in the image. To use a line profile to analyze your image, draw or specify a line across the boundary of an object in your image. Use IMAQ LineProfile to examine the pixel values along the line. By looking at the pixel distribution along this line, you can determine if the image quality is good enough to provide you with sharp edges at object boundaries. Also, you can determine if the image is noisy, and identify the characteristics of the noise.

If the image quality meets your needs, use the pixel distribution information to determine some parameters of the inspection functions you want to use. For example, use the information from the line profile to determine the strength of the edge at the boundary of an object. You can input this information into the IMAQ Edge Tool 2 VI to find the edges of objects along the line.