ExtractColor
The ExtractColor function, referencing a ExtractColorLib data structure returned by a TrainExtractColor function, determines the number of pixels present in the Region of Interest (ROI) that match the selected trained Color Models in the TrainExtractColor color Library. For more information, see TrainExtractColor. The extracted Color Model corresponds to the Color Model with the highest pixel count.
The ExtractColor function outputs a Colors data structure, which contains the pixel count of the extracted Color Model and an output image that can be referenced by other In-Sight Vision Tools. For more information, see Vision Tools Functions.
ExtractColor Inputs
Syntax: ExtractColor(Image,Fixture.Row,Fixture.Column,Fixture.Theta,Region.X,Region.Y,Region.High,Region.Wide,Region.Angle,Region.Curve,External Region,Extract Color Library,Count Pixels,Output Image,Show)
General Tab
Parameter | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
This argument must reference either a valid color Image data structure output by the AcquireImage function, or a Colors data structure output by another ExtractColor function. By default, the cell referenced is A0, the cell containing the Image data structure returned by AcquireImage. For more information, see 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 Functions. Note: The default setting is (0,0,0), the top leftmost
corner of the image.
|
|||||||||||||
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: In order for a
pixel to be counted, it must be completely enclosed within
the image region; partially enclosed pixels are not included.
|
|||||||||||||
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 TrainExtractColor function that contains the desired color Library and Color Models. Note: This must be a reference to a TrainExtractColor ExtractColorLib data structure. This function cannot reference a MatchColorLib data structure output by a TrainMatchColor function; the ExtractColor function will return #ERR in this condition.
|
|||||||||||||
Specifies if pixel counting is turned on or off. Note: If pixel counting is not required, turn the parameter off to save processing time. If only pixel counting is required, turn this parameter on and set the Output Image parameter to No Image for the fastest processing time and the least impact to memory.
|
|||||||||||||
Indicates the type of image to be output. The output image may be referenced by other In-Sight Vision Tools in the Image parameter. All graphics will be hidden, except when the cell containing the ExtractColor function is the active cell in the spreadsheet.
|
|||||||||||||
Specifies the display mode for ExtractColor graphical overlays on top of the image.
|
Color Models Tab
Specifies the Color Models to be extracted from the referenced TrainExtractColor ExtractColorLib data structure; by default, all of the trained Color Models in the referenced Library are automatically enabled.
ExtractColor Outputs
Returns |
A Colors data structure containing the pixel count and an output image (unless No Image was specified in the Output Image parameter); or #ERR if any of the input parameters are invalid. |
Results |
When ExtractColor is initially inserted into a cell, a result table is created in the spreadsheet. |
ExtractColor 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 Hist.
Index |
GetExtClrModelByRank(Color, Rank) |
The Color Model index by rank. |
Extract Model Color |
GetActiveExtClrModelName(Color, Index) |
The Color Model name by index. |
Pixel Count |
GetPixelCountByIndex(Color, Index) |
The pixel count by index. |
Overall Pixel Count |
GetOverallPixelCount(Color) |
The pixel count for all active Color Models. |