Introduction to Artificial Intelligence Computer Vision · OpenCV: Pixel I Grayscale:each pixel has...

23
Introduction to Artificial Intelligence Computer Vision Janyl Jumadinova October 5, 2016

Transcript of Introduction to Artificial Intelligence Computer Vision · OpenCV: Pixel I Grayscale:each pixel has...

Page 1: Introduction to Artificial Intelligence Computer Vision · OpenCV: Pixel I Grayscale:each pixel has a value between 0 (black) and 255 (white) - values between 0 and 255 are varying

Introduction to Artificial IntelligenceComputer Vision

Janyl JumadinovaOctober 5, 2016

Page 2: Introduction to Artificial Intelligence Computer Vision · OpenCV: Pixel I Grayscale:each pixel has a value between 0 (black) and 255 (white) - values between 0 and 255 are varying

Computer Vision

Make computers understand images and video

2/16

Page 3: Introduction to Artificial Intelligence Computer Vision · OpenCV: Pixel I Grayscale:each pixel has a value between 0 (black) and 255 (white) - values between 0 and 255 are varying

Computer Vision

Make computers understand images and video

2/16

Page 4: Introduction to Artificial Intelligence Computer Vision · OpenCV: Pixel I Grayscale:each pixel has a value between 0 (black) and 255 (white) - values between 0 and 255 are varying

Computer Vision

Make computers understand images and video

3/16

Page 5: Introduction to Artificial Intelligence Computer Vision · OpenCV: Pixel I Grayscale:each pixel has a value between 0 (black) and 255 (white) - values between 0 and 255 are varying

Computer Vision

Make computers understand images and video

3/16

Page 6: Introduction to Artificial Intelligence Computer Vision · OpenCV: Pixel I Grayscale:each pixel has a value between 0 (black) and 255 (white) - values between 0 and 255 are varying

Computer Vision

I What kind of scene?

I Where are the cars?

I How far is the building?

4/16

Page 7: Introduction to Artificial Intelligence Computer Vision · OpenCV: Pixel I Grayscale:each pixel has a value between 0 (black) and 255 (white) - values between 0 and 255 are varying

Why computer vision matters?

5/16

Page 8: Introduction to Artificial Intelligence Computer Vision · OpenCV: Pixel I Grayscale:each pixel has a value between 0 (black) and 255 (white) - values between 0 and 255 are varying

Applications of Computer Vision

6/16

Page 9: Introduction to Artificial Intelligence Computer Vision · OpenCV: Pixel I Grayscale:each pixel has a value between 0 (black) and 255 (white) - values between 0 and 255 are varying

Segmentation

I Compact representation for image data in terms of a set ofcomponents

I Components share “common” visual properties

I Properties can be defined at different level of abstractions

7/16

Page 10: Introduction to Artificial Intelligence Computer Vision · OpenCV: Pixel I Grayscale:each pixel has a value between 0 (black) and 255 (white) - values between 0 and 255 are varying

Segmentation

I Compact representation for image data in terms of a set ofcomponents

I Components share “common” visual properties

I Properties can be defined at different level of abstractions

7/16

Page 11: Introduction to Artificial Intelligence Computer Vision · OpenCV: Pixel I Grayscale:each pixel has a value between 0 (black) and 255 (white) - values between 0 and 255 are varying

Segmentation

I Compact representation for image data in terms of a set ofcomponents

I Components share “common” visual properties

I Properties can be defined at different level of abstractions

7/16

Page 12: Introduction to Artificial Intelligence Computer Vision · OpenCV: Pixel I Grayscale:each pixel has a value between 0 (black) and 255 (white) - values between 0 and 255 are varying

Segmentation

I Tokens- whatever we need to group (pixels, points, surface elements,etc.)

I Bottom up segmentationtokens belong together because they are locally coherent

I Top down segmentationtokens belong together because they lie on the same object

8/16

Page 13: Introduction to Artificial Intelligence Computer Vision · OpenCV: Pixel I Grayscale:each pixel has a value between 0 (black) and 255 (white) - values between 0 and 255 are varying

Segmentation

I Tokens- whatever we need to group (pixels, points, surface elements,etc.)

I Bottom up segmentationtokens belong together because they are locally coherent

I Top down segmentationtokens belong together because they lie on the same object

