pub struct VisionSignature {
pub u_threshold: (i32, i32, i32),
pub v_threshold: (i32, i32, i32),
pub range: f32,
pub flags: u8,
}devices only.Expand description
A vision detection color signature.
Vision signatures contain information used by the vision sensor to detect objects of a certain
color. These signatures are typically generated through VEX’s vision utility tool rather than
written by hand. For creating signatures using the utility, see from_utility.
§Format & Detection Overview
Vision signatures operate in a version of the Y’UV color space, specifically using the “U” and
“V” chroma components for edge detection purposes. This can be seen in the u_threshold and
v_threshold fields of this struct. These fields place three “threshold” (min, max, mean)
values on the u and v chroma values detected by the sensor. The values are then transformed to a
3D lookup table to detect actual colors.
There is additionally a range field, which works as a scale factor or threshold for how
lenient edge detection should be.
Signatures can additionally be grouped together into VisionCodes, which narrow the filter
for object detection by requiring two colors.
Fields§
§u_threshold: (i32, i32, i32)The (min, max, mean) values on the “U” axis.
This defines a threshold of values for the sensor to match against a certain chroma in the Y’UV color space - specifically on the U component.
v_threshold: (i32, i32, i32)The (min, max, mean) values on the V axis.
This defines a threshold of values for the sensor to match against a certain chroma in the Y’UV color space - specifically on the “V” component.
range: f32The signature range scale factor.
This value effectively serves as a threshold for how lenient the sensor should be when detecting the edges of colors. This value ranges from 0-11 in Vision Utility.
Higher values of range will increase the range of brightness that the sensor will
consider to be part of the signature. Lighter/Darker shades of the signature’s color will
be detected more often.
flags: u8The signature’s flags.
Implementations§
Source§impl VisionSignature
impl VisionSignature
Sourcepub const fn new(
u_threshold: (i32, i32, i32),
v_threshold: (i32, i32, i32),
range: f32,
) -> VisionSignature
pub const fn new( u_threshold: (i32, i32, i32), v_threshold: (i32, i32, i32), range: f32, ) -> VisionSignature
Create a VisionSignature.
§Examples
use vexide::smart::vision::VisionSignature;
let my_signature = VisionSignature::new((10049, 11513, 10781), (-425, 1, -212), 4.1);Sourcepub const fn from_utility(
_id: u8,
u_min: i32,
u_max: i32,
u_mean: i32,
v_min: i32,
v_max: i32,
v_mean: i32,
range: f32,
_signature_type: u32,
) -> VisionSignature
pub const fn from_utility( _id: u8, u_min: i32, u_max: i32, u_mean: i32, v_min: i32, v_max: i32, v_mean: i32, range: f32, _signature_type: u32, ) -> VisionSignature
Create a VisionSignature using the same format as VEX’s Vision Utility tool.
§Examples
use vexide::smart::vision::VisionSignature;
// Register a signature for detecting red objects.
// This numbers in this signature was generated using VEX's vision utility app.
let my_signature = VisionSignature::from_utility(1, 10049, 11513, 10781, -425, 1, -212, 4.1, 0);Trait Implementations§
Source§impl Clone for VisionSignature
impl Clone for VisionSignature
Source§fn clone(&self) -> VisionSignature
fn clone(&self) -> VisionSignature
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for VisionSignature
impl Debug for VisionSignature
Source§impl From<V5_DeviceVisionSignature> for VisionSignature
impl From<V5_DeviceVisionSignature> for VisionSignature
Source§fn from(value: V5_DeviceVisionSignature) -> VisionSignature
fn from(value: V5_DeviceVisionSignature) -> VisionSignature
Source§impl PartialEq for VisionSignature
impl PartialEq for VisionSignature
impl Copy for VisionSignature
impl StructuralPartialEq for VisionSignature
Auto Trait Implementations§
impl Freeze for VisionSignature
impl RefUnwindSafe for VisionSignature
impl Send for VisionSignature
impl Sync for VisionSignature
impl Unpin for VisionSignature
impl UnwindSafe for VisionSignature
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)