0 1.1. motivation 1.2. why is computer vision difficult? 1.3. image representation and image...

52
1 1.1. Motivation 1.2. Why is Computer Vision Difficult? 1.3. Image Representation and Image Analysis 1.4. Summary Chapter 1 - Introduction

Upload: richard-parks

Post on 20-Jan-2016

218 views

Category:

Documents


6 download

TRANSCRIPT

Page 1: 0 1.1. Motivation 1.2. Why is Computer Vision Difficult? 1.3. Image Representation and Image Analysis 1.4. Summary Chapter 1 - Introduction

1

1.1. Motivation1.2. Why is Computer Vision Difficult?1.3. Image Representation and Image Analysis1.4. Summary

Chapter 1 - Introduction

Page 2: 0 1.1. Motivation 1.2. Why is Computer Vision Difficult? 1.3. Image Representation and Image Analysis 1.4. Summary Chapter 1 - Introduction

2

1.1. Motivation

An image is worth thousands of words

Objectives of image processing: 1. Human perception 2. Machine interpretation

Two principal rolesof images: 1.Communication 2. Scene understanding

Page 3: 0 1.1. Motivation 1.2. Why is Computer Vision Difficult? 1.3. Image Representation and Image Analysis 1.4. Summary Chapter 1 - Introduction

3

Human Perception Before After

Page 4: 0 1.1. Motivation 1.2. Why is Computer Vision Difficult? 1.3. Image Representation and Image Analysis 1.4. Summary Chapter 1 - Introduction

After

Before

4

Page 5: 0 1.1. Motivation 1.2. Why is Computer Vision Difficult? 1.3. Image Representation and Image Analysis 1.4. Summary Chapter 1 - Introduction

Before

After

5

Page 6: 0 1.1. Motivation 1.2. Why is Computer Vision Difficult? 1.3. Image Representation and Image Analysis 1.4. Summary Chapter 1 - Introduction

Before

6

Page 7: 0 1.1. Motivation 1.2. Why is Computer Vision Difficult? 1.3. Image Representation and Image Analysis 1.4. Summary Chapter 1 - Introduction

After

7

Page 8: 0 1.1. Motivation 1.2. Why is Computer Vision Difficult? 1.3. Image Representation and Image Analysis 1.4. Summary Chapter 1 - Introduction

For you, ...not much can be done!

8

Page 9: 0 1.1. Motivation 1.2. Why is Computer Vision Difficult? 1.3. Image Representation and Image Analysis 1.4. Summary Chapter 1 - Introduction

Machine Interpretation

AZ10• Optical Character Recognition (OCR)

9

Page 10: 0 1.1. Motivation 1.2. Why is Computer Vision Difficult? 1.3. Image Representation and Image Analysis 1.4. Summary Chapter 1 - Introduction

10

Page 11: 0 1.1. Motivation 1.2. Why is Computer Vision Difficult? 1.3. Image Representation and Image Analysis 1.4. Summary Chapter 1 - Introduction

11

Page 12: 0 1.1. Motivation 1.2. Why is Computer Vision Difficult? 1.3. Image Representation and Image Analysis 1.4. Summary Chapter 1 - Introduction

12

• License Number IdentificationLocation

Recognition

GG4025

Input image

• Form Analysis• Documentation

Page 13: 0 1.1. Motivation 1.2. Why is Computer Vision Difficult? 1.3. Image Representation and Image Analysis 1.4. Summary Chapter 1 - Introduction

13

• Model-based Object Recognition

Page 14: 0 1.1. Motivation 1.2. Why is Computer Vision Difficult? 1.3. Image Representation and Image Analysis 1.4. Summary Chapter 1 - Introduction

14

Object Models

Page 15: 0 1.1. Motivation 1.2. Why is Computer Vision Difficult? 1.3. Image Representation and Image Analysis 1.4. Summary Chapter 1 - Introduction

15

Model Matching

Page 16: 0 1.1. Motivation 1.2. Why is Computer Vision Difficult? 1.3. Image Representation and Image Analysis 1.4. Summary Chapter 1 - Introduction

16

(ii) What are their spatial

relationships?

(i) How many people, adults, and children

are there in the picture?

