# DetectFlaw

The DetectFlaw function is used to identify flaws by comparing the trained data contained in a either a valid TrainFlawModel data structure returned by a TrainFlawModel function, or a FlexFlawModel data structure returned by a FlexFlawModel function, along with the currently acquired image. The DetectFlaw function is capable of identifying the following three types of flaws: Area Defects, Missing Edge Defects and/or Extra Edge Defects.

Area inspections verify whether or not there are defects such as scratches or stains on the surface of the object/part. Edge inspections verify whether or not there are extra or missing edges, or that the boundary of the object/part is consistent. Combining area and edge defects provides the highest degree of inspection verification.

Tip:

- One or more DetectFlaw functions may be referenced to a single TrainFlawModel function, which allows each DetectFlaw function to inspect different portions of the object/part using different settings, if necessary.
- To reduce the function's execution time, set the function's Image Resolution parameter in the General Tab to Medium or Coarse, which down-samples the image and decreases the function's sensitivity to image noise and very small variations.
- Additional image processing may be performed on the DetectFlaw output image when the Display Image parameter is set in the General Tab to either Edge Image, Model Image, Mask Image or Residual Image. For example, additional blob image analysis could be performed by setting an DetectBlobs function's Image parameter to the use the Residual Image of the DetectFlaw function as an input.

## DetectFlaw Outputs

Returns | A DetectFlaw data structure containing the detected flaws, or #ERR if any of the input parameters are invalid. Note: The DetectFlaw data structure may be used as an Image input for other Vision Tools.
Results | When DetectFlaw is initially inserted into a cell, a results table is created in the spreadsheet.