8/16

Page 14: Introduction to Artificial Intelligence Computer Vision · OpenCV: Pixel I Grayscale:each pixel has a value between 0 (black) and 255 (white) - values between 0 and 255 are varying

Segmentation

I Tokens- whatever we need to group (pixels, points, surface elements,etc.)

I Bottom up segmentationtokens belong together because they are locally coherent

I Top down segmentationtokens belong together because they lie on the same object

8/16

Page 15: Introduction to Artificial Intelligence Computer Vision · OpenCV: Pixel I Grayscale:each pixel has a value between 0 (black) and 255 (white) - values between 0 and 255 are varying

What is Segmentation?

Clustering image elements that “belong together”

I Partitioning- Divide into regions/sequences with coherent internal properties

I Grouping- Identify sets of coherent tokens in image

9/16

Page 16: Introduction to Artificial Intelligence Computer Vision · OpenCV: Pixel I Grayscale:each pixel has a value between 0 (black) and 255 (white) - values between 0 and 255 are varying

OpenCV

I An open source BSD licensed computer vision library- Patent-encumbered code isolated into “non-free” module(SIFT, SURF, some of the Face Detectors, etc.)

I Available on all major platforms- Android, iOS, Linux, Mac OS X, Windows

I Written primarily in C++- Bindings available for Python, Java, even MATLAB (in 3.0).

I Well documented at http://docs.opencv.org

I Source available at https://github.com/Itseez/opencv

10/16

Page 17: Introduction to Artificial Intelligence Computer Vision · OpenCV: Pixel I Grayscale:each pixel has a value between 0 (black) and 255 (white) - values between 0 and 255 are varying

OpenCV

11/16

Page 18: Introduction to Artificial Intelligence Computer Vision · OpenCV: Pixel I Grayscale:each pixel has a value between 0 (black) and 255 (white) - values between 0 and 255 are varying

OpenCV

1. Load an image from the disk, display it on our screen, and writeit to file in a different format

12/16

Page 19: Introduction to Artificial Intelligence Computer Vision · OpenCV: Pixel I Grayscale:each pixel has a value between 0 (black) and 255 (white) - values between 0 and 255 are varying

OpenCV

1. Load an image from the disk, display it on our screen, and writeit to file in a different format

2. Access and manipulate pixels

13/16

Page 20: Introduction to Artificial Intelligence Computer Vision · OpenCV: Pixel I Grayscale:each pixel has a value between 0 (black) and 255 (white) - values between 0 and 255 are varying

OpenCV: Pixel

I Grayscale: each pixel has a value between 0 (black) and 255(white)- values between 0 and 255 are varying shades of gray

I Color: pixels are normally represented in the RGB color space- one value for the Red component, one for Green, and one forBlue- each of the three colors is represented by an integer in therange 0 to 255- how “much” of the color there is

14/16

Page 21: Introduction to Artificial Intelligence Computer Vision · OpenCV: Pixel I Grayscale:each pixel has a value between 0 (black) and 255 (white) - values between 0 and 255 are varying

OpenCV: Pixel

I Grayscale: each pixel has a value between 0 (black) and 255(white)- values between 0 and 255 are varying shades of gray

I Color: pixels are normally represented in the RGB color space- one value for the Red component, one for Green, and one forBlue- each of the three colors is represented by an integer in therange 0 to 255- how “much” of the color there is

14/16

Page 22: Introduction to Artificial Intelligence Computer Vision · OpenCV: Pixel I Grayscale:each pixel has a value between 0 (black) and 255 (white) - values between 0 and 255 are varying

OpenCV: Coordinate System

I The point (0, 0) corresponds to the upper left corner of theimage

I x value increases as we move to the right

I y value increases as we move down

15/16

Page 23: Introduction to Artificial Intelligence Computer Vision · OpenCV: Pixel I Grayscale:each pixel has a value between 0 (black) and 255 (white) - values between 0 and 255 are varying

OpenCV: Image Representation

I OpenCV represents images as NumPy arrays (matrices)

I NumPy is a library for the Python programming language thatprovides support for large, multi- dimensional arrays

I To access a pixel value, we need to supply the x and ycoordinates of the pixel

I OpenCV actually stores RGB values in the order of Blue, Green,and Red

16/16