1 / 13

Announcements

Announcements. Choose Research Topic by today Project 1 is due Thursday, October 11 Midterm is Thursday, October 18 Book Review is due Thursday, October 25. Computer Vision in Pyro. Lecture 8. Computer Vision. Computer vision is the name given to the processing of images by a computer.

lona
Download Presentation

Announcements

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Announcements • Choose Research Topic by today • Project 1 is due Thursday, October 11 • Midterm is Thursday, October 18 • Book Review is due Thursday, October 25 CS 484 – Artificial Intelligence

  2. Computer Vision in Pyro Lecture 8

  3. Computer Vision • Computer vision is the name given to the processing of images by a computer. • Very hard problem for computers • One could take a whole course on image processing CS 484 – Artificial Intelligence

  4. Images • Images are stored as a collection of pixels. • Color • Each pixel consists of a red value, a green value and a blue value. • The color values will range from 0 to 255. • Tuple (r, g, b), can be seen as the cube structure • Gray Scale • Pixels are represented by a single number ranging from 0 to 255, where 0 is very black and 255 is very white. CS 484 – Artificial Intelligence

  5. Image Processing • Processing an image for a robot generally falls into 3 steps. • Apply a series of filters • Blobify the image • Groups a set of pixels together • Finds a large block of pixels that touch each other • Then produces a list of bounding boxes around the largest groups • Robot acts on the list of bounding boxes • For example, move toward the largest blob of a specific color in an image. • Blobifying is not the only method to do vision processing with a robot, but it is a very common technique. CS 484 – Artificial Intelligence

  6. Filtering • Filtering changes the overall image • Example: blurring, make changes to all three colors in each pixel. • Pyro filters that look to see if a specific color is in the image, write their results out to only one of the three color channels. • Choose a specific RGB color (180,50,90) • Turns that color into the color of the specified channel (channel 1) • The image after the filter is complete, providing that specific color was found, will be displayed as green spots (green represents channel 1) • These spots represent where the color being filtered for was located throughout the image. CS 484 – Artificial Intelligence

  7. Blobbing • Blobs are areas of an image that meet a particular simple criteria. • For example, a set of blobs can be constructed from a regular image based on color. • The blob interface turns a possibly large image into a list of areas and locations ((x1, y1, x2, y2, area), ...). • This information can be used to move the robot toward the largest blob CS 484 – Artificial Intelligence

  8. Image Processing in Pyro • Each filter applied requires a scan of the image • Image Processing done in C++ because it is faster • Each camera has a different C++ interface CS 484 – Artificial Intelligence

  9. Instructions • Load Robot: Test.py • Load Device: TutorialCamera2 • Make the camera window larger • Tear off "View" menu in Camera Window • Adjust the speeds and watch • Pause the image when you have a good view of Dino • Tear off "Filter" menu in Camera Window CS 484 – Artificial Intelligence

  10. Continue Instructions • Right click on part of the Dino image • Turns part of Dino red • Applies a "match" filter to that color • If you don't like the amount of red, you can try again • Clear Filters and try again • Add filter Supercolor – Red • This will turn the rest of the image black • Add filter Blobify – Red • Draws a box around the largest blob • Press Play • See what happens • Does the box stay on Dino? CS 484 – Artificial Intelligence

  11. Continue Instructions • If you don't like the results • Clear all filters and try again • If you like it • Select "List Filters" • This will print the code required to create the filters in a brain • Press the robot view button • Select camera devices -> camera[0] • Scroll down to filterResults • Right click on filterResults and select watch • The last number is the number of pixels in the bounding box CS 484 – Artificial Intelligence

  12. Vision in Brains from pyrobot.brain import Brain def process(camera): camera.apply('match', 158 , 71 , 48 , ) camera.apply('match', 225 , 129 , 89 , ) camera.apply('match', 188 , 109 , 68 , ) camera.apply("superColor", 1, -1, -1, 0) # rgb # weights, 0 = red channel camera.apply("threshold", 0, 50) # red channel, # 50 > 0 return camera.apply("blobify", 0) # red channel # filters return values in # robot.camera[0].filterResults CS 484 – Artificial Intelligence

  13. Vision in Brains class VisionBrain(Brain): def setup(self): # get a camera that is already running: self.camera = self.robot.camera[0] # add a function to the filter list: self.camera.addFilter( process ) def step(self): # do something with the camera processed # data: print self.camera.filterResults def INIT(engine): return VisionBrain('SimpleBrain', engine) CS 484 – Artificial Intelligence

More Related