Visión de IA#
Introducción#
El sensor de visión con IA permite a los robots detectar y rastrear información visual de su entorno. Al identificar objetos, colores y patrones, el sensor de visión con IA permite a los robots analizar su entorno y responder a lo que ven.
For the examples below, the configured AI Vision Sensor will be named AIVision1
, and the configured Color Signature objects, such as redBox
, will be used in all subsequent examples throughout this API documentation when referring to aivision
class methods.
A continuación se muestra una lista de todos los métodos:
Conseguidores
takeSnapshot – Captura datos para una firma de color o un código de color específico.
objectCount – Devuelve la cantidad de objetos detectados como un entero.
largestObject – Selecciona inmediatamente el objeto más grande de la instantánea.
instalado – Si el sensor de visión de IA está conectado al V5 Brain.
Propiedades – Datos del objeto devueltos desde takeSnapshot.
.exists – Si el objeto existe en la detección actual como un valor booleano.
.width – Ancho del objeto detectado en píxeles.
.height – Altura del objeto detectado en píxeles.
.centerX – Posición X del centro del objeto en píxeles.
.centerY – Posición Y del centro del objeto en píxeles.
.angle – Orientación del código de color en grados.
.originX – Posición X de la esquina superior izquierda del objeto en píxeles.
.originY – Posición Y de la esquina superior izquierda del objeto en píxeles.
.id – Clasificación o ID de etiqueta del objeto.
.score – Puntuación de confianza para las clasificaciones de IA (1–100).
Constructores: inicializan y configuran manualmente los sensores.
aivision – Crea un sensor de visión de IA.
aivision::colordesc – Crea una firma de color.
aivision::codedesc – Crea un código de color.
Tomar instantánea#
takeSnapshot
captures an image from the AI Vision Sensor, processes it based on the signature, and updates the objects
array. This method can also limit the amount of objects captured in the snapshot.
Las Firmas de color y los Códigos de color deben configurarse primero en la Utilidad de visión antes de poder usarse con este método.
The objects
array stores objects ordered from largest to smallest by width, starting at index 0. Each object’s properties can be accessed using its index. objects
is an empty array if no matching objects are detected.
Default Usage:
AIVision1.takeSnapshot(signature)
Overloads:
AIVision1.takeSnapshot(signature, count)
Parámetros |
Descripción |
---|---|
|
What signature to get data of.
|
|
Opcional. Establece el número máximo de objetos que se pueden devolver, de 1 a 24 (valor predeterminado: 8). |
// Example coming soon
AI Classifications#
El sensor de visión de IA puede detectar diferentes objetos bajo ciertas clasificaciones de IA. Según el modelo de clasificación de IA seleccionado al configurar el sensor en la ventana Dispositivos, se pueden detectar diferentes objetos. Los modelos disponibles actualmente son:
Elementos del aula
| ID Number | AI Classification |
| 0 | blueBall
|
| 1 | greenBall
|
| 2 | redBall
|
| 3 | blueRing
|
| 4 | greenRing
|
| 5 | redRing
|
| 6 | blueCube
|
| 7 | greenCube
|
| 8 | redCube
|
V5RC de alto riesgo
|:——————:|–|
| ID Number | AI Classification |
| 0 | mobileGoal
|
| 1 | redRing
|
| 2 | blueRing
|
V5RC Empuje hacia atrás
|:——————:|–|
| ID Number | AI Classification |
| 0 | blueBlock
|
| 1 | redBlock
|
// Example coming soon
Color Signatures#
Una Firma de Color es un color único que el Sensor de Visión de IA puede reconocer. Estas firmas permiten al Sensor de Visión de IA detectar y rastrear objetos según su color. Una vez configurada una Firma de Color, el sensor puede identificar objetos con ese color específico en su campo de visión. Las firmas de color se utilizan con takeSnapshot para procesar y detectar objetos de color en tiempo real.
In order to use a configured Color Signature in a project, its name must be the name of the sensor, two underscores, and then the Color Signature’s name. For example: AIVision1__redBox
.
// Example coming soon
Color Codes#
Un código de color es un patrón estructurado compuesto por firmas de color dispuestas en un orden específico. Estos códigos permiten al sensor de visión reconocer patrones de color predefinidos. Los códigos de color son útiles para identificar objetos complejos o crear marcadores únicos para la navegación autónoma.
To use a configured Color Code in a project, its name must be passed as a string in the format: the Vision Sensor’s name, followed by two underscores, and then the Color Code’s name. For example: AIVision1__redBlue
.
// Example coming soon
objectCount#
objectCount
returns the number of items inside the objects
array as an integer.
Default Usage:
AIVision1.objectCount
Parámetros |
Descripción |
---|---|
Este método no tiene parámetros. |
// Example coming soon
objeto más grande#
largestObject
retrieves the largest detected object from the objects
array.
This method can be used to always get the largest object from objects
without specifying an index.
Default Usage:
AIVision1.largestObject
Parámetros |
Descripción |
---|---|
Este método no tiene parámetros. |
// Example coming soon
instalado#
installed
returns an integer indicating whether the AI Vision Sensor is currently connected to the V5 Brain.
1
– The AI Vision Sensor is connected to the V5 Brain.0
– The AI Vision Sensor is not connected to the V5 Brain.
Parámetros |
Descripción |
---|---|
Este método no tiene parámetros. |
int main() {
// Initializing Robot Configuration. DO NOT REMOVE!
vexcodeInit();
// Display a message if the AI Vision Sensor is detected
if (AIVision1.installed()){
Brain.Screen.print("Installed!");
}
}
objetos#
objects
returns an array of detected object properties. Use the array to access specific property values of individual objects.
Default Usage:
AIVision1.objects
Properties#
There are ten properties that are included with each object stored in the objects
array after takeSnapshot
is used.
Some property values are based off of the detected object’s position in the Vision Sensor’s view at the time that takeSnapshot
was used. The AI Vision Sensor has a resolution of 320 by 240 pixels.
.existe#
.exists
returns an integer indicating if the index exists in the objects
array or not.
1
: The index exists.0
: The index does not exist.
// Example coming soon
.ancho#
.width
returns the width of the detected object in pixels, which is an integer between 1 and 320.
// Example coming soon
.altura#
.height
returns the height of the detected object in pixels, which is an integer between 1 and 240.
// Example coming soon
.centroX#
.centerX
returns the x-coordinate of the detected object’s center in pixels, which is an integer between 0 and 320.
// Example coming soon
.centerY#
.centerY
returns the y-coordinate of the detected object’s center in pixels, which is an integer between 0 and 240.
// Example coming soon
.ángulo#
.angle
returns the orientation of the detected Color Code or AprilTag in degrees, which is a double between 0 and 360.
// Example coming soon
.origenX#
.originX
returns the x-coordinate of the top-left corner of the detected object’s bounding box in pixels, which is an integer between 0 and 320.
// Example coming soon
.origenY#
.originY
returns the y-coordinate of the top-left corner of the detected object’s bounding box in pixels, which is an integer between 0 and 240.
// Example coming soon
.identificación#
.id
returns the ID of the detected AI Classification or AprilTag as an integer.
Para las clasificaciones de IA, consulte las tablas Clasificación de IA para obtener los ID correspondientes.
Para un AprilTag, la propiedad .id representa el número de identificación del AprilTag detectado en el rango de 0 a 36. Para una clasificación de IA, el id corresponde al id predefinido como se muestra a continuación.
// Example coming soon
.puntaje#
.score
returns the confidence score of the detected AI Classification as an integer between 1 and 100.
// Example coming soon
Constructores#
Constructors are used to manually create aivision
, colordesc
, and codedesc
objects, which are necessary for configuring the AI Vision Sensor outside of VEXcode. If fewer arguments are provided, default arguments or function overloading should be used in the constructor definition.
AI Vision Sensor#
aivision
creates an AI Vision Sensor.
Default Usage:
aivision( int32_t index, uint8_t bright, Args &… sigs )
Parámetros |
Descripción |
---|---|
|
A qué puerto inteligente está conectado el sensor de visión IA, del 1 al 12. |
|
Optional. The name of one or more signatures:
|
// Example coming soon
Color Signature#
colordesc
creates a Color Signature. Up to seven different Color Signatures can be stored on an AI Vision Sensor at once.
Default Usage:
colordesc(index, uMin, uMax, uMean, vMin, vMax, vMean, rgb, type)
Parámetro |
Descripción |
---|---|
|
The |
|
The value from |
|
The value from |
|
The value from |
|
The value from |
|
The value from |
|
The value from |
|
The value from |
|
The value from |
Para obtener los valores necesarios para crear una Firma de Color, acceda a la Utilidad de Visión. Una vez configurada la Firma de Color, copie los valores de los parámetros desde la ventana de Configuración.
// Example coming soon
Color Code#
codedesc
creates a Color Code. It requires at least two already defined Color Signatures in order to be used. Up to eight different Color Codes can be stored on an AI Vision Sensor at once.
Default Usage:
codedesc(sig1, sig2)
Sobrecargas:
codedesc(sig1, sig2, sig3)
codedesc(sig1, sig2, sig3, sig4)
codedesc(sig1, sig2, sig3, sig4, sig5)
Parámetros |
Descripción |
---|---|
|
A previously created |
|
A previously created |
|
A previously created |
|
A previously created |
|
A previously created |
// Example coming soon