WebbotLib AVR library
WebbotLib It just does it
  C++ documentation  C documentation

getBlobs

Return the number of blobs which match the specified colour bin (or all colour bins).
This will ask the camera to return the matching blob areas which match the specified colour bin. The colour bin can either by any individual bin or can be the 'magic' value of CAMERA_ALL_BINS to mean ANY camera bin.
The value returned is the number of matching blobs. This can be used along with fetchBlob to iterate through the list of blobs.
Syntax
Camera. getBlobs(bin)
Where Camera is the name you have given to the device in Project Designer.
Parameters
TypeNameDescription
'bin'
The colour bin in the range 0 to number of bins - 1.
Returns
uint8_t
Note
The list returned is always sorted into descending rectangle size - so the biggest rectangle is always at the top of the list.
Example
uint8_t blobs = camera.getBlobs( CAMERA_ALL_BINS);
if(blobs == 0){
    // No blobs are visible
}else{
    for(uint8_t b = 0; b<blobs; b++){
        // Fetch the blobs - the biggest first
        Blob blob;
        camera.fetchBlob(b, blob);
 
        // See Cameras/_camera_common.h to see the fields in a CAMERA_BLOB
        // But in summary these include the left, right, top and bottom of
        // the rectangle. The x,y position of the center of the blob relative
        // to the center of the screen. The total size of the blob and the
        // the colour bin.
        cout << "Center=" << blob.xCenter << ',' << blob.yCenter;
        cout << " Size=" << blob.pixels;
    }
}
See Also
setMinBlobSize

 

 

Valid XHTML 1.0 Transitional