Class ColorFrame
Implements an object-holding Frame with considerations for color data.
This avoids creation of new objects by only converting to a
ColorData when such an object is requested,
while also offering interfaces to efficiently retrieve components and HSV calculations without allocation.-
Nested Class Summary
Nested classes/interfaces inherited from class com.reduxrobotics.frames.Frame
Frame.FrameCallback<FC> -
Constructor Summary
ConstructorsConstructorDescriptionColorFrame(double timestamp, ColorData defaultData) Instantiates a new ColorFrame -
Method Summary
Modifier and TypeMethodDescriptionvoidFlag that this frame's data is not valid.doublegetBlue()Retreives the frame's stored blue value [0..1] inclusive.Retrieves the frame's stored color period.doublegetGreen()Retreives the frame's stored green value [0..1] inclusive.doubleComputes the frame's HSV hue value [0..1] inclusive from the stored RGB data.doubleComputes the frame's HSV saturation value [0..1] inclusive from the stored RGB data.doubleComputes the frame's HSV value [0..1] inclusive from the stored RGB data.doublegetRed()Retreives the frame's stored red value [0..1] inclusive.getValue()Returns the value of the data frame.booleanhasData()Returns if this frame has data.voidupdateData(long data, double timestamp) Update the Frame with new data.Methods inherited from class com.reduxrobotics.frames.Frame
addCallback, getFrameData, getTimestamp, maxTimestamp, removeCallback, update, waitForFrames
-
Constructor Details
-
ColorFrame
Instantiates a new ColorFrame- Parameters:
timestamp- initial timestampdefaultData- data to be returned when the frame value is not valid
-
-
Method Details
-
getValue
Description copied from class:FrameReturns the value of the data frame. -
getRed
public double getRed()Retreives the frame's stored red value [0..1] inclusive.- Returns:
- red intensity
-
getGreen
public double getGreen()Retreives the frame's stored green value [0..1] inclusive.- Returns:
- green intensity
-
getBlue
public double getBlue()Retreives the frame's stored blue value [0..1] inclusive.- Returns:
- blue intensity
-
getHSVHue
public double getHSVHue()Computes the frame's HSV hue value [0..1] inclusive from the stored RGB data. This function does not allocate objects!- Returns:
- hue
-
getHSVSaturation
public double getHSVSaturation()Computes the frame's HSV saturation value [0..1] inclusive from the stored RGB data. This function does not allocate objects!- Returns:
- saturation
-
getHSVValue
public double getHSVValue()Computes the frame's HSV value [0..1] inclusive from the stored RGB data. This function does not allocate objects!- Returns:
- value
-
getColorPeriod
Retrieves the frame's stored color period.- Returns:
- color period
-
hasData
public boolean hasData()Description copied from class:FrameReturns if this frame has data. -
clearData
public void clearData()Flag that this frame's data is not valid. -
updateData
public void updateData(long data, double timestamp) Update the Frame with new data.- Parameters:
data- the new data to update withtimestamp- the timestamp at which it occured
-