Give your robot eyes!  [for CBC  – for Link go here]

Plug a camera into one of the USB ports to give your robot the ability to ‘see‘, either USB port will work.

Touch the vision button and you will be taken to a screen with two main buttons:

  • Tracking (set & check color channels)
  • Camera Parameters (set & check basic settings)

Clicking on the first one will take you to a screen to set how the camera will interpret what it sees, using one or more of the four color-selection channels (ch 0 in the example). (If you don’t like the view, try adjusting Camera Parameters.)

The three buttons on the upper-left Raw, Mat and Trk refer to: camera view, selected pixels, and bobs & centroids.

The four buttons on the upper-right refer to the four channels: 0,1,2,3

The two buttons on the lower-left select which corner of the color-selection rectangle in the color-space you are adjusting. The rectangle selects the channel color in terms of hue, saturation, and value or brightness (HSV)

  • TL – Top Left
  • BR – Bottom Right

The arrows on the right control the selected corner.

The following are the functions that use the camera:

  • track_update() – this causes the CBC to capture the most recent camera frame or analysis.
  • track_count(a) – this provides the number of blobs tracked by channel a (where a can be a number 0-3) – if 0 is returned, there are no blobs.
  • track_x(a,b) – this returns the x coordinate of the centroid of the blob tracked by channel a, and numbered b (blobs are numbered according to their size, 0 is the largest, 1 the next largest, and so on.)
  • track_y(a,b) – Same as track_x except this returns the y coordinate.
  • track_size(a,b) – Same as track_x but provides the number of pixels in the blob

Ok… Umm…

What’s a blob? A centroid?!

Ok – a centroid, simply put, is the center of something. Easy enough eh?

A blob is a collection of pixels that “belong to the same club” and are touching each other. Like football players gathered for a group photo. The “club” would be whether or not the pixels’ colors fall into the range selected to be tracked by the given channel.

The pictures below show what the blobs look like (white highlite) and the little +’s (in green) show the centroids.

Close-up of Blob ‘Trk’ rectangle on right, with centroid.
. (images taken from BB11 – workshop – v1.3 pdf )

Now lets try using the vision system: Use example

  Assignment: object location

NEXT: Decisions… Decisions…


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s