ExtractColorHistogram
Extracts a color histogram array from an image region. For more information, see Histogram.
ExtractColorHistogram Overview
ExtractColorHistogram accesses every whole pixel in an image region to accumulate a color histogram. Each color pixel is composed of three separate color components; these components are represented as combinations of either red, green and blue (RGB) and/or hue, saturation and intensity (HSI). For more information, see Color Components of a Pixel. For both RGB and HSI, each component of a pixel is converted to a value from 0 to 255; therefore, the accumulated histogram will contain 256 elements for each color component, where each element contains a value representing the count of the number of pixels with values equal to the index number of the array element.
ExtractColorHistogram Inputs
Syntax: ExtractColorHistogram(Image,Fixture.Row,Fixture.Column,Fixture.Theta,Region.X,Region.Y,Region.High,Region.Wide,Region.Angle,Region.Curve,ColorMode,Show)
- In order for a pixel to be counted in the histogram, 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 | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
This argument must reference a spreadsheet cell that contains a valid color Image data structure. By default, the cell referenced is A0, the cell containing the Image data structure returned by AcquireImage. For more information, see AcquireImage. Note: AcquireImage is the only function that returns a
valid color Image data
structure.
|
|||||||||||||
|
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.
|
|||||||||||||
Specifies the type of color representation to calculate and display within the histogram. Note: The HSI values returned by the ExtractColorHistogram function may differ from the HSI values returned by the MatchColor and TrainMatchColor functions. The MatchColor and TrainMatchColor functions average the pixels before HSI processing while the ExtractColorHistogram function averages the pixels after HSI processing; the divergence will increase with the color randomness found in the image.
|
|||||||||||||
Specifies the display mode for ExtractColorHistogram graphical overlays on top of the image.
|
ExtractColorHistogram Outputs
Returns |
A ColorHist data structure containing the RGB and/or HSI frequency distribution, or #ERR if any of the input parameters are invalid. |
Results |
When ExtractColorHistogram is initially inserted into a cell, a result table is created in the spreadsheet. |
ExtractColorHistogram 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 or ColorHist.
Red |
HistMean(ColorHist, 0, 255, 0) |
The mean red channel value. |
Green |
HistMean(ColorHist, 0, 255, 1) |
The mean green channel value. |
Blue |
HistMean(ColorHist, 0, 255, 2) |
The mean blue channel value. |
Hue |
HistMean(ColorHist, 0, 255, 3) |
The mean hue level value. |
Saturation |
HistMean(ColorHist, 0, 255, 4) |
The mean saturation level value. |
Intensity |
HistMean(ColorHist, 0, 255, 5) |
The mean intensity level value. |