VEX IQ C++ API
Classes | Public Member Functions | Public Attributes | List of all members
vex::vision Class Reference

Use this class when programming the vision sensor. More...

Inherits vex::device.

Classes

class  code
 Use this class when programming the vision sensor. More...
 
class  object
 The object class represents an object that the vision sensor detects. More...
 
class  signature
 Use this class when programming the vision sensor. More...
 

Public Member Functions

 vision (int32_t index)
 Creates a new vision object on the port specified. More...
 
 ~vision ()
 
template<typename... Args>
 vision (int32_t index, uint8_t bright, Args... sigs)
 Creates a new vision object on the port specified. Sets the brightness setting and all of the vision objects settings. More...
 
int32_t takeSnapshot (uint32_t id)
 Takes a data sample from the vision sensor. More...
 
int32_t takeSnapshot (code &cc)
 Takes a data sample from the vision sensor. More...
 
int32_t takeSnapshot (signature &sig)
 Takes a data sample from the vision sensor. More...
 
int32_t takeSnapshot (uint32_t id, uint32_t count)
 Takes a data sample from the vision sensor, and only stores the largest samples of the specified amount. More...
 
int32_t takeSnapshot (code &cc, uint32_t count)
 Takes a data sample from the vision sensor, and only stores the largest samples of the specified amount. More...
 
int32_t takeSnapshot (signature &sig, uint32_t count)
 Takes a data sample from the vision sensor, and only stores the largest samples of the specified amount. More...
 
bool setSignature (signature &sig)
 
bool setBrightness (uint8_t value)
 
- Public Member Functions inherited from vex::device
 device (int32_t index)
 
 ~device ()
 

Public Attributes

int32_t objectCount
 The ammount of objects found in the data sample. More...
 
object largestObject
 The largest object found in the data sample. More...
 
safearray< object, VISION_MAX_OBJECTSobjects
 An array containing the largest object(s) found in the data sample. More...
 

Additional Inherited Members

- Protected Attributes inherited from vex::device
int32_t _index
 

Detailed Description

Use this class when programming the vision sensor.

The vision sensor has a resolution of 316x212 pixels

Constructor & Destructor Documentation

◆ vision() [1/2]

vex::vision::vision ( int32_t  index)

Creates a new vision object on the port specified.

Parameters
indexThe port index for this vision. The index is zero-based.

◆ ~vision()

vex::vision::~vision ( )

◆ vision() [2/2]

template<typename... Args>
vex::vision::vision ( int32_t  index,
uint8_t  bright,
Args...  sigs 
)
inline

Creates a new vision object on the port specified. Sets the brightness setting and all of the vision objects settings.

Parameters
indexThe port index for this vision. The index is zero-based.
brightThe vision sensor brightness setting. Values are 0 to 255
sigsList of signature objects used to setup the detection signatures for this sensor.

Member Function Documentation

◆ takeSnapshot() [1/6]

int32_t vex::vision::takeSnapshot ( uint32_t  id)

Takes a data sample from the vision sensor.

Returns
Returns the number of objects found from the ID passed in the parameter.
Parameters
idThe ID of the object to look for.

◆ takeSnapshot() [2/6]

int32_t vex::vision::takeSnapshot ( code cc)

Takes a data sample from the vision sensor.

Returns
Returns the number of objects found from the code signature passed in the parameter.
Parameters
ccThe code signature of the object to look for.

◆ takeSnapshot() [3/6]

int32_t vex::vision::takeSnapshot ( signature sig)

Takes a data sample from the vision sensor.

Returns
Returns a number of objects found from the signature passed in the parameter.
Parameters
sigThe signature of the object to look for.

◆ takeSnapshot() [4/6]

int32_t vex::vision::takeSnapshot ( uint32_t  id,
uint32_t  count 
)

Takes a data sample from the vision sensor, and only stores the largest samples of the specified amount.

Returns
Returns a limited number of objects found from the ID passed in the parameter.
Parameters
idThe ID of the object to look for.
countthe amount of objects to look for. The largest of the object will be returned.

◆ takeSnapshot() [5/6]

int32_t vex::vision::takeSnapshot ( code cc,
uint32_t  count 
)

Takes a data sample from the vision sensor, and only stores the largest samples of the specified amount.

Returns
Returns a limited number of objects found from the code signature passed in the parameter.
Parameters
ccThe code signature of the object to look for.
countthe amount of objects to look for. The largest of the object will be returned.

◆ takeSnapshot() [6/6]

int32_t vex::vision::takeSnapshot ( signature sig,
uint32_t  count 
)

Takes a data sample from the vision sensor, and only stores the largest samples of the specified amount.

Returns
Returns a limited number of objects found from the signature passed in the parameter.
Parameters
sigThe signature of the object to look for.
countthe amount of objects to look for. The largest of the object will be returned.

◆ setSignature()

bool vex::vision::setSignature ( signature sig)

◆ setBrightness()

bool vex::vision::setBrightness ( uint8_t  value)

Member Data Documentation

◆ objectCount

int32_t vex::vision::objectCount

The ammount of objects found in the data sample.

◆ largestObject

object vex::vision::largestObject

The largest object found in the data sample.

◆ objects

safearray< object, VISION_MAX_OBJECTS > vex::vision::objects

An array containing the largest object(s) found in the data sample.