Image Processing and Computer Vision Image Formation and Image

44 Slides3.37 MB

Image Processing and Computer Vision Image Formation and Image Restoration 1

Score (คะแนน) Programming Midterm Final Examination Assignment Homework 15% 15% (สอบ) Midterm Final 20% 25% Project 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 input - Computer Vision & Image Processing Image output การหาขนาดของภาพ (Size) การหาขอบของภาพ (Edge Detection) การหารูปร่างของภาพ (Shape Detection) การกำจัด Noise ของภาพ (Noise Removing) Etc. 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 3 4 5 6 7 8 9 10 11 12 13 14 15 0 1 2 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) (y 1) (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) 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 คืออะไร คือการนำเอาหน้ากากขนาดเล็ก (mask) ไปแปะใน input image ที่ต้องการประมว น้ากาก(mask) จะทำการเลื่อนไปยังทุก ๆ pixel ของ input image จากซ้ายไปขวา กบนลงล่าง จนกระทั่งถึง pixel สุดท้ายของ input image (ขนาดของ Filter นัน ้ น 32 หรือ 2X2)

The Convolution Process z1 z2 z3 z4 z5 z6 z7 z8 z9 I1 I2 I3 I7 X I9 I13 I14 I15 I19 I20 I21 I4 I5 I6 I10 I11 I12 I16 I17 I18 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 หรือ หน้ากาก จะเปลี่ยนค่าไปตามชนิดต่าง ๆ ของ33Filte

The Convolution Process z1 z2 z3 z4 z5 z6 z7 z8 z9 I1 I2 I7 I8 I13 I14 I19 I20 I3 I4 I5 I6 X I10 I11 I12 I15 I16 I17 I18 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 z1 z2 z3 z4 z5 z6 z7 z8 z9 I1 I2 I7 I8 I13 I14 I19 I20 I3 I4 I5 I6 I9 X I11 I12 I15 I16 I17 I18 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 I1 I2 I3 I4 I5 I6 z1 z2 z3 z4 z5 z6 z7 z8 z9 I7 X I13 X I19 X I25 X I31 I32 X X X I12 X X X I18 X X X I24 X X X I30 I33 I34 I35 I36 ที่ได้คือค่าของ pixel intensity ค่าใหม่ที่จะได้มาจากการประมวลผลด้วย Filter หร ขอบของรูปภาพสามารถนำมาแสดงผลได้เลยเนื่องจากไม่ได้ผ่านการ process จาก filter ซึง ่ การไ ๆ ในการแสดงผลบนหน้าจอคอมพิวเตอร์เพราะ ความละเอียดขนาด 1 pixel เป็นส่วนที่เล็ก36น้อยม

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

Back to top button