# Detect Flaw

| The Detect Flaw tab of the property sheet provides custom controls for the DetectFlaw tool and is separated into two sections: Edit Mask and Defect List. While the Detect Flaw tab is selected, the image will appear (without the spreadsheet grid) showing a graphic overlay. The graphics overlaid on the image will initially depend on the settings in the Defect Parameters General tab. If the Edge Defect Type parameter is enabled, masked edges will be marked. Whereas, if the Area Defect Type parameter is enabled, the mask image will be displayed. Select None in either of these parameters to turn off the associated graphics. Below is a description of the settings found under the Detect Flaw tab of the DetectFlaw Property Sheet.

## Edit Mask Buttons

The Edit Mask Buttons provide a means to manipulate the Mask Image saved in the referenced TrainFlawModel or FlexFlawModel data structure.

Note:

- Adjusting the Mask Image will affect any other DetectFlaw functions that reference the same TrainFlawModel function which contains the Mask Image.
- When applying the DetectFlaw function, if the tolerances for the Defect Parameters are narrow (i.e. ≤ 15 pixels, for instance), and the image encounters minor variations in image noise, the options Ignore Defect and Add Residual may not account for the variations. In these situations, attempt to broaden the tolerances for the Defect Parameters before applying the Ignore Defect or Add Residual options.

Button Label | Description
Add Residual Image | Specifies that the residual image and residual edges will be added to the mask. This setting has the effect of changing the defects identified in the image into non-defects.
Expand Mask | Specifies that the area of the pixels in the mask are expanded. Note: Area Defect Type parameter must be enabled in the DefectFlaw General tab to use this option.
Shrink Mask | Specifies that the area of the pixels in the mask are reduced. Note: Area Defect Type parameter must be enabled in the DefectFlaw tab to use this option.
Remove Mask | Specifies that all of the mask data is removed.
Reset to Default Mask | Specifies that the Mask Image is reset to its initially trained state, by regenerating the mask data from the Model Image.

## Defect List

The Defect List provides a sortable table of the detected flaw(s). Selecting a defect in the list highlights the detected flaw in green in the image. Flaw(s) can be ignored from the tools output by first selecting flaw(s) and then clicking the Ignore Selected Defects button. Multiple flaws may be selected using the SHIFT key, or use the CTRL key to select non-contiguous defects in the list.

Note: When applying the DetectFlaw function, if the tolerances for the Defect Parameters are narrow (i.e. ≤ 15 pixels, for instance), and the image encounters minor variations in image noise, the options Ignore Defect and Add Residual may not account for the variations. In these situations, attempt to broaden the tolerances for the Defect Parameters before applying the Ignore Defect or Add Residual options.

Index | Specifies the numeric order of the detected flaws, from 0 to N.
Type | Specifies the type of flaw: Extra Edge, Missing Edge or Area.
Contrast | Specifies the contrast of the flaw.
X | Specifies the x-coordinate of the bounding box surrounding the flaw.
Y | Specifies the y-coordinate of the bounding box surrounding the flaw.
Width | Specifies the width value of the bounding box surrounding the flaw.
Height | Specifies the height value of the bounding box surrounding the flaw.
Size | Specifies the size, in pixels, of the flaw.
Ignore Selected Defects Button | Specifies that the selected flaw(s) will be added to the Mask Image, no longer reported as a flaw and removed from the list. Note: At least one flaw must be selected to enable the button.