MatchColor
The MatchColor function, referencing a MatchColorLib data structure returned by a TrainMatchColor function, determines which Colors present in the Region of Interest (ROI) match the trained Color(s) in the TrainMatchColor color library. The MatchColor function outputs a Colors data structure, which contains the color distance and match score, in addition to an overall confidence score, for each active Color referenced in the MatchColorLib data structure.
MatchColor Inputs
General Tab
MatchColor(Image,Fixture.Row,Fixture.Column,Fixture.Theta,Region.X,Region.Y,Region.High,Region.Wide,Region.Angle,Region.Curve,External Region,Match Color Library,Color Space,Show)
- In order for a pixel to be counted, it must be completely enclosed within the image region; partially enclosed pixels are not included.
- The Fixture and Region parameters must be defined within the bounds of the image; otherwise, the function will return #ERR.
Parameter | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Specifies the color image reference. This argument must reference either the valid color Image data structure output by the AcquireImage function, or a Colors data structure output by another MatchColor function. By default, the cell referenced is A0, the cell containing the Image data structure returned by AcquireImage. Note: This parameter must reference a color image.
|
|||||||||||||
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.
|
|||||||||||||
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: If this parameter has been set as a reference to an external region, to use the function's internal Region, this parameter must be manually set to zero by entering the value 0 in place of the cell reference. Otherwise, the function will continue to reference the external region.
|
|||||||||||||
Specifies a reference to a TrainMatchColor function that contains the required Colors. For more information, see TrainMatchColor. Note: This must be a reference to a TrainMatchColor MatchColorLib data structure. This function cannot reference an ExtractColorLib data structure output by a TrainExtractColor function. The MatchColor function will return #ERR in this condition.
|
|||||||||||||
Specifies the color space that the function will use to measure color distance.
|
|||||||||||||
Specifies the display mode for MatchColor graphical overlays on top of the image.
|
Colors Tab
Specifies the Colors to be extracted from the referenced TrainMatchColor MatchColorLib data structure; by default, all of the trained Colors in the referenced Library are automatically enabled.
MatchColor Outputs
Returns |
A Colors data structure containing the RGB and HSI color distances of the active Colors to the average color in the ROI, or #ERR if any of the input parameters are invalid. |
Results |
When MatchColor is initially inserted into a cell, a result table is created in the spreadsheet. |
MatchColor Vision Data Access Functions
The following Vision Data Access functions are automatically inserted into the spreadsheet to create the result table. For more information, see Color.
Index |
GetMatchClrColorByRank(Colors, Rank) |
The color index by rank. |
MatchColor Color |
GetActiveMatchClrColorName(Colors, Index) |
The name by index. |
Score |
GetMatchClrScoreByIndex(Colors, Index) |
The color score by index. |
Color Distance |
GetMatchClrDistByIndex(Colors, Index) |
The color distance by index. |
Confidence Score |
GetConfidenceScore(Colors) |
The confidence score for the inspection. |