(v) What are they doing?

(iii) Who are they?

(iv) Where are they?

• Image Understanding

Page 17: 0 1.1. Motivation 1.2. Why is Computer Vision Difficult? 1.3. Image Representation and Image Analysis 1.4. Summary Chapter 1 - Introduction

17

Machine interpretation of images requires diverse methods of

Mathematical Engineering Biological disciplines Psycho-physiological Intelligent Scientific

Page 18: 0 1.1. Motivation 1.2. Why is Computer Vision Difficult? 1.3. Image Representation and Image Analysis 1.4. Summary Chapter 1 - Introduction

18

Low-level processing: e.g., noise removal, deblurring, and contrast enhancement

Mid-level processing: e.g., edge, region, corner, and texture detections

High-level processing: e.g., object, function, relationship, event, and activity recognitions

Image Analysis

=====

CV

I P

Page 19: 0 1.1. Motivation 1.2. Why is Computer Vision Difficult? 1.3. Image Representation and Image Analysis 1.4. Summary Chapter 1 - Introduction

19

1.2. Why is Computer Vision Difficult?

(1) Loss of information in 3D 2D

Page 20: 0 1.1. Motivation 1.2. Why is Computer Vision Difficult? 1.3. Image Representation and Image Analysis 1.4. Summary Chapter 1 - Introduction

20

(2) Local window vs. global view

Page 21: 0 1.1. Motivation 1.2. Why is Computer Vision Difficult? 1.3. Image Representation and Image Analysis 1.4. Summary Chapter 1 - Introduction

21

(3) Sequential vs. parallel processing

Page 22: 0 1.1. Motivation 1.2. Why is Computer Vision Difficult? 1.3. Image Representation and Image Analysis 1.4. Summary Chapter 1 - Introduction

22

Sequential processing

(5) Noise(4) Too much data

Page 23: 0 1.1. Motivation 1.2. Why is Computer Vision Difficult? 1.3. Image Representation and Image Analysis 1.4. Summary Chapter 1 - Introduction

23

Image F(x,y): a 2-D continuous function

1.3. Image Representation

Origin

Scene G(x,y,z): a 3-D continuous function

Discrete image D(r,c): a 2-D discrete function

N

M

M × N : Image size

Digital image I(r,c): an array of discrete values

Page 24: 0 1.1. Motivation 1.2. Why is Computer Vision Difficult? 1.3. Image Representation and Image Analysis 1.4. Summary Chapter 1 - Introduction

Dynamic range (or color depth) :

number of bits for a single pixel

(a) 1 - bit: black and white (binary image)

(b) 8 - bit: gray-scale (gray scale image)

(c) 24 - bit: true color (color image)

24

Page 25: 0 1.1. Motivation 1.2. Why is Computer Vision Difficult? 1.3. Image Representation and Image Analysis 1.4. Summary Chapter 1 - Introduction

An image file is a binary file, which can be dump.

• Physically,

25

Page 26: 0 1.1. Motivation 1.2. Why is Computer Vision Difficult? 1.3. Image Representation and Image Analysis 1.4. Summary Chapter 1 - Introduction

• Types of file formats:

BMP : Microsoft Bitmap formal JPEG : Joint Photographics Experts Group PNG : Portable Network Graphics TIFF : Tagged Image File Format GIF : Graphics Interchange Format HDF : Hierarchical Data Format PCX : PC Paintbrush XWD : X Window Dump ICO : ICOns CUR : CURsor

26

Page 27: 0 1.1. Motivation 1.2. Why is Computer Vision Difficult? 1.3. Image Representation and Image Analysis 1.4. Summary Chapter 1 - Introduction

(a) Header: Characteristics of image

Image size

Color map

Compression method

(b) Image data: Pixel values,

Index values

An image file contains

27

Page 28: 0 1.1. Motivation 1.2. Why is Computer Vision Difficult? 1.3. Image Representation and Image Analysis 1.4. Summary Chapter 1 - Introduction

Example: BMP header

28

Page 29: 0 1.1. Motivation 1.2. Why is Computer Vision Difficult? 1.3. Image Representation and Image Analysis 1.4. Summary Chapter 1 - Introduction

Example:

29

Page 30: 0 1.1. Motivation 1.2. Why is Computer Vision Difficult? 1.3. Image Representation and Image Analysis 1.4. Summary Chapter 1 - Introduction

C/C++ Programhttp://www.cs.ucsd.edu/classes/sp03/cse190-b/hw1/

Read header information

30

Page 31: 0 1.1. Motivation 1.2. Why is Computer Vision Difficult? 1.3. Image Representation and Image Analysis 1.4. Summary Chapter 1 - Introduction

Read image data

31

Page 32: 0 1.1. Motivation 1.2. Why is Computer Vision Difficult? 1.3. Image Representation and Image Analysis 1.4. Summary Chapter 1 - Introduction

• GIF header

32

Page 33: 0 1.1. Motivation 1.2. Why is Computer Vision Difficult? 1.3. Image Representation and Image Analysis 1.4. Summary Chapter 1 - Introduction

Example:

33

Page 34: 0 1.1. Motivation 1.2. Why is Computer Vision Difficult? 1.3. Image Representation and Image Analysis 1.4. Summary Chapter 1 - Introduction

• TIFF header

34

Page 35: 0 1.1. Motivation 1.2. Why is Computer Vision Difficult? 1.3. Image Representation and Image Analysis 1.4. Summary Chapter 1 - Introduction

35

Summary • Two major roles of images played: (i) Communication, (ii) scene understanding• Two main objectives of IP: (i) Human perception, (ii) machine interpretation• Three levels of IP: Low-, mid-, and high- levels

(1) Loss of information in 3D 2D

(2) Noise

(3) Too much data

(4) Local window vs. global view

(5) Sequential vs. parallel processing

• Difficulties of computer vision:

Page 36: 0 1.1. Motivation 1.2. Why is Computer Vision Difficult? 1.3. Image Representation and Image Analysis 1.4. Summary Chapter 1 - Introduction

36

Summary • Two main objectives of IP: Human perception, Machine interpretation

• Machine interpretation

Page 37: 0 1.1. Motivation 1.2. Why is Computer Vision Difficult? 1.3. Image Representation and Image Analysis 1.4. Summary Chapter 1 - Introduction

37

• Three levels of IP: Low-, mid-, and high- levels

(1) Loss of information in 3D 2D

(2) Noise

(3) Too much data

(4) Local window vs. global view

(5) Sequential vs. parallel processing

• Dynamic range (or color depth) : # bits per pixel

• Difficulties of computer vision:

Page 38: 0 1.1. Motivation 1.2. Why is Computer Vision Difficult? 1.3. Image Representation and Image Analysis 1.4. Summary Chapter 1 - Introduction

OpenCV && Matlab

38

Page 39: 0 1.1. Motivation 1.2. Why is Computer Vision Difficult? 1.3. Image Representation and Image Analysis 1.4. Summary Chapter 1 - Introduction

Opencv 安裝

• 通常使用 Visual studio C++ 搭配 openCV

• 也可以使用 Dev C++搭配(http://yester-place.blogspot.tw/2008/06/

dev-copencv.html)

39

Page 40: 0 1.1. Motivation 1.2. Why is Computer Vision Difficult? 1.3. Image Representation and Image Analysis 1.4. Summary Chapter 1 - Introduction

Visual C++ 2010 Express• Visual express 下載

http://www.visualstudio.com/downloads/download-visual-studio-vs

40

Page 41: 0 1.1. Motivation 1.2. Why is Computer Vision Difficult? 1.3. Image Representation and Image Analysis 1.4. Summary Chapter 1 - Introduction

OpenCV 安裝• http://opencv.org/downloads.html

41

Page 42: 0 1.1. Motivation 1.2. Why is Computer Vision Difficult? 1.3. Image Representation and Image Analysis 1.4. Summary Chapter 1 - Introduction

安裝 OpenCV

• 這邊以 OpenCV 246為例• 將 opencv解壓縮至 C 槽 (C:\OpenCV246)

• 設定環境變數 (我的電腦右鍵 >內容 >進階系統設定 >環境變數

• 在環境變數 PATH加上• C:\OpenCV246\build;

• C:\OpenCV246\build\x86\vc10\bin;

切記!!!設定完環境變數要重新開機才會生效!!!

42

Page 43: 0 1.1. Motivation 1.2. Why is Computer Vision Difficult? 1.3. Image Representation and Image Analysis 1.4. Summary Chapter 1 - Introduction

設定 Visual C++

43

Page 44: 0 1.1. Motivation 1.2. Why is Computer Vision Difficult? 1.3. Image Representation and Image Analysis 1.4. Summary Chapter 1 - Introduction

• 對專案點右鍵 >屬性• VC++目錄 > Include目錄加上

– C:\OpenCV246\build\include– C:\OpenCV246\build\include\opencv

• 程式庫目錄加上– C:\OpenCV246\build\x86\vc10\lib

44

Page 45: 0 1.1. Motivation 1.2. Why is Computer Vision Difficult? 1.3. Image Representation and Image Analysis 1.4. Summary Chapter 1 - Introduction

• 連結器 >輸入 >其他相依性 >– opencv_core246d.lib

– opencv_calib3d246d.lib

– opencv_contrib246d.lib

– opencv_features2d246d.lib

– opencv_highgui246d.lib

– opencv_imgproc246d.lib

– opencv_ml246d.lib

– opencv_objdetect246d.lib

– opencv_video246d.lib

– opencv_videostab246d.lib

– opencv_nonfree246d.lib

– opencv_flann246d.lib

45

Page 46: 0 1.1. Motivation 1.2. Why is Computer Vision Difficult? 1.3. Image Representation and Image Analysis 1.4. Summary Chapter 1 - Introduction

OpenCV 範例 -讀取圖片 (Mat)

Include 函式庫

imread(檔案名稱 ,讀取參數 )參數” 1”為彩色影像

imshow(視窗名稱 ,變數名稱 )

imwrite(檔案名稱 ,變數名稱 )

46

Page 47: 0 1.1. Motivation 1.2. Why is Computer Vision Difficult? 1.3. Image Representation and Image Analysis 1.4. Summary Chapter 1 - Introduction

OpenCV 範例 -讀取圖片 (Iplimage)

cvLoadImage(檔案名稱 ,參數 )

cvNamedWindow(視窗名稱 ,參數 )參數 1為視窗自動縮放大小

cvShowImage(視窗名稱 ,變數名稱 )

cvSaveImage(檔案名稱 ,變數名稱 )

47

Page 48: 0 1.1. Motivation 1.2. Why is Computer Vision Difficult? 1.3. Image Representation and Image Analysis 1.4. Summary Chapter 1 - Introduction

OpenCV函式• 讀取圖片

– Imread()

– cvLoadImage()

• 輸出圖片– Imwrite()

– cvSaveImage()

• 讀取影片– VideoCapture

• 改變圖片大小– cvResize()

• 其餘的可以上 OpenCV官網查詢– http://docs.opencv.org/modules/refman.html

48

Page 49: 0 1.1. Motivation 1.2. Why is Computer Vision Difficult? 1.3. Image Representation and Image Analysis 1.4. Summary Chapter 1 - Introduction

Matlab 軟體安裝師大校園軟體服務 (http://www.itc.ntnu.edu.tw/sw/index.html)

49

Page 50: 0 1.1. Motivation 1.2. Why is Computer Vision Difficult? 1.3. Image Representation and Image Analysis 1.4. Summary Chapter 1 - Introduction

Matlab 安裝• 解開壓縮檔後,內有一份安裝說明文件,照著文件步驟安裝即可

• 記得啟動時必須要用校內 IP

50

Page 51: 0 1.1. Motivation 1.2. Why is Computer Vision Difficult? 1.3. Image Representation and Image Analysis 1.4. Summary Chapter 1 - Introduction

Matlab 讀圖範例• 讀取圖片• >> A = imread('C:\lena.bmp');

• 顯示圖片• >> imshow(A);

• 輸出圖片• >> imwrite(A,'C:\test.bmp');

51

Page 52: 0 1.1. Motivation 1.2. Why is Computer Vision Difficult? 1.3. Image Representation and Image Analysis 1.4. Summary Chapter 1 - Introduction

Matlab 好處• 方便監控變數狀態• 畫圖時很方便

52