Color

For each of the following functions, the first parameter references a cell containing a color data structure. The structure is named according to the color tool that created it:

  • TrainExtractColor creates a ExtractColorLib data structure. For more information, see TrainExtractColor.
  • TrainMatchColor creates a MatchColorLib data structure. For more information, see TrainMatchColor.
  • ExtractColor and MatchColor create Colors. For more information, see ExtractColor and MatchColor.

The GetColorLibraryName function can be used to determine which tool created the data structure.

Function

Description

GetActiveExtClrModelName(Colors, Index)

Returns the name of the indexed active Color Model for an ExtractColor function.

GetActiveMatchClrColorName(Colors, Index)

Returns the name of the indexed active Color for a MatchColor function.

GetArea(ExtractColor)

Returns the area (number of pixels) of the extracted color.

Note: Supported on the In-Sight vision systems running firmware version 5.3.0 or later.

GetBlue(Colors)

Returns the blue component of the average Color in the region of interest (ROI) for a MatchColor function.

GetColorLibraryName(Color Structure)

Works with TrainExtractColor, TrainMatchColor, ExtractColor, and MatchColor. For the TrainExtractColor and TrainMatchColor functions, returns the name of the Color Library stored by the function. For the ExtractColor and MatchColor functions, returns the name of the referenced Train function (e.g. TrainExtractColor or TrainMatchColor, respectively).

GetConfidenceScore(Colors)

Returns the confidence score of the current inspection for a MatchColor function. The confidence score = ( s1 * (M - s2) - s2 * (M - s1)) / ( (M - s2) + (M - s1)); where s1 is best score, s2 is the second best score, M is a constant equal to 1.01. The higher the confidence score, the more likely it is that the best match was selected.

GetExtClrColorModelState(Colors, ColorModelName) Returns the state of the specified Color Model for an ExtractColor function.

GetExtClrModelByRank(Colors, Rank)

Returns the index of the Color Model that has the specified pixel count rank for an ExtractColor function. A rank of 0 is the highest and n-1 is the lowest.

GetGreen(Colors)

Returns the Green component of the average color in the ROI for a MatchColor function.

GetHue(Colors)

Returns the Hue component of the average color in the ROI for a MatchColor function.

GetIntensity(Colors)

Returns the Intensity component of the average color in the ROI for a MatchColor function.

GetMatchClrColorByRank(Colors, Rank)

Returns the index of the Color that matches the rank (0 to n-1) for a MatchColor function. The Color with a rank of 0 has the highest score.

GetMatchClrColorState(Colors, ColorName) Returns the state of the specified Color for a MatchColor function.

GetMatchClrDistByIndex(Colors, Index)

Returns the color distance of the indexed Color for a MatchColor function.

GetMatchClrDistByName(Colors, Name)

Returns the color distance of the named Color for a MatchColor function.

GetMatchClrScoreByIndex(Colors, Index)

Returns the score of the indexed Color for a MatchColor function.

GetMatchClrScoreByName(Colors, Name)

Returns the score of the named Color for a MatchColor function.

GetNActiveExtClrModels(Colors)

Returns the number of referenced Color Models that are active in the referenced ExtractColor function.

GetNActiveMatchClrColors(MatchColorLib)

Returns the number of referenced Colors that are active in the referenced MatchColor function.

GetNTrainExtClrModels(ExtractColorLib)

Returns the number of color models stored by the TrainExtractColor function.

GetNTrainMatchClrColors(MatchColorLib)

Returns the number of colors stored by the TrainMatchColor function.

GetOverallPixelCount(Colors)

Returns the pixel count, which is the combination of all active Color Models, for an ExtractColor function.

GetPixelCountByIndex(Colors, Index)

Returns the pixel count for the indexed Color Model in an ExtractColor function.

GetPixelCountByName(Colors, Name)

Returns the pixel count of the named Color Model for an ExtractColor function.

GetRed(Colors)

Returns the Red component of the average color in the ROI for a MatchColor function.

GetSaturation(Colors)

Returns the Saturation component of the average color in the ROI for a MatchColor function.

GetTrainExtClrModelName(ExtractColorLib, Index)

Returns the name of the indexed Color Model for an ExtractColor function.

GetTrainMatchClrColorName(MatchColorLib, Index) Returns the name of the indexed stored Color for a MatchColor function.
SetExtClrColorModelState(Colors, Enable, ColorModelName1, [ColorModelName2,...]) Returns the number of Color Models enabled or disabled for an ExtractColor function. This function’s cell state is disabled when first inserted into the spreadsheet; it must be conditionally enabled by a Button function.
SetMatchClrColorState(Colors, Enable, ColorName1, [ColorName2,...]) Returns the number of Color(s) enabled or disabled for a MatchColor function. This function’s cell state is disabled when first inserted into the spreadsheet; it must be conditionally enabled by a Button function.