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.For more information, see DetectFlaw and FlexFlawModel.
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
Syntax: TrainFlawModel(Image,Fixture.Row,Fixture.Column,Fixture.Theta,Region.X,Region.Y,Region.High,Region.Wide,Region.Angle,Region.Curve,External Region or Path,Scale,Edge Mask Size,Minimum Edge Strength,Minimum Edge Length,Force Train,Display Resolution,Draw Edge Markings,Display Image,Timeout,Show)
Parameter | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
This parameter must reference a spreadsheet cell that contains an Image data structure. By default, this parameter references A0, the cell containing the AcquireImage Image data structure. This parameter can also reference other Image data structures, such as those returned by the Vision Tool Image functions. For more information, see AcquireImage and Image. Note:
|
|||||||||||||
Defines the Region of Interest (ROI) relative to a Fixture input or the output of a Vision Tool 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. For more information, see Fixture and Vision Tools. Note: The default setting is (0,0,0), the top leftmost
corner of the image.
|
|||||||||||||
Also known as the Region of Interest (ROI), specifies the region of the image that undergoes analysis and creates a rectangular image region that can be transformed and rotated. For more information, see Interactive Graphics Mode. Tip: With this parameter
selected, you can press the Maximize
Region button on the property sheet's toolbar to maximize the region and cover the entire image.
Note: If attempting to define the ROI relative to the output of another Vision Tool function or Controls function, use the External Region or Path parameter instead of setting cell references to the region coordinates. 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.
|
|||||||||||||
This parameter can reference a spreadsheet cell that contains the following functions:
When this parameter is used, the function ignores the Region and Fixture settings and inspects the image area specified by referenced region. If an EditCompositeRegion control is referenced, the inspection area can be a mix of shapes. Each shape in the composite region can be assigned as added to or subtracted from (masking) the inspection area. Note:
|
|||||||||||||
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: For example, if a FindPatMaxPatterns 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 FindPatMaxPatterns function.For more information, see FindPatMaxPatterns.
|
|||||||||||||
Specifies the tolerance amount (0 to 5; default = 0) near edges to build into the mask image. |
|||||||||||||
Specifies the minimum change in intensity (10 to 255; default = 30)across an edge to be included in the model. |
|||||||||||||
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. |
|||||||||||||
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 disables the setting and a timeout is not applied. | ||||||||||||
Specifies the display mode for TrainFlawModelgraphical 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.
|
TrainFlawModelOutputs
Returns |
A TrainFlawModel datastructure containing, for each resolution, a Model Image, Edge Model Image and a Mask Image; or #ERR if anyof the input parameters are invalid. |
Results |
When TrainFlawModel is initially inserted into a cell, the Trained status will automatically appear in the adjacent cell to the right.If a model cannot be trained, then #ERR will be inserted. |
TrainFlawModel Vision Data Access Functions
One Vision Data Access function is automatically inserted into the spreadsheet:
Trained | GetTrained(TrainFlawModel) | Returns 1 if a model has been successfully trained, and 0 if a model cannot be trained. |