CMU 15494 Cognitive Robotics - Shape Representations

Unformatted text preview:

Slide 1Slide 2Slide 3Slide 4Slide 5Slide 6Slide 7Slide 8Slide 9Slide 10Slide 11Slide 12Slide 13Slide 14Slide 15Slide 16Slide 17Slide 18Slide 19Slide 20Slide 21Slide 22Slide 23Slide 24Slide 25Slide 26Slide 27Slide 28Slide 29Slide 30Slide 3101/27/10 15-494 Cognitive Robotics 1Shape Representations15-494 Cognitive RoboticsDavid S. Touretzky &Ethan Tira-ThompsonCarnegie MellonSpring 201001/27/10 15-494 Cognitive Robotics 2Types of Shapes●Basic:–PointData, LineData, EllipseData●Complex:–PolygonData, BlobData, MarkerData●3-D:–SphereData, BrickData●Robot shape:–AgentData01/27/10 15-494 Cognitive Robotics 3Shapes Live in a ShapeSpace●SketchSpace and ShapeSpace are duals:●We'll be using camSkS and camShS: the camera spaces.SketchSpace ShapeSpaceRenderingExtraction01/27/10 15-494 Cognitive Robotics 4SHAPEVEC and SHAPEROOTVEC●Often we want to work with collections of shapes.●A “SHAPEVEC” is a vector of shapes of a specific type: std::vector<Shape<BlobData> >●A “SHAPEROOTVEC” is a vector of genericshapes, useful when we mix shapes of different types: std::vector<ShapeRoot>●There are macros for creating and iterating over these vectors:–NEW_SHAPEVEC, NEW_SHAPEROOTVEC–SHAPEVEC_ITERATE, SHAPEROOTVEC_ITERATEThis space is required01/27/10 15-494 Cognitive Robotics 5Vectors of Shapes#nodeclass ShapeExample : VisualRoutinesStateNode : DoStart NEW_SKETCH(camFrame, uchar, sketchFromSeg()); NEW_SHAPEVEC(blob_shapes, BlobData, BlobData::extractBlobs(camFrame,100)); if ( blob_shapes.size() > 0 ) { NEW_SKETCH(blob0, bool, blob_shapes[0]->getRendering()); } SHAPEVEC_ITERATE(blob_shapes, BlobData, myblob) cout << "Id: " << myblob->getId() << " Color: " << myblob->getColor() << " Area: " << myblob->getArea() << endl; END_ITERATE;#endnodeclass01/27/10 15-494 Cognitive Robotics 6Some Orange and Yellow Blobs01/27/10 15-494 Cognitive Robotics 7Extracted Blob ShapesInverted:right clickId: 10001 Color: [253,119,15] Area: 2351Id: 10002 Color: [253,119,15] Area: 1256Id: 10003 Color: [193,177,9] Area: 1378Id: 10004 Color: [193,177,9] Area: 1065Id: 10005 Color: [193,177,9] Area: 70501/27/10 15-494 Cognitive Robotics 8Line Shapes●A line has two endpoints, which can be–Valid or invalid (e.g., line runs out of the camera frame)–Active or inactiveIf both endpoints are inactive, line extends to infinity.●Lines have several derived properties that are maintained automatically:–Length–Orientation (0 to )–Normal vector )linenormalvector01/27/10 15-494 Cognitive Robotics 9Extracting the Lines#nodeclass LineExample : VisualRoutinesStateNode : DoStart NEW_SKETCH(camFrame, uchar, sketchFromSeg()); NEW_SKETCH(pink_stuff, bool, visops::colormask(camFrame,"pink")); NEW_SHAPEVEC(lines, LineData, LineData::extractLines(pink_stuff));#endnodeclass01/27/10 15-494 Cognitive Robotics 10Extracted Line Shapes●“Select All Shapes” displays everything.●“ID” checkbox displays shape IDs.01/27/10 15-494 Cognitive Robotics 11Line EndPoints●Lines have two endpoints: end1Pt and end2Pt●Order is arbitrary●Extracting endpoints:–end1Pt(), end2Pt() -- simple accessor functions–leftPt(), rightPt() –- compare X coords.–topPt(), bottomPt() –- compare Y coords.●Orientation predicates:–IsHorizontal –- true if slope is < 60 degrees–IsVertical –- true if slope is > 30 degrees–These thresholds are user-adjustable01/27/10 15-494 Cognitive Robotics 12Extracting the Leftmost Point#nodeclass LineExample : VisualRoutinesStateNode : DoStart NEW_SKETCH(camFrame, uchar, sketchFromSeg()); NEW_SKETCH(orange_stuff, bool, visops::colormask(camFrame,"orange")); NEW_SHAPE(line, LineData, LineData::extractLine(orange_stuff)); NEW_SHAPE(leftpt, PointData, line->leftPtShape()); leftpt->setColor(rgb(0,255,0));#endnodeclass01/27/10 15-494 Cognitive Robotics 13Extracted Point Shape●leftpt's parent is line●line's parent is orange_stuff: a shapewhose parent is a sketch01/27/10 15-494 Cognitive Robotics 14Logical EndPoint Descriptions●firstPt() –- if line is horizontal, returns leftPt(), else returns topPt()●secondPt() –- similar: returns rightPt() or bottomPt()●How do we compare two lines? Example:–Two lines are “close” if their first endpoints are close,and their second endpoints are also close.–But what about lines whose orientationsstraddle the critical horizontal/verticalthreshold of 60 degrees?●line1->firstPt(line2) –- returns first point of line2 based on line1's decision about horizontal/verticalfirst=leftfirst=top01/27/10 15-494 Cognitive Robotics 15Constructing New Lines●Use a LineData(camShS, ...) constructor to make new lines in camera space.●Since we want to use smart pointers for shapes, the result should be fed to a Shape<LineData> constructor.–The NEW_SHAPE macro does this for us:NEW_SHAPE(myline, LineData, new LineData(camShS, ...));●Can define a new line by specifying:–two points–a point plus an orientation (0 to )01/27/10 15-494 Cognitive Robotics 16NEW_SHAPE●NEW_SHAPE is a bit of syntactic sugar: NEW_SHAPE(myline, LineData, new LineData(camShS,pt1,pt2))●Expands into: Shape<LineData> myline(new LineData(camShS,pt1,pt2));if ( myline.isValid() ) myline->V(“myline”); // make viewable●Use NEW_SHAPE_N for shapes not to be viewable.01/27/10 15-494 Cognitive Robotics 17Parents and Viewable IDsfoo id: 11 parentId: 0bar id: 17 parentId: 11baz id: 19 parentId: 17xam id: 23 parentId: 19foo 11xam 23On the Robot SketchGUIDisplayNotviewable01/27/10 15-494 Cognitive Robotics 18Mixing Sketches and Shapes●Problem: which side of an orange line has more yellow blobs?●If all we have is a line segment, people can still interpret it as a “barrier”.●How do we make the robot do this?01/27/10 15-494 Cognitive Robotics 19Lines as Barriers#nodeclass LineExample : VisualRoutinesStateNode : DoStart NEW_SKETCH(camFrame, uchar, sketchFromSeg()); NEW_SKETCH(orange_stuff, bool, visops::colormask(camFrame,"orange")); NEW_SKETCH(yellow_stuff, bool, visops::colormask(camFrame,"yellow")); NEW_SHAPE(boundary_line, LineData, LineData::extractLine(orange_stuff)); NEW_SKETCH(topside, bool, visops::topHalfPlane(boundary_line)); NEW_SKETCH(side1, bool, yellow_stuff & topside); NEW_SKETCH(side2, bool, yellow_stuff & ! topside);01/27/10 15-494 Cognitive Robotics 20Lines as Barriers (cont.) NEW_SHAPEVEC(side1blobs, BlobData,


View Full Document

CMU 15494 Cognitive Robotics - Shape Representations

Download Shape Representations
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Shape Representations and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Shape Representations 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?