Image Processing & Computer Vision Texture Segmentation 1

Download Report

Transcript Image Processing & Computer Vision Texture Segmentation 1

Image Processing &
Computer Vision
Texture Segmentation
1
Texture Segmentation

ลวดลาย หรื อ Texture เป็ นส่ วนสาคัญอย่างหนึ่งทางด้าน image
processing และ computer vision ที่ใช้ในการแบ่งแยก
ลวดลายต่าง ๆ ภายในภาพๆ หนึ่ง ออกเป็ นส่ วน ๆ อย่างชัดเจน ดังตัวอย่าง
จากภาพด้านล่าง จะสามารถแบ่งเป็ นโซนใหญ่ ๆ ได้ 4 โซน เช่น




Texture of tiger
Texture of grass
Texture of water
Unmatched texture
2
Texture Segmentation
การแบ่งส่ วนรู ปภาพให้เป็ นกลุ่ม (region) โดยดูจากลายของรู ปภาพ
หรื อ Texture โดยใช้ Grey Level Co-occurrence Matrix (GLCM).
3
Texture Segmentation

Example of Texture
4
Grey Level Co-occurrence Matrix (GLCM)

Three different co-occurrence matrices for a
gray-tone image.
Horizontal
Vertical
Diagonal
5
Grey Level Co-occurrence Matrix (GLCM)

GLCM คือ ตารางแสดงความแตกต่างระหว่าง pixel โดยใช้ความสว่าง
(brightness) ในระดับ gray level ที่เกิดขึ้นในรู ปภาพมา
แสดงผลในตาราง
Test image pattern (gray level)
4 gray level
ตัดบางส่วนของ
texture ออกมา
เพื่อทา GLCM
0  black
1  dark gray
2  light gray
3  white
6
Grey Level Co-occurrence Matrix (GLCM)

การแบ่งช่วงสี เช่น 4-gray level





ช่วง pixel
ช่วง pixel
ช่วง pixel
ช่วง pixel
intensity 0 – 63  0
intensity 64 – 127  1
intensity 128 – 191  2
intensity 192 – 255  4
การแบ่งช่วงสี สามารถทาได้มากกว่า 4 level ตามความละเอียดของ
texture (ลวดลาย)
7
Grey Level Co-occurrence Matrix (GLCM)
(Count Matrix)
Fill in Count Matrix (Right spatial
Relationship or Horizontal Relationship)
0
2
1
3
0
1
2
Test image pattern
3
Count Matrix
8
Grey Level Co-occurrence Matrix (GLCM)

Transpose Matrix เพื่อทาให้ Matrix สมมาตร หรื อ
Symmetric
Count Matrix
2
0
0
0
2
2
0
0
Transpose Matrix
1
0
3
0
0
0
1
1
2
2
1
0
+
0
2
0
0
0
0
3
1
0
0
0
1
Count Matrix + Transpose Matrix = Symmetrical Matrix
4
2
1
0
2
4
0
0
1
0
6
1
0
0
1
2
9
Grey Level Co-occurrence Matrix (GLCM)

Normalized symmetrical Horizontal GLCM
Symmetrical Matrix / Sum of elements = Horizontal GLCM
4
(1/24) * 2
1
0
2
4
0
0
1
0
6
1
0
0
1
2
=
0.167
0.083
0.042
0
0.083
0.167
0
0
0.042
0
0.25
0.042
0
0
0.042
0.083
Horizontal GLCM นี้จะแสดงเป็ นค่า Probability
10
Grey Level Co-occurrence Matrix (GLCM)
นอกจากจะทาการนับค่า Co-occurrence ในระดับแนวนอน(Horizontal) แล้ว
ยังสามารถที่จะทาในระดับแนวตั้ง(Vertical) หรื อแนวทแยงมุม (Diagonal) ได้อีกด้วย ดังนี้
Vertical Co-occurrence
Diagonal Co-occurrence
11
Example of Vertical GLCM
0
0
1
2
3
3
0
0
0
Vertical Co-occurrence
Transpose Matrix
1
0
2
0
0
2
2
2
1
0
3
0
0
2
0
Count Matrix
3
0
0
0
0
2
0
0
2
2
1
0
0
0
2
0
12
Example of Vertical GLCM(ต่ อ)
6
0
2
0
0
4
2
0
2
2
2
2
0
0
2
0
Symmetrical Matrix
Vertical GLCM (Probability)
0.25
0
0.083
0
0
0.167
0.083
0
0.083
0.083
0.083
0.083
0
0
0.083
0
13
Example of Diagonal GLCM
0
1
2
3
0
1
2
3
Diagonal Co-occurrence
Transpose Matrix
Count Matrix
14
Example of Diagonal GLCM(ต่ อ)
Symmetrical Matrix
Diagonal GLCM (Probability)
15
Grey Level Co-occurrence Matrix (GLCM)







สร้าง Count Matrix
ดู relation ใน ส่ วนของภาพที่ตดั มา ระหว่างจุดอ้างอิงและจุดพิกเซลเพื่อนบ้านตามทิศทางที่
กาหนด (Neighbour pixel)
นับจานวนความสัมพันธ์ที่เกิดขึ้น (occurrence) และเติมลงใน Count Matrix จะ
เกิด Count Matrix ของจานวนความสัมพันธ์ข้ ึน
Transpose Matrix เพื่อทาให้เป็ นสมมาตร (Symmetrical matrix)
ทาการบวก Count Matrix และ Transpose Matrix
แปลง Matrix ที่รวมกันแล้วให้เป็ น Probability โดยนาเอาค่าของ Matrix แต่ละช่อง
หารด้วยผลรวมทั้งหมด
เมื่อหา Probability Matrix ได้แล้ว ก็สามารถนาเอา Matrix นี้ไปหา Texture ใน
ภาพจริ งได้ โดยต้องทาภาพจริ งที่จะหา Texture ให้เป็ น gray level ระดับเดียวกันกับ
Matrix ที่สร้างขึ้นไว้ก่อน จากนั้นก็ทาการหา GLCM ของภาพจริ ง และนามาเปรี ยบเทียบ
กับ GLCM ที่เราสร้างไว้เป็ นต้นแบบ
16
Grey Level Co-occurrence Matrix (GLCM)
หา GLCM ในภาพจริง แล้ วนาไปเปรียบเทียบ
กับ Horizontal GLCM ทีส่ ร้ างไว้ แล้ ว
ถ้ ามีค่า Probability ใกล้ เคียงกันหรื อ
เหมือนกัน ในตาแหน่ งเดียวกัน ถือว่ าเป็ นลายเดียวกัน
Input image
0.167
0.083
0.042
0
0.083
0.167
0
0
0.042
0
0.25
0.042
0
0
0.042
0.083
Horizontal GLCM
17
Grey Level Co-occurrence Matrix (GLCM)

นอกจากจะใช้แค่ Probability Matrix ในการหา Texture แล้วเรายัง
สามารถหารายละเอียดของ Texture ได้อีก โดยการหา
 Contrast (ความแตกต่างของสี )
 Dissimilarity(ความแตกต่างของลวดลาย)
 Homogeneity หรื อ similarity(ความเป็ นเนื้ อเดียวกันหรื อความ
เหมือนกัน) ได้อีกด้วย
18
GLCM and Contrast weight
0
1
4
9
0.167 0.083 0.042 0
1
0
1
4
0.083 0.167 0
0
4
1
0
1
0.042 0
0.25
0.042
9
4
1
0
0
0.042 0.083
Contrast weight
=
0
0.083
0.168
0
0.083
0
0
0
0.168
0
0
0.042
0
0
0.042
0
Contrast Matrix
*
0
Horizontal GLCM
19
GLCM and Dissimilarity Weight
0
1
2
3
0.167 0.083 0.042 0
1
0
1
2
0.083 0.167 0
0
2
1
0
1
0.042 0
0.25
0.042
3
2
1
0
0
0.042 0.083
Dissimilarity weight
=
0
0.083
0.084
0
0.083
0
0
0
0.084
0
0
0.042
0
0
0.042
0
Dissimilarity Matrix
*
0
Horizontal GLCM
0.083+0.084+0.083+0.084+0.042+0.042
= 0.418
20
GLCM and Homogeneity (Similarity)
1
0.5
0.333 0.25
0.167 0.083 0.042 0
0.5
1
0.5
0.333
0.083 0.167 0
0
1
0.5
0.042 0
0.25
0.042
0
0.042 0.083
0.333 0.5
0.25
0.333 0.5
1
similarity weight
=
0.167
0.042
0.014
0
0.042
0.167
0
0
0.014
0
0.25
0.021
0
0
0.021
0.083
*
0
Horizontal GLCM
0.167+0.042+0.014+0.042+0.167+
0.014+0.25+0.021+0.021+0.083
= 0.804
21
Similarity Matrix