Image Processing and Computer Vision Image Formation and Image Restoration

Download Report

Transcript Image Processing and Computer Vision Image Formation and Image Restoration

Image Processing and
Computer Vision
Image Formation and Image
Restoration
1
Score (คะแนน)

Programming Assignment + Homework




Midterm
Final
20%
25%
Project


15%
15%
Examination (สอบ)


Midterm
Final
OCR
เข้ าเรียน + จิตพิสัย
15%
10%
2
Topics








Binary Image Processing
Edge Detection
Automatic Threshold
Hough Transform
Generalized Hough Transform
Texture segmentation
Gradient Descent Method
State space Gradient Descent
3
Topics



Gibbs sampler with simulated Annealing
Stereo Matching, Stereo vision
Optical Flow, Computing Optical Flow
4
ความแตกต่ างของ Computer Graphic และ
Image Processing

Image Processing
Image
Computer Vision &
Image Processing
input
- การหาขนาดของภาพ (Size)
- การหาขอบของภาพ (Edge Detection)
- การหารู ปร่ างของภาพ (Shape Detection)
- การกาจัด Noise ของภาพ (Noise Removing)
- Etc.
Image
output
5
ความแตกต่ างของ Computer Graphic และ
Image Processing

Computer Graphic
Scene
Computer Graphic
Image
- shape
- material
- light
- color,shiny
- tranparency
- texture
input
output
6
Binary Image Processing







Image Filtering and Edge Detection
Image Restoration
Region, Image Segmentation, texture Segmentation
Blob coloring
Contour
Energy Minimization
Stereo Matching, Object Recognition
7
Example

Noise Removal or Image Restoration
Gaussian Noise
Restored image
8
Example

Noise Removal or Image Restoration
Salt and Pepper Noise
Restored image
9
Example

Edge Detection
Original Image
Robert’s Edge Detector
Sobel Edge Detector
10
Example

Template Matching (Midterm Project) การอ่านตัวอักษร
จากภาพที่ได้จากการสแกน และนามาเปรี ยบเทียบกับต้นแบบที่มีอยูแ่ ล้ว
Thai OCR
English OCR
Kedkarn Chaiyakhun
Computer Engineering
11
Example

Stereo Vision (Final Project) การหาความลึกของวัตถุในภาพ
Left eye
Right eye
12
Example

Stereo Vision
Depth
13
Example

Stereo Vision
Left eye
Right eye
14
Example

Stereo Vision
Depth
15
Low-Level Computer Vision




Edge Detection
Image Processing (Pre-processing)
Image Restoration
Noise Removal
16
Mid-Level Computer Vision

Segmentation (การแบ่งแยก)
Grouping
แยกวัตถุออกจาก Background
Separate Image In the zone (การแบ่งโซนของพื้นที่)

Finding Depth, Shape, Light, Material



17
High-Level Computer Vision

Pattern Recognition, Object Recognition
Obstacle Avoidance (การหลบหลีกสิ่ งกีดขวาง)
Grasping (การจับสิ่ งของ, การคว้าสิ่ งของ ของ Robot)

Etc.


18
RGB (Red Green BLUE) and
CMY (Cyan Magenta Yellow)
เป็ นการผสมสีสามสีระหว่างสี Red,Green,Blue RGB เป็ นการแยกสีอย่าง
ชัดเจน
19
RGB
CMY
19
Example RGB
Original Image
G-Component
R-Component
B-Component
20
Convert color to grayscale
(

I = (R+G+B) / 3 หรื อ

I= 0.299 * R + 0.587 * G + 0.114 * B
+
+
)
/3=
?
21
Image Formation (Gray Scale)





Intensity Image (ความเข้มของสี )
มีค่าตั้งแต่ 0…255 (ในระดับ Gray Scale)
0 – Black
100 – Gray
255 - White
200
220
190
100
225
180
90
245
180
150
180
255
244
230
0
20
130
140
230
122
34
90
112
67
…
....
…
…
…
…
22
Pixel
-Pixel เป็ นหน่วยที่เล็กที่สุดของภาพที่แสดงบนหน้าจอคอมพิวเตอร์
- Neighbors of Pixel ในแต่ละ pixel นันบางครั
้
ง้ เราจาเป็ นที่จะต้ องทาการประมวลผลที่
pixel ปั จจุบนั ร่วมกับ pixel ข้ างเคียง (Neighbors)
23
Pixel Coordinate
(column x, row y)
0 1 2
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
3 4 5 6 7 8 9 10 11 12 13 14 15
Pixel ที่ column =7,
row = 4 มีค่าเป็ นสี เหลือง
หรื อ x=7, y=4
Zoom 1600%
24
4-neighbors of Pixel
(x-1) (x) (x+1)
(y-1)
(y)
(y+1)
(x,y) is a red circle
(x,y-1) is top one
(x-1,y) is left one
(x+1,y) is right one
(x,y+1) is bottom one
25
Diagonal neighbor of Pixel
(x-1) (x) (x+1)
(y-1)
(y)
(y+1)
(x,y) is a red circle
(x-1,y-1) is top-left one
(x+1,y-1) is top-right one
(x-1,y+1) is bottom-left one
(x+1,y+1) is bottom-right one
26
8-neighbors of Pixel
(x-1) (x) (x+1)
(y-1)
(y)
(x,y) is a red circle
(x-1,y-1), (x,y-1),(x+1,y-1),
(x-1,y), (x,y), (x+1,y),
(x-1,y+1),(x,y+1), (x+1,y+1)
(y+1)
27
Noise in Sensor (camera, scanner)
ความผิดเพีย้ นต่ าง ๆ ทีท่ าให้ ภาพไม่ มีคุณภาพ

การ Scan กระดาษสี ขาวด้วยเครื่ อง
scanner ภาพที่ได้อาจจะไม่ได้ค่าเป็ น
200 ทั้งหมดก็ได้
28
Gaussian Additive Noise
29
Salt and Pepper Noise
Salt = Noise ที่ทาให้ภาพมี intensity สี ขาวซึ่งทาให้แตกต่างจาก pixel ข้างเคียง
Pepper = Noise ที่ทาให้ภาพมี intensity สี ดาซึ่งทาให้แตกต่างจาก pixel ข้างเคียง
30
การกาจัด Noise

Gaussian Noise


Use Gaussian Filter หรื อ Average Filter
Salt/Pepper Noise

Use Median Filter
31
Filter คืออะไร
Filter คือการนาเอาหน้ ากากขนาดเล็ก (mask) ไปแปะใน input image ทีต่ ้ องการประมวลผล
และหน้ ากาก(mask) จะทาการเลื่อนไปยังทุก ๆ pixel ของ input image จากซ้ ายไปขวา
และจากบนลงล่ าง จนกระทัง่ ถึง pixel สุ ดท้ ายของ input image (ขนาดของ Filter นั้นนิยมใช้
32
3X3 หรื อ 2X2)
The Convolution Process
z1 z2 z3
I1 I2 I3 I4 I5 I6
I7 X I9 I10 I11 I12
z4 z5 z6
z7 z8 z9
I13 I14 I15 I16 I17 I18
I19 I20 I21 I22 I23 I24
I25 I26 I27 I28 I29 I30
I31 I32 I33 I34 I35 I36
X = I1z1+I2z2+I3z3+I7z4+I8z5+I9z6+I13z7+I14z8+I15z9
ค่ า Z ซึ่งเป็ นค่ าของ Filter หรื อ หน้ ากาก จะเปลีย่ นค่ าไปตามชนิดต่ าง ๆ ของ Filter
33
The Convolution Process
I1 I2 I3 I4 I5 I6
z1 z2 z3
I7 I8 X I10 I11 I12
z4 z5 z6
z7 z8 z9
I13 I14 I15 I16 I17 I18
I19 I20 I21 I22 I23 I24
I25 I26 I27 I28 I29 I30
I31 I32 I33 I34 I35 I36
X = I2z1+I3z2+I4z3+I8z4+I9z5+I10z6+I14z7+I15z8+I16z9
34
The Convolution Process
I1 I2 I3 I4 I5 I6
z1 z2 z3
z4 z5 z6
z7 z8 z9
I7 I8 I9 X I11 I12
I13 I14 I15 I16 I17 I18
I19 I20 I21 I22 I23 I24
I25 I26 I27 I28 I29 I30
I31 I32 I33 I34 I35 I36
X = I3z1+I4z2+I5z3+I9z4+I10z5+I11z6+I15z7+I16z8+I17z9
35
The Convolution Process
z1 z2 z3
z4 z5 z6
z7 z8 z9
I1 I2 I3 I4 I5 I6
I7 X X X X I12
I13 X X X X I18
I19 X X X X I24
I25 X X X X I30
I31 I32 I33 I34 I35 I36
ค่ าของ X ที่ได้ คือค่ าของ pixel intensity ค่ าใหม่ ที่จะได้ มาจากการประมวลผลด้ วย Filter หรื อ หน้ ากาก
Pixel ที่เป็ นขอบของรูปภาพสามารถนามาแสดงผลได้ เลยเนื่องจากไม่ ได้ ผ่านการ process จาก filter ซึ่งการไม่ ผ่าน Filter
36
นั้นไม่ มีผลใด ๆ ในการแสดงผลบนหน้ าจอคอมพิวเตอร์ เพราะ ความละเอียดขนาด 1 pixel เป็ นส่ วนที่เล็กน้ อยมาก
Filter Example (การใช้ Filter ในการเบลอ
ภาพ)
Blurring (การเบลอภาพ)
หรื อ
Average Filter
37
Mean Filter (Average Filter)
Mean Filter ใช้สาหรับ เบลอภาพ หลักการง่าย ๆ ของ Mean Filter ก็คือ จับ pixel
ที่อยูใ่ กล้เคียงกันนามาบวกกัน และ ทาการหารด้วยจานวนช่องของ Filter นั้น
38
Median Filter

Median Filter ใช้จดั การกับ Salt/Pepper Noise
39
Median Filter



ไม่ ใช้ การ Convolution
ทาการเรี ยงลาดับค่า และเลือกค่าที่อยูต่ รงกลาง
ตัวอย่าง
40
Median Filter
41
Median Filter
3 * 3 Median Filter
42
Assignment 1

ให้นกั ศึกษาเขียนโปรแกรมโดยใช้ภาษาอะไรก็ได้ เช่น C, C#, VB, Java อื่น ๆ (ยกเว้น
Matlab) เพื่อทาการอ่านภาพ Gray Scale ซึ่งมี Salt & Pepper Noise
และ Guassian Noise เข้ามา และทาการ กาจัด Noise โดยการใช้ Filter 2 แบบ
คือ
1. Median Filter ใช้สาหรับกาจัด Salt & Pepper Noise
2. Average Filter (mean filter) ใช้สาหรับกาจัด Guassian Noise
CPE3 ปกติ
กาหนดส่ ง อังคารที่ 9 พฤศจิกายน 2553 ส่ งพร้ อมการรันผลลัพธ์ และอธิบายโปรแกรม
CPE3/4 ปกติ
กาหนดส่ ง ศุกร์ ที่ 12 พฤศจิกายน 2553 ส่ งพร้ อมการรันผลลัพธ์ และอธิบายโปรแกรม
43
www.rmuti.ac.th/user/kedkarn
Email : [email protected]
0868129127
44