15-494 Cognitive Robotics
Spring 2007
Course Links:  Main Lectures Labs Homeworks

Tekkotsu Links:   Tutorial Resources Bugs CVS

Cognitive Robotics: Lab 7

Part I: Simple Gestalt Perception

Take 5-6 yellow game pieces and lay them out in a circle. Place 1-2 green game piece inside the circle, and some outside it. Your task is to decide which green pieces are in the circle. Use the camera space for this task.

If you wish to save images to work in the simulator, use the ControllerGUI "Quality Video" script. Close and re-open the raw cam window for the changes to take effect. Save images as .png in YUV format in order to load them from the simulator.

To solve this task, start by extracting ellipses, as you've done before. (Use the MapBuilder for this.) Then form the convex hull of the yellow ellipses, using PolygonData::convexHull. Render the resulting Shape<PolygonData> to produce a sketch of the region enclosed by the yellow pieces. Check each green ellipse to see if it falls within the region. Mark the ones that do, and produce a result sketch indicating which ellipses are marked.

Part II: Non-Convex Boundaries

Convex hull approximates the apparent boundary effect seen in gestalt perception, but only for convex boundaries. Lay out some pink tape in little strips with gaps, forming a dashed line, to construct a concave shape, like this:

The task is to determine which green ellipses lie inside the boundary.

Question 1: What result would convex hull produce in the above case?

Question 2: What principle(s) of gestalt perception does the convex hull algorithm violate when used on a non-convex apparent boundary? Explain your reasoning.

To correctly determine inside/outside relationships in this case you must construct the boundary some other way, without using convex hull. There are various ways you could do this. The best way is to use the line extractor to find pink line segments, and then consider each of the two line endpoints. However, the line extractor may not work well on short, distant lines, so you could use blobs to represent all the little pieces of tape that aren't perceived as lines, and take the centroid of each blob using getCentroid(). Use the minBlobAreas field of your MapBuilderRequest to eliminate any noise. Given this set of line endpoints and blob centroids, the points in appropriate order to traverse the circumference of the crescent. (Hint: start with one point, select the point closest to it, select the point closest to that one, etc., until all points have been selected. But once you've selected one endpoint of a line, your next choice must be the other endpoint.) You can then feed a vector of points (vertices) to the PolygonData constructor to make a polygon. Use visops::fillInterior() on the rendered polygon to solve the inside/outside problem.

Finish this problem for homework if you don't complete it during the regular lab period. Hand in your code, your answers to Questions 1 and 2, and a snapshot of the sketch showing your polygon and results by March 21.

Extra credit: solve the non-convex boundary problem in local space instead of camera space. You will need to use MapBuilderRequest::localMap and set pursueShapes to true. Note: rendering shapes in local or world space requires special tricks we haven't discussed. So instead of using sketches in your solution, solve the problem using PolygonData's isInside() predicate, and present your answer by changing the colors of the inside ellipses from yellow to blue, via setColor().

Dave Touretzky and Ethan Tira-Thompson