In your NXT-G program, to begin
tracking operation, you should add a block with "Enable
Tracking" operation.
This block should then be followed by a block to 'Get First
Object'.
At this time, from this block you can read the number of
objects being tracked.
If you have more than one objects, subsequently, you can use
'Get n th Object' to get information of 'n'th object.
Note: if 'n' value supplied is larger than number of objects
found, 'Get n th Object' operation will yield invalid data.
In other words, if NXTCam finds 3 objects, Get n th Object
operation for 4th/5th/6th/7th/8th object will yield invalid
data.
When you are done tracking, to conserve power, insert a block
with 'Disable Tracking' Operation.
NXTCam
captures image and analyzes it, and extracts 8 object
from that image which will match the colors specified in
colormap. Before returning the object info to you
(coordinates and color), this command specifies how to
sort them. (they are sorted by area of the object seen).
So first object will be the largest object seen by
NXTCam.
The
objects are sorted by the colors in the colormap. The
objects matching color 1 will be in the beginning of the
object array, followed by color 2 and so-on.
1. Port number to which NXTCam is supposed to be connected.
2. I2C address of this sensor.
3. This plug allows you to select mode of operation, use appropriate numeric value for your mode.
4. Total Tracked Objects : Total number of objects found (you may retrieve these objects using subsequent block with 'Get n th Object' operation).
This value ranges from 0 to 8, 0 indicating no objects found.
When this value is 0, remaining values (X/Y coordinates and color number will not be valid)
5. Color: Color number from the colormap of the current object identified.
6. X Upper Left : The Upper left X coordinate of the objects' bounding box. The X coordinates range between 0 and 144.
7. Y Upper left : The Upper left Y coordinate of the objects' bounding box. The Y coordinates range between 0 and 88.
8. Y Lower right : The Lower right Y coordinate of the objects' bounding box.
9. X Lower right : The Lower right X coordinate of the objects' bounding box.
a. Boolean value for successful tracking. (This indicates any
data errors while reading from NXTCam, if reading is successful
this is TRUE.
A read could fail because sensor is connected to incorrect port,
has different I2C address etc.)
b. Object ID you want to track when your operation is 'Get nth Object'.