TrainFlawModel
The TrainFlawModel function is used to create the model of the "golden" or perfect part /object that will be compared against acquired images. This function defines what will be inspected; the Region of Interest (set either through the Region or External Region or Path parameter) defines the area of the image that is trained, as well as where the DetectFlaw and FlexFlawModel functions which reference it, perform their search.
On each image acquisition, the ROI is adjusted based on the current Fixture values; the ROI coordinates, and updated Scale value, are passed to any DetectFlaw or FlexFlawModel functions that reference it. The TrainFlawModel will retain the model.
TrainFlawModelInputs
Parameter | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Image |
This parameter must use Cell References in
a spreadsheet cell that contains an Image data structure; by
default, this parameter references A0, the cell containing the Image data structure returned by Note:
|
||||||||||||
Fixture |
Defines the Region of Interest (ROI) relative to a Fixture input or the output of a Vision Tools function's image coordinate system. Setting the ROI relative to a Fixture ensures that if the Fixture is rotated or translated, the ROI will be rotated or translated in relation to the Fixture. The default setting is (0,0,0), the top leftmost corner of the image.
|
||||||||||||
Region |
Also known as the Region of Interest (ROI), specifies the region of the image that undergoes analysis; creates an Interactive Graphics Mode that can be transformed and rotated. With this parameter selected, by pressing the Maximize Region button on the property sheet's Job Edit toolbar, the region will automatically be stretched to cover the entire image. Note:
Use the External Region or Path parameter instead of setting cell references to the region coordinates if attempting to define the ROI relative to the output of another Vision Tool function or Graphics Functions]. The External Region or Path parameter will properly account for fixture movement, while the cell references may not function correctly and may cause any functions that reference it to result in #ERR.
|
||||||||||||
Note: The Fixture and Region parameters must be defined
within the bounds of the image; otherwise, the function will return #ERR.
|
|||||||||||||
External Region or Path |
Specifies Cell References to a spreadsheet cell that contains an Annulus, a Region, an EditAnnulus, an EditMaskedRegion, an EditPolylinePath or an EditRegion function. When this parameter is used, the function ignores the Region and Fixture settings and inspects the image area specified by the referenced region. Note:
|
||||||||||||
Scale |
Specifies the expected scaled size of the modeled part/object at run-time (80 to 120; default = 100), as a percentage, compared to the trained model. Note: If, for instance, a FindPatMaxRedLine function is being used to supply the Fixture input value, the TrainFlawModel function's Scale parameter may be set as a cell reference to the Scale value output by a FindPatMaxRedLine function.
|
||||||||||||
Edge Mask Size |
Specifies the tolerance amount (0 to 5; default = 0) near edges to build into the mask image. |
||||||||||||
Minimum Edge Strength |
Specifies the minimum change in intensity (10 to 255; default = 30)across an edge to be included in the model. |
||||||||||||
Minimum Edge Length |
Specifies the minimum edge length (10 to 1000; default = 20) to be included in the model; edges shorter than this length will be excluded from the model. This value represents the minimum number of edge pixels that are connected into an edge. When this parameter is set to a higher value, fewer edges will be detected, while setting this parameter to a lower value will cause more edges to be detected. This setting helps to filter out noisy edge pixels, which are generally short. |
||||||||||||
Force Train |
Specifies whether or not automatic model retraining will be performed on spreadsheet updates. Irrespective of the Force Train parameter, the model will be retrained when the property sheet for the function is open and the following parameters are changed and confirmed by pressing the OK button:
During run-time operation, the model will be retrained if any of the following actions occur:
|
||||||||||||
Display Resolution |
Specifies the resolution used to display the model image and the edge model. Specifying either Medium or Coarse downsamples the image, removing fine details and noise.
|
||||||||||||
Draw Edge Markings |
Specifies whether or not the edges in the model will be drawn on the image. Trained edges are drawn in green, masked edges are drawn in blue.
|
||||||||||||
Display Image |
Specifies the output image to display. Note: This image is for display purposes only, and may not be used as an input to another function.
|
||||||||||||
Timeout (ms) | Specifies the amount of time, in milliseconds (0 to 30000; default = 5000), that the function will search for a valid model before execution is halted an #ERR is returned. Setting the value to 0 will disable the setting and a timeout will not be applied. | ||||||||||||
Show |
Specifies the display mode for TrainFlawModel graphical overlays on top of the image. Pixels that match those in the trained model will be colored green; pixels that do not match will be colored yellow; pixels that are missing from the Mask Image will be colored blue; extra pixels in the Mask Image will be colored dark magenta; extra edge defects will be colored magenta; and missing edge and area defect pixels will be colored in red.
|
TrainFlawModel Outputs
Returns |
A TrainFlawModel data structure containing, for each resolution, a Model Image, Edge Model Image and a Mask Image; or #ERR if any of the input parameters are invalid. |
||
Results |
When TrainFlawModel is initially inserted into a cell, the following Flaw Detection Vision Data Access Function is inserted into the spreadsheet.
|