ColorMatch

class rev.color.ColorMatch() → None

Bases: pybind11_builtins.pybind11_object

REV Robotics Color Sensor V3.

This class allows access to a REV Robotics color sensor V3 on an I2C bus.

addColorMatch(color: wpilib._wpilib.Color) → None

Add color to match object

Parameters:color – color to add to matching
matchClosestColor(colorToMatch: wpilib._wpilib.Color, confidence: float) → wpilib._wpilib.Color

MatchColor uses euclidean distance to compare a given normalized RGB vector against stored values

Parameters:
  • colorToMatch – color to compare against stored colors
  • confidence – The confidence value for this match, this is simply 1 - euclidean distance of the two color vectors
Returns:

Closest matching color

matchColor(*args, **kwargs)

Overloaded function.

  1. matchColor(self: rev.color._rev_color.ColorMatch, colorToMatch: wpilib._wpilib.Color) -> Optional[wpilib._wpilib.Color]

MatchColor uses euclidean distance to compare a given normalized RGB vector against stored values

Parameters:colorToMatch – color to compare against stored colors
Returns:Matched color if detected
  1. matchColor(self: rev.color._rev_color.ColorMatch, colorToMatch: wpilib._wpilib.Color, confidence: float) -> Optional[wpilib._wpilib.Color]

MatchColor uses euclidean distance to compare a given normalized RGB vector against stored values

Parameters:
  • colorToMatch – color to compare against stored colors
  • confidence – The confidence value for this match, this is simply 1 - euclidean distance of the two color vectors
Returns:

Matched color if detected

setConfidenceThreshold(confidence: float) → None

Set the confidence interval for determining color. Defaults to 0.95

Parameters:confidence – A value between 0 and 1