COMP 50: Autonomous Intelligent Robotics · In 1966, Marvin Minsky at MIT asked his undergraduate...

55
COMP 50: Autonomous Intelligent Robotics Instructor: Jivko Sinapov http://www.cs.tufts.edu/comp/50AIR/

Transcript of COMP 50: Autonomous Intelligent Robotics · In 1966, Marvin Minsky at MIT asked his undergraduate...

Page 1: COMP 50: Autonomous Intelligent Robotics · In 1966, Marvin Minsky at MIT asked his undergraduate student Gerald Jay Sussman to “spend the summer linking a camera to a computer

COMP 50: Autonomous Intelligent Robotics

Instructor: Jivko Sinapovhttp://www.cs.tufts.edu/comp/50AIR/

Page 2: COMP 50: Autonomous Intelligent Robotics · In 1966, Marvin Minsky at MIT asked his undergraduate student Gerald Jay Sussman to “spend the summer linking a camera to a computer

Computer Vision: 2D Images

Page 3: COMP 50: Autonomous Intelligent Robotics · In 1966, Marvin Minsky at MIT asked his undergraduate student Gerald Jay Sussman to “spend the summer linking a camera to a computer

Semester Schedule

Learning Robot Operating System (ROS)

Learning to use our robotsComputational Perception

Developmental Robotics

Human-Robot Interaction

You are here

Time

Page 4: COMP 50: Autonomous Intelligent Robotics · In 1966, Marvin Minsky at MIT asked his undergraduate student Gerald Jay Sussman to “spend the summer linking a camera to a computer

Announcements

• Homework 5 is due Friday 3/9

Page 5: COMP 50: Autonomous Intelligent Robotics · In 1966, Marvin Minsky at MIT asked his undergraduate student Gerald Jay Sussman to “spend the summer linking a camera to a computer

Announcements

Page 6: COMP 50: Autonomous Intelligent Robotics · In 1966, Marvin Minsky at MIT asked his undergraduate student Gerald Jay Sussman to “spend the summer linking a camera to a computer

Reading for this week

• J. K. O'Regan and A. Noe, (2001). “A sensorimotor account of vision and visual consciousness”, Behavioral and Brain Sciences, 24(5), 939- 1011.

• Chapter 6, “Exploration, navigation, and localization” of Introduction to Autonomous Robots

Page 7: COMP 50: Autonomous Intelligent Robotics · In 1966, Marvin Minsky at MIT asked his undergraduate student Gerald Jay Sussman to “spend the summer linking a camera to a computer

Project Proposal Write-ups

• Due Friday, March 16

• Length: 4 to 5 pages

• Sections: Introduction, Related Work, Problem Formulation / Technical Approach, Evaluation Plan / Criteria for Success

• Format: default Google doc style or default overleaf.com LaTeX template

Page 8: COMP 50: Autonomous Intelligent Robotics · In 1966, Marvin Minsky at MIT asked his undergraduate student Gerald Jay Sussman to “spend the summer linking a camera to a computer

Computer Vision: 2D Images

Page 9: COMP 50: Autonomous Intelligent Robotics · In 1966, Marvin Minsky at MIT asked his undergraduate student Gerald Jay Sussman to “spend the summer linking a camera to a computer

Some material adapted from:

• Jain, Kasturi, and Schunck (1995). Machine Vision, “Chapter 1: Introduction,'' McGraw-Hill, pp. 1-24. and “Chapter 2: Binary Image Processing”

• Links are posted on the class website

Page 10: COMP 50: Autonomous Intelligent Robotics · In 1966, Marvin Minsky at MIT asked his undergraduate student Gerald Jay Sussman to “spend the summer linking a camera to a computer

What is an image?

Page 11: COMP 50: Autonomous Intelligent Robotics · In 1966, Marvin Minsky at MIT asked his undergraduate student Gerald Jay Sussman to “spend the summer linking a camera to a computer

A grayscale image

Page 12: COMP 50: Autonomous Intelligent Robotics · In 1966, Marvin Minsky at MIT asked his undergraduate student Gerald Jay Sussman to “spend the summer linking a camera to a computer

An RGB image

Page 13: COMP 50: Autonomous Intelligent Robotics · In 1966, Marvin Minsky at MIT asked his undergraduate student Gerald Jay Sussman to “spend the summer linking a camera to a computer

How did computer vision start?

In 1966, Marvin Minsky at MIT asked his undergraduate student Gerald Jay Sussman to “spend the summer linking a camera to acomputer and getting the computer to describe what it saw”. We now know that the problem is slightly more difficult than that!

Page 14: COMP 50: Autonomous Intelligent Robotics · In 1966, Marvin Minsky at MIT asked his undergraduate student Gerald Jay Sussman to “spend the summer linking a camera to a computer

Computer vision vs human vision

What we see What a computer sees

Page 15: COMP 50: Autonomous Intelligent Robotics · In 1966, Marvin Minsky at MIT asked his undergraduate student Gerald Jay Sussman to “spend the summer linking a camera to a computer

Intensity Levels

• 2• 32• 64• 128• 256 (8 bits)• 512• …• 4096 (12 bits)

Page 16: COMP 50: Autonomous Intelligent Robotics · In 1966, Marvin Minsky at MIT asked his undergraduate student Gerald Jay Sussman to “spend the summer linking a camera to a computer

Intensity Levels

• 2• 32• 64• 128• 256 (8 bits)• 512• …• 4096 (12 bits)

Page 17: COMP 50: Autonomous Intelligent Robotics · In 1966, Marvin Minsky at MIT asked his undergraduate student Gerald Jay Sussman to “spend the summer linking a camera to a computer

Image Plane v.s. Image Array

[Jain, Kasturi, and Schunck (1995). Machine Vision, Ch. 1]

Page 18: COMP 50: Autonomous Intelligent Robotics · In 1966, Marvin Minsky at MIT asked his undergraduate student Gerald Jay Sussman to “spend the summer linking a camera to a computer

Point Operations

[Jain, Kasturi, and Schunck (1995). Machine Vision, Ch. 1]

Page 19: COMP 50: Autonomous Intelligent Robotics · In 1966, Marvin Minsky at MIT asked his undergraduate student Gerald Jay Sussman to “spend the summer linking a camera to a computer

Local Operations

[Jain, Kasturi, and Schunck (1995). Machine Vision, Ch. 1]

Page 20: COMP 50: Autonomous Intelligent Robotics · In 1966, Marvin Minsky at MIT asked his undergraduate student Gerald Jay Sussman to “spend the summer linking a camera to a computer

Global Operations

[Jain, Kasturi, and Schunck (1995). Machine Vision, Ch. 1]

Page 21: COMP 50: Autonomous Intelligent Robotics · In 1966, Marvin Minsky at MIT asked his undergraduate student Gerald Jay Sussman to “spend the summer linking a camera to a computer

Thresholding an Image

[Jain, Kasturi, and Schunck (1995). Machine Vision, Ch. 1]

Page 22: COMP 50: Autonomous Intelligent Robotics · In 1966, Marvin Minsky at MIT asked his undergraduate student Gerald Jay Sussman to “spend the summer linking a camera to a computer

Dark Image on a Light Background

[Jain, Kasturi, and Schunck (1995). Machine Vision, Ch. 2]

Page 23: COMP 50: Autonomous Intelligent Robotics · In 1966, Marvin Minsky at MIT asked his undergraduate student Gerald Jay Sussman to “spend the summer linking a camera to a computer

Selecting a range of intensity values

[Jain, Kasturi, and Schunck (1995). Machine Vision, Ch. 2]

Page 24: COMP 50: Autonomous Intelligent Robotics · In 1966, Marvin Minsky at MIT asked his undergraduate student Gerald Jay Sussman to “spend the summer linking a camera to a computer

Generalized Thresholding

[Jain, Kasturi, and Schunck (1995). Machine Vision, Ch. 2]

Page 25: COMP 50: Autonomous Intelligent Robotics · In 1966, Marvin Minsky at MIT asked his undergraduate student Gerald Jay Sussman to “spend the summer linking a camera to a computer

Thresholding Example (1)

[Jain, Kasturi, and Schunck (1995). Machine Vision, Ch. 2]

Page 26: COMP 50: Autonomous Intelligent Robotics · In 1966, Marvin Minsky at MIT asked his undergraduate student Gerald Jay Sussman to “spend the summer linking a camera to a computer

Thresholding Example (2)

Original grayscale Image

[Jain, Kasturi, and Schunck (1995). Machine Vision, Ch. 2]

Page 27: COMP 50: Autonomous Intelligent Robotics · In 1966, Marvin Minsky at MIT asked his undergraduate student Gerald Jay Sussman to “spend the summer linking a camera to a computer

[Jain, Kasturi, and Schunck (1995). Machine Vision, Ch. 2]

Page 28: COMP 50: Autonomous Intelligent Robotics · In 1966, Marvin Minsky at MIT asked his undergraduate student Gerald Jay Sussman to “spend the summer linking a camera to a computer

[Jain, Kasturi, and Schunck (1995). Machine Vision, Ch. 2]

Page 29: COMP 50: Autonomous Intelligent Robotics · In 1966, Marvin Minsky at MIT asked his undergraduate student Gerald Jay Sussman to “spend the summer linking a camera to a computer

Area of a Binary Image

[Jain, Kasturi, and Schunck (1995). Machine Vision, Ch. 2]

Page 30: COMP 50: Autonomous Intelligent Robotics · In 1966, Marvin Minsky at MIT asked his undergraduate student Gerald Jay Sussman to “spend the summer linking a camera to a computer

This figure now becomes important

[Jain, Kasturi, and Schunck (1995). Machine Vision, Ch. 1]

Page 31: COMP 50: Autonomous Intelligent Robotics · In 1966, Marvin Minsky at MIT asked his undergraduate student Gerald Jay Sussman to “spend the summer linking a camera to a computer

Calculating the Position of an Object

[Jain, Kasturi, and Schunck (1995). Machine Vision, Ch. 2]

Page 32: COMP 50: Autonomous Intelligent Robotics · In 1966, Marvin Minsky at MIT asked his undergraduate student Gerald Jay Sussman to “spend the summer linking a camera to a computer

The center is given by

[Jain, Kasturi, and Schunck (1995). Machine Vision, Ch. 2]

Page 33: COMP 50: Autonomous Intelligent Robotics · In 1966, Marvin Minsky at MIT asked his undergraduate student Gerald Jay Sussman to “spend the summer linking a camera to a computer

Horizontal and Vertical Projections

[Jain, Kasturi, and Schunck (1995). Machine Vision, Ch. 2]

Page 34: COMP 50: Autonomous Intelligent Robotics · In 1966, Marvin Minsky at MIT asked his undergraduate student Gerald Jay Sussman to “spend the summer linking a camera to a computer

Projection Formulas

[Jain, Kasturi, and Schunck (1995). Machine Vision, Ch. 2]

Page 35: COMP 50: Autonomous Intelligent Robotics · In 1966, Marvin Minsky at MIT asked his undergraduate student Gerald Jay Sussman to “spend the summer linking a camera to a computer

Diagonal Projection

[Jain, Kasturi, and Schunck (1995). Machine Vision, Ch. 2]

Page 36: COMP 50: Autonomous Intelligent Robotics · In 1966, Marvin Minsky at MIT asked his undergraduate student Gerald Jay Sussman to “spend the summer linking a camera to a computer

The area and the position can be computed from the H and V projections

[Jain, Kasturi, and Schunck (1995). Machine Vision, Ch. 2]

Page 37: COMP 50: Autonomous Intelligent Robotics · In 1966, Marvin Minsky at MIT asked his undergraduate student Gerald Jay Sussman to “spend the summer linking a camera to a computer

Neighbors and Connectivity

Page 38: COMP 50: Autonomous Intelligent Robotics · In 1966, Marvin Minsky at MIT asked his undergraduate student Gerald Jay Sussman to “spend the summer linking a camera to a computer

4-Connected

[Jain, Kasturi, and Schunck (1995). Machine Vision, Ch. 2]

Page 39: COMP 50: Autonomous Intelligent Robotics · In 1966, Marvin Minsky at MIT asked his undergraduate student Gerald Jay Sussman to “spend the summer linking a camera to a computer

8-connected

[Jain, Kasturi, and Schunck (1995). Machine Vision, Ch. 2]

Page 40: COMP 50: Autonomous Intelligent Robotics · In 1966, Marvin Minsky at MIT asked his undergraduate student Gerald Jay Sussman to “spend the summer linking a camera to a computer

Examples of Paths

[Jain, Kasturi, and Schunck (1995). Machine Vision, Ch. 2]

Page 41: COMP 50: Autonomous Intelligent Robotics · In 1966, Marvin Minsky at MIT asked his undergraduate student Gerald Jay Sussman to “spend the summer linking a camera to a computer

Boundary, Interior, and Background

[Jain, Kasturi, and Schunck (1995). Machine Vision, Ch. 2]

Page 42: COMP 50: Autonomous Intelligent Robotics · In 1966, Marvin Minsky at MIT asked his undergraduate student Gerald Jay Sussman to “spend the summer linking a camera to a computer

An Image (a) and Its Connected Components (b)

[Jain, Kasturi, and Schunck (1995). Machine Vision, Ch. 2]

Page 43: COMP 50: Autonomous Intelligent Robotics · In 1966, Marvin Minsky at MIT asked his undergraduate student Gerald Jay Sussman to “spend the summer linking a camera to a computer

Color Perception

Page 44: COMP 50: Autonomous Intelligent Robotics · In 1966, Marvin Minsky at MIT asked his undergraduate student Gerald Jay Sussman to “spend the summer linking a camera to a computer

The RGB Color Space

[http://www.arcsoft.com/images/topics/darkroom/what-is-color-space-RGB.jpg]

Page 45: COMP 50: Autonomous Intelligent Robotics · In 1966, Marvin Minsky at MIT asked his undergraduate student Gerald Jay Sussman to “spend the summer linking a camera to a computer

The RGB Color Space

https://upload.wikimedia.org/wikipedia/commons/thumb/1/11/RGBCube_b.svg/2000px-RGBCube_b.svg.png

Page 46: COMP 50: Autonomous Intelligent Robotics · In 1966, Marvin Minsky at MIT asked his undergraduate student Gerald Jay Sussman to “spend the summer linking a camera to a computer

3D Scatter Plot for a patch of skin

Page 47: COMP 50: Autonomous Intelligent Robotics · In 1966, Marvin Minsky at MIT asked his undergraduate student Gerald Jay Sussman to “spend the summer linking a camera to a computer

The HSV Color Space

Page 48: COMP 50: Autonomous Intelligent Robotics · In 1966, Marvin Minsky at MIT asked his undergraduate student Gerald Jay Sussman to “spend the summer linking a camera to a computer

Color Detection and Segmentation

Page 49: COMP 50: Autonomous Intelligent Robotics · In 1966, Marvin Minsky at MIT asked his undergraduate student Gerald Jay Sussman to “spend the summer linking a camera to a computer

Color Detection and Segmentation

Page 50: COMP 50: Autonomous Intelligent Robotics · In 1966, Marvin Minsky at MIT asked his undergraduate student Gerald Jay Sussman to “spend the summer linking a camera to a computer

Discussion: how may we achieve this?

Page 51: COMP 50: Autonomous Intelligent Robotics · In 1966, Marvin Minsky at MIT asked his undergraduate student Gerald Jay Sussman to “spend the summer linking a camera to a computer

Computer Vision in ROS

Page 52: COMP 50: Autonomous Intelligent Robotics · In 1966, Marvin Minsky at MIT asked his undergraduate student Gerald Jay Sussman to “spend the summer linking a camera to a computer

Computer Vision in ROS

1) Subscribing to an image topic

2) Converting a ROS image to an OpenCV image

3) Copy an image

4) Convert an image to grayscale

5) Access and set individual pixel values

6) Use rosbag to collect image data

Page 53: COMP 50: Autonomous Intelligent Robotics · In 1966, Marvin Minsky at MIT asked his undergraduate student Gerald Jay Sussman to “spend the summer linking a camera to a computer

Resources

• OpenCV in ROS:– http://wiki.ros.org/vision_opencv– http://wiki.ros.org/cv_bridge/Tutorials

– http://docs.opencv.org/2.4/doc/tutorials/tutorials.html

Page 54: COMP 50: Autonomous Intelligent Robotics · In 1966, Marvin Minsky at MIT asked his undergraduate student Gerald Jay Sussman to “spend the summer linking a camera to a computer

THE END

Page 55: COMP 50: Autonomous Intelligent Robotics · In 1966, Marvin Minsky at MIT asked his undergraduate student Gerald Jay Sussman to “spend the summer linking a camera to a computer