chapter 05 data representation...•พ ฒนาโดย ansi (american national standards...

45
Chapter 05 Data Representation การแทนข้อมูลในคอมพิวเตอร์ อ.สุวิชยะ รัตตะรมย์ สาขาวิชาวิทยาการคอมพิวเตอร์ คณะเทคโนโลยีสารสนเทศและการ สื่อสาร

Upload: others

Post on 23-Nov-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Chapter 05 Data Representation...•พ ฒนาโดย ANSI (American National Standards Institute) ส าหร บ PC •ใช พ นท 8 Bits ในการเก บข

Chapter 05 Data Representation

การแทนข้อมูลในคอมพิวเตอร ์อ.สุวิชยะ รัตตะรมย ์สาขาวิชาวิทยาการคอมพิวเตอร์ คณะเทคโนโลยีสารสนเทศและการสื่อสาร

Page 2: Chapter 05 Data Representation...•พ ฒนาโดย ANSI (American National Standards Institute) ส าหร บ PC •ใช พ นท 8 Bits ในการเก บข

Objective • เพื่อให้นิสิตเข้าใจวิธีการแทนค่าข้อมูลรูปแบบต่างๆ ใน

คอมพิวเตอร ์

2

Page 3: Chapter 05 Data Representation...•พ ฒนาโดย ANSI (American National Standards Institute) ส าหร บ PC •ใช พ นท 8 Bits ในการเก บข

Overview • Introduction •Number Representation •Text Representation • Sound Representation •Graphic Representation

3

Page 4: Chapter 05 Data Representation...•พ ฒนาโดย ANSI (American National Standards Institute) ส าหร บ PC •ใช พ นท 8 Bits ในการเก บข

Introduction •การที่เราจะสั่งให้คอมพิวเตอร์ท างาน ▫ ต้องรู้ว่าคอมพิวเตอร์ท างานอย่างไร???

•การที่เราจะรู้ว่าคอมพิวเตอร์ท างานอย่างไร ??? ▫ ต้องรู้ว่าข้อมูลต่างๆ เก็บในคอมพิวเตอร์ได้อย่างไร ??? ▫ เพลง, หนัง, รูป, ไฟล์เอกสาร ฯลฯ เก็บอย่างไร ??? ▫ คอมพิวเตอร์รู้จัก และท างานกับข้อมูลเหล่านี้ได้อย่างไร

???

4

Page 5: Chapter 05 Data Representation...•พ ฒนาโดย ANSI (American National Standards Institute) ส าหร บ PC •ใช พ นท 8 Bits ในการเก บข

•คอมพิวเตอร์เป็นอุปกรณ์ไฟฟ้า •ข้อมูลที่รู้จักคือสัญญาณแบบดิจิตอล ▫ คล้ายทีวี, วิทยุที่รู้จักสัญญาณแบบอนาล็อก

• ใช้การแทนค่ารูปแบบสัญญาณเพื่อแทนข้อมูลชนิดต่างๆ ในโลกความจริง

Image(s): FreeDigitalPhotos.net

Introduction [cont.]

5

Page 7: Chapter 05 Data Representation...•พ ฒนาโดย ANSI (American National Standards Institute) ส าหร บ PC •ใช พ นท 8 Bits ในการเก บข

Introduction [cont.] •สัญญาณ(ข้อมูล)ดิจิตอล – สัญญาณไฟฟ้า มี 2 สถานะ •on/off , เปิด/ปิด , มีสัญญาณ/ไม่มีสัญญาณ •แทนได้ด้วยเลข 1 และเลข 0 •แต่ละตัวจะเรียกว่า บติ (Bit) – Binary Digit

•สัญญาณเหล่านี้จะแทนข้อมูลต่างๆ ในคอมพิวเตอร์อีกที

1 0 1 1 0 1 0 1

7

Page 8: Chapter 05 Data Representation...•พ ฒนาโดย ANSI (American National Standards Institute) ส าหร บ PC •ใช พ นท 8 Bits ในการเก บข

ความรู้เพิ่มเติม •คอมพิวเตอร์รู้จักแต่สัญญาณดิจิตอล ซึ่งเขียนแทนได้

ด้วยเลขฐานสอง •ข้อมูลทุกอย่างที่เก็บในคอมพิวเตอร์ เกิดจาก “กลุ่มของ

สัญญาณดิจิตอล” ซึ่งใช้แทนความหมายของข้อมูลชนิดต่างๆ อีกที ซึ่งเรียกว่า Data Representation • ในการแทนข้อมูลชนิดใดๆ ก็ตาม ต้องมีการก าหนด

ขนาดหรือจ านวนบิตที่จะใช้แทนข้อมูล ด้วยเสมอ ซึ่งหน่วยข้อมูลคอมพิวเตอร์ มีหน่วยดังนี้

8

Page 9: Chapter 05 Data Representation...•พ ฒนาโดย ANSI (American National Standards Institute) ส าหร บ PC •ใช พ นท 8 Bits ในการเก บข

ความรู้เพิ่มเติม [ต่อ] หน่วย จ านวน ค่า

byte (B) 8 bits (b) 8 bits (b) kilobyte (KB) 210 bytes

103 bytes 1,024 bytes

megabyte (MB) 220 bytes 106 bytes

1,024 KB 1,048,576 bytes

gigabyte (GB) 230 bytes 109 bytes

1,024 MB 1,073,741,824 bytes

terabyte (TB) 240 bytes 1012 bytes

1,024 GB 1,099,511,627,776 bytes

9

Page 10: Chapter 05 Data Representation...•พ ฒนาโดย ANSI (American National Standards Institute) ส าหร บ PC •ใช พ นท 8 Bits ในการเก บข

Number Representation •การแทนข้อมูลในรูปแบบตัวเลข (ปกติเป็นเลขฐานสิบ) •ตัวเลขมีความหมาย สามารถน าตัวเลข 2 ตัวมาค านวณ

(แบบเลขฐานสอง) ได้ โดยใช้การออกแบบวงจรใน CPU • ใช้พื้นฐานเดียวกับการเขียนเลขฐานสองแทนเลขฐานสิบ •ปัญหาที่ต้องขบคิด ▫ เลขทศนิยมฐานสองแทนเลขทศนิยมฐานสิบได้ยาก ??? ▫ เลขที่มีค่าเป็นลบ จะแทนอย่างไร ??? ▫ จ านวนบิตที่ใช้ ส่งผลกระทบอย่างไร ???

10

Page 11: Chapter 05 Data Representation...•พ ฒนาโดย ANSI (American National Standards Institute) ส าหร บ PC •ใช พ นท 8 Bits ในการเก บข

Number Representation [cont.] • ในการแทนตัวเลข โดยมาตรฐานก าหนดเป็น 2 แบบหลัก ▫ การแทนเลขจ านวนเต็ม ▫ การแทนเลขทศนิยม

•แต่ละแบบยังมีประเภทย่อยๆ อีกหลายประเภท ▫ สถาปัตยกรรมของเครื่องคอมพิวเตอร์ที่แตกต่างกัน ▫ เทคโนโลยีอดีต – ปัจจุบัน

11

Page 12: Chapter 05 Data Representation...•พ ฒนาโดย ANSI (American National Standards Institute) ส าหร บ PC •ใช พ นท 8 Bits ในการเก บข

การแทนเลขจ านวนเต็ม • ใช้พื้นฐานเดียวกับการเขียนเลขฐานสองแทนเลขฐานสิบ •มีทั้งแบบ signed (บวก,ลบ) และ unsigned (บวกเท่านั้น) •การเก็บแบบ signed ใช้ได้หลายวิธี เช่น ▫ Sign-Magnitude ใช้ 1 บิตแทนเครื่องหมายบวก/ลบ ▫ 1’s Complements , 2’s Complements มี 1 บิตแทน

เครื่องหมายคล้าย sign-magnitude แต่ข้อมูลส่วนที่เหลือใช้หลักการทางคณิตศาสตร์ในการเก็บข้อมูล เพื่อให้มีประสิทธิภาพมากขึ้น

12

Page 13: Chapter 05 Data Representation...•พ ฒนาโดย ANSI (American National Standards Institute) ส าหร บ PC •ใช พ นท 8 Bits ในการเก บข

13

Page 14: Chapter 05 Data Representation...•พ ฒนาโดย ANSI (American National Standards Institute) ส าหร บ PC •ใช พ นท 8 Bits ในการเก บข

การแทนเลขจ านวนเต็ม [ต่อ] •จ านวนบิตที่ใช้ - 1 ไบต,์ 2 ไบต์ , 4 ไบต์ , 8 ไบต์ •จ านวนบิตที่ใช้ยิ่งมาก -> แทนตัวเลขที่มีค่ามากๆ ได้ • เช่น ถ้าใช้พื้นที่ 1 ไบต ์▫ แบบ unsigned -> 0 ถึง 255 ▫ แบบ signed (เครื่องหมาย 1 บิต) -> -128 ถึง 127

•ถ้าใช้พื้นที่ 2 ไบต์ ▫ แบบ unsigned -> 0 ถึง 65,535 ▫ แบบ signed (เครื่องหมาย 1 บิต) -> -32,768 ถึง 32,767

14

Page 15: Chapter 05 Data Representation...•พ ฒนาโดย ANSI (American National Standards Institute) ส าหร บ PC •ใช พ นท 8 Bits ในการเก บข

การแทนเลขจ านวนจริง • ใช้การเก็บแบบ exponential หรือ Floating point ซึ่งอยู่

ในรูปของ +/- significand x 10exponent

▫ เช่น +1.637 x 109 => 1,637,000,000 ▫ เช่น -3.5416 x 10-5 => -0.000035416

•แต่เป็น exponential ในรูปของเลขฐานสอง ▫ เช่น +1.101 x 25 => 110100 ▫ เช่น -0.11 x 2-3 => -0.00011

•ข้อมูลจะแบ่งเก็บ 3 ส่วน คือ sign, significand, exponent

15

Page 16: Chapter 05 Data Representation...•พ ฒนาโดย ANSI (American National Standards Institute) ส าหร บ PC •ใช พ นท 8 Bits ในการเก บข

การแทนเลขจ านวนจริง [ต่อ] •จ านวนบิตที่ใช้ - 2 ไบต์, 4 ไบต์ , 8 ไบต์ , 10 ไบต์ , 16 ไบต์ •ยิ่งใช้บิตมาก -> แทนตัวเลขที่มีค่ามากๆ หรือเล็กมากๆ ได้

16

Type Sign Significand Exponent Total bit Exponent bias

Half 1 10 5 16 15

Single 1 23 8 32 127

Double 1 52 11 64 1023

Double extended

1 64 15 80 16383

Quad 1 112 15 128 16383

Page 17: Chapter 05 Data Representation...•พ ฒนาโดย ANSI (American National Standards Institute) ส าหร บ PC •ใช พ นท 8 Bits ในการเก บข

17

Floating point number แบบ 32 และ 64 bit

Page 18: Chapter 05 Data Representation...•พ ฒนาโดย ANSI (American National Standards Institute) ส าหร บ PC •ใช พ นท 8 Bits ในการเก บข

Text Representation •การแทนข้อมูลในรูปแบบตัวอักษร ▫ รวมถึงสัญลักษณ์ต่างๆ , ตัวเลขที่ไม่น ามาค านวณ

•หลักการคล้ายกับรหัสมอส • ใช้ตัวเลข (ฐานสอง) แทนตัวอักษร •มี 2 ประเภทที่นิยม ▫ASCII ▫Unicode

18

Page 19: Chapter 05 Data Representation...•พ ฒนาโดย ANSI (American National Standards Institute) ส าหร บ PC •ใช พ นท 8 Bits ในการเก บข

ASCII (American Standard Code for Information Interchange) •พัฒนาโดย ANSI (American National Standards

Institute) ส าหรับ PC • ใช้พื้นที่ 8 Bits ในการเก็บข้อมูล 1 ตัวอักษร • เก็บตัวอักษรที่แตกต่างกันได้ 27 = 128 สัญลัษณ์ ▫ 1 บิตเอาไว้เป็นตัวเช็คความถูกต้องของข้อมูล ▫บางที่ใช้เพื่อให้แสดงภาษาอื่นนอกจากภาษาอังกฤษได้

• เก็บได้แต่ตัวอักษรภาษาอังกฤษ, ตัวเลข, สัญลักษณ์พิเศษต่างๆ

19

Page 20: Chapter 05 Data Representation...•พ ฒนาโดย ANSI (American National Standards Institute) ส าหร บ PC •ใช พ นท 8 Bits ในการเก บข

20

Page 21: Chapter 05 Data Representation...•พ ฒนาโดย ANSI (American National Standards Institute) ส าหร บ PC •ใช พ นท 8 Bits ในการเก บข

Unicode •พัฒนามาเพื่อให้รองรับหลายภาษาทั่วโลก รวมถึงภาษาไทย

•มีใน WindowsXP เป็นครั้งแรก(ส าหรับผู้ใช้ทั่วไป)

•มีหลายเวอร์ชัน ส าหรับการใช้งานที่ต่างกัน เช่น UTF-8, UTF-16, UTF-32 ฯลฯ

•มีขนาดได้สูงถึง 32 Bits ต่อ 1 ตัวอักษร

•แทนสัญลักษณ์ได้สูงถึง 232 สี่พันล้านสัญลักษณ์ • รวมรหัส ASCII ไว้ในตัว ท าให้แทน ASCII ได้ทันที

21

Page 22: Chapter 05 Data Representation...•พ ฒนาโดย ANSI (American National Standards Institute) ส าหร บ PC •ใช พ นท 8 Bits ในการเก บข

Sound Representation • เสียงเป็นข้อมูล analog มีลักษณะเป็นคลื่นที่ต่อเนื่องกัน มี

ส่วนประกอบคือ ▫ Amplitude - ความสูงของคลื่น บอกระดับความดังของ

เสียง ▫ Period – คาบการเคลื่อนที่ เวลาที่ใช้ในการเคลื่อนที่ 1

วงรอบ ▫ frequency – ความถี่ จ านวคาบต่อหน่วยเวลา (รอบ/

วินาที หรือ เฮิรทซ์) ความถี่สูง->เสียงแหลม, ความถี่ต่ า-> เสียงทุ้ม

22

Page 23: Chapter 05 Data Representation...•พ ฒนาโดย ANSI (American National Standards Institute) ส าหร บ PC •ใช พ นท 8 Bits ในการเก บข

23

Page 24: Chapter 05 Data Representation...•พ ฒนาโดย ANSI (American National Standards Institute) ส าหร บ PC •ใช พ นท 8 Bits ในการเก บข

24

Page 25: Chapter 05 Data Representation...•พ ฒนาโดย ANSI (American National Standards Institute) ส าหร บ PC •ใช พ นท 8 Bits ในการเก บข

Sound Representation •การแปลงสัญญาณ analog -> digital ใช้เทคนิคสุ่ม

ตัวอย่าง(Sampling) ▫ ในช่วงเวลาที่ก าหนดจะวัดและจัดเก็บ amplitude

ของสัญญาณเป็นค่าจ านวนเต็ม •คลื่นเสียงในคอมพิวเตอร์จึงถูกแทนในรูปดิจิทัลเป็นชุด

ล าดับค่าของ amplitude ที่สุ่มมา

25

Page 26: Chapter 05 Data Representation...•พ ฒนาโดย ANSI (American National Standards Institute) ส าหร บ PC •ใช พ นท 8 Bits ในการเก บข

Sound Representation

•จากรูป สัญญาณจะถูกจัดเก็บในคอมพิวเตอร์เป็นชุดของเลขจ านวนเต็มที่มีเครื่องหมาย ได้แก่ 3, 7, 7, 5, 0, -3, -6, -6, …, •ซึ่งแต่ละค่าจะถูกเข้ารหัสเป็นเลขฐานสอง

26

3 7 7

5 0

-3 -6 -6

Page 27: Chapter 05 Data Representation...•พ ฒนาโดย ANSI (American National Standards Institute) ส าหร บ PC •ใช พ นท 8 Bits ในการเก บข

Sound Representation

• เมื่อน าตัวเลขที่จัดเก็บไว้ในคอมพิวเตอร์มาสร้างเป็นคลื่นแอนะล็อกจะได้ดังนี้

27

3 7 7

5 0

-3 -6 -6

3 7 7

5 0

-3 -6 -6

Page 28: Chapter 05 Data Representation...•พ ฒนาโดย ANSI (American National Standards Institute) ส าหร บ PC •ใช พ นท 8 Bits ในการเก บข

Sound Representation • เสียงที่ได้จะใกล้เคียงความเป็นจริงหรือไม่ขึ้นอยู่กับ

ตัวเลขที่จัดเก็บไว้ •ซึ่งจะขึ้นอยู่กับ 2 ปัจจัย คือ ▫ อัตราการสุ่มตัวอย่าง (sampling rate) ▫ ความลึกของบิต (bit depth)

28

Page 29: Chapter 05 Data Representation...•พ ฒนาโดย ANSI (American National Standards Institute) ส าหร บ PC •ใช พ นท 8 Bits ในการเก บข

อัตราการสุ่มตัวอย่าง (sampling rate) • อัตราการสุ่มตัวอย่าง amplitude ของคลื่นเสียง (ครั้ง

ต่อวินาท,ี Hertz) ▫ ยิ่งสุ่มบ่อย ยิ่งมีความถูกต้องสูง

• หมูนุษย์สามารถได้ยินเสียงได้ 20 - 20000 Hz • ดังนั้นจึงต้องมีการสุ่มอย่างน้อย 40000 ตัวอย่าง เพื่อ

สามารถตรวจจับเสียงที่มนุษย์สามารถได้ยินได้ทุกความถี ่

• ที่นิยมคือ 44100 Hz or 44.1 kHz.

29

Page 30: Chapter 05 Data Representation...•พ ฒนาโดย ANSI (American National Standards Institute) ส าหร บ PC •ใช พ นท 8 Bits ในการเก บข

ความลึกของบิต (bit depth) • จ านวนบิตที่ใช้ในการเข้ารหัสแต่ละตัวอย่าง ▫ ใช้ 8 บิต/ตัวอย่าง -> วัด amplitude ที่แตกต่างกันได้

256 ระดับ ▫ ใช้ 16 บิตหรือ 24 บิต/ตัวอย่าง -> วัด amplitude

ได้ละเอียดมากขึ้น (65,536 หรือ 16,777,216 ระดับ) ให้รายละเอียดเสียงมากขึ้น มาตรฐาน CD -> 16 bit depth

30

Page 31: Chapter 05 Data Representation...•พ ฒนาโดย ANSI (American National Standards Institute) ส าหร บ PC •ใช พ นท 8 Bits ในการเก บข

Graphic Representation •หลักการก็เช่นเดียวกับกล้องดิจิตอล • รูปที่เก็บเกิดจากจุดเล็กๆ (pixels) หลายจุดรวมกัน ▫ จุดหนาแน่นมาก -> ความละเอียดมาก

•จุดแต่ละจุดจะมีค่า(สี) เพียงสีเดียว ▫ จ านวนเฉดเยอะ -> ภาพสมจริงมาก

•คอมพิวเตอร์เก็บรหัสแทนสีในแต่ละจุด •มีหลายชนิด

31

Page 32: Chapter 05 Data Representation...•พ ฒนาโดย ANSI (American National Standards Institute) ส าหร บ PC •ใช พ นท 8 Bits ในการเก บข

Binary image: 1 bit (0 or 1)

•แทนพิกเซลขาวด้วยบิต 1 และแทนพิกเซลด าด้วย 0 •จะได้ภาพที่มี 2 ส ีคือ ขาวและด า

Page 33: Chapter 05 Data Representation...•พ ฒนาโดย ANSI (American National Standards Institute) ส าหร บ PC •ใช พ นท 8 Bits ในการเก บข

Gray image : 8 bits (0~255)

• ใช้ 8 บิตเก็บสีของ 1 pixel • ไล่ระดับโทนสีตั้งแต่ขาว->ด า • ได้สีขาวด าทีแ่บบ gray scale • 28 = 256 โทนสี

Page 34: Chapter 05 Data Representation...•พ ฒนาโดย ANSI (American National Standards Institute) ส าหร บ PC •ใช พ นท 8 Bits ในการเก บข

Gray image : 8 bits (0~255)

Page 35: Chapter 05 Data Representation...•พ ฒนาโดย ANSI (American National Standards Institute) ส าหร บ PC •ใช พ นท 8 Bits ในการเก บข

Color image: 24 bits (RGB) – 16 ล้านสี

• เก็บข้อมูลของแต่ละพิกเซลมากกว่าภาพขาวด า • รูปแบบทั่วไป คือ RGB encoding scheme (RGB :

Red-Green-Blue) •สีของแต่ละพิกเซล ใช้ 3 สีในการจัดเก็บ คือ แดง เขียว

น้ าเงิน •แต่ละสีใช้ 1 ไบต์ (8 บิต) ในการจัดเก็บ •ซึ่งสามารถแทนระดับความเข้มของแต่ละสีตั้งแต่ 0-255 ▫ 0 หมายถึง ไม่มีส่วนผสมของสีนั้นเลย ▫ 255 หมายถึงมีส่วนผสมของสีนั้นมากที่สุด

Page 36: Chapter 05 Data Representation...•พ ฒนาโดย ANSI (American National Standards Institute) ส าหร บ PC •ใช พ นท 8 Bits ในการเก บข

Color image: 24 bits (RGB) – 16 ล้านสี

Page 37: Chapter 05 Data Representation...•พ ฒนาโดย ANSI (American National Standards Institute) ส าหร บ PC •ใช พ นท 8 Bits ในการเก บข

Color image: 24 bits (RGB) – 16 ล้านสี

Three-dimention color space

Page 38: Chapter 05 Data Representation...•พ ฒนาโดย ANSI (American National Standards Institute) ส าหร บ PC •ใช พ นท 8 Bits ในการเก บข

ปัญหาด้านความจ ุ• รูปมีจ านวน pixel มาก ยิ่งมีความละเอียดสูง

•ยิ่งมีจ านวนสีมาก, มีระดับของแต่ละสีเยอะ ยิ่งมีความสมจริง

•แต่ก็แลกมาด้วยปริมาณข้อมูลที่มหาศาล

• รูปขนาด 100 * 100 pixel สีขาวด า

▫ 1 pixel = 1 bit , ใช้พื้นที่ 10000 bit = 1,250 bytes

• รูปขนาด 800 * 600 pixel ที่ความละเอียด 24 bit

▫ 1 pixel = 3 bytes, ใช้พื้นที่ 1,440,000 Bytes

38

Page 39: Chapter 05 Data Representation...•พ ฒนาโดย ANSI (American National Standards Institute) ส าหร บ PC •ใช พ นท 8 Bits ในการเก บข

ปัญหาด้านความจุ [ต่อ] • ในการเก็บจริงจึงต้องมี “การบีบอัดข้อมูล”

• เพื่อให้ใช้พื้นที่น้อยลง

•มีหลายวิธี ขึ้นอยู่กับ จ านวนสี , คุณภาพรูปภาพ, ความซับซ้อนของอัลกอริทึม, ฯลฯ

•มาตรฐาน เช่น jpeg, pcx, bmp, png, tiff, gif เป็นต้น

39

Page 40: Chapter 05 Data Representation...•พ ฒนาโดย ANSI (American National Standards Institute) ส าหร บ PC •ใช พ นท 8 Bits ในการเก บข

Run-length encoding (RLE) • a very simple form of data compression

•มักใช้กับรูปภาพขาวด าหรือภาพที่มีสีน้อยๆ

•หลักการ

▫ เขียนชุดข้อมูลที่ซ้ าๆ กันทีละบรรทัด (pixel ในแนวนอน)

▫ เขียนจ านวน pixel ที่มีสีขาวและจ านวน pixel ที่มีสีด าสลับกันไปเรื่อยๆ

▫ ถ้าข้อมูลเริ่มด้วยสีด า -> เริ่มต้นด้วยเลข 0

▫ ถ้ามีมากกว่า 2 สี เขียน จ านวน, รหัสสี สลับกันไปเรื่อยๆ

40

Page 41: Chapter 05 Data Representation...•พ ฒนาโดย ANSI (American National Standards Institute) ส าหร บ PC •ใช พ นท 8 Bits ในการเก บข

41

Run-length encoding (RLE)

Page 42: Chapter 05 Data Representation...•พ ฒนาโดย ANSI (American National Standards Institute) ส าหร บ PC •ใช พ นท 8 Bits ในการเก บข

รูปอะไร ???

42

0, 6 0, 1, 4, 1 0, 1, 4, 1 0, 6 2, 2, 2 1, 4, 1

1, 4, 1 0, 6 0, 1, 1, 2, 1, 1 0, 6 1, 1, 2, 1, 1 2, 2, 2

3, 1, 2 3, 2, 1 0, 6 0, 6 3, 2, 1 3, 1, 2

0, 4, 2 0, 6 0, 4, 1, 1 0, 4, 1, 1 0, 5, 1 0, 4, 2

Page 43: Chapter 05 Data Representation...•พ ฒนาโดย ANSI (American National Standards Institute) ส าหร บ PC •ใช พ นท 8 Bits ในการเก บข

Vector image or Vector graphic •ปัญหาทั่วไปของภาพที่เก็บในคอมพิวเตอร์คือเมื่อขยายภาพ

จนถึงระดับหนึ่งจะเห็นการแตกของภาพ (Zigzag Effect)

▫ เพราะเราเก็บข้อมูลเป็น “จุด” -> ยิ่งขยายยิ่งเห็นจุดต่างๆ ชัด

▫ เรียกว่า bitmap image or raster image

•Vector image จะเก็บภาพในลักษณะของเส้นตรง, เส้นโค้ง, รูปร่าง, สี โดยใช้คณิตศาสตร์มาช่วยในการอธิบาย

▫ ขยายเท่าไรก็ไม่เกิดอาการแตก

43

Page 44: Chapter 05 Data Representation...•พ ฒนาโดย ANSI (American National Standards Institute) ส าหร บ PC •ใช พ นท 8 Bits ในการเก บข

Vector image or Vector graphic

•Vector image นิยมใช้กับภาพกราฟิก

▫ เช่น ฟอนต,์ แผนที่, ฯลฯ

44

Page 45: Chapter 05 Data Representation...•พ ฒนาโดย ANSI (American National Standards Institute) ส าหร บ PC •ใช พ นท 8 Bits ในการเก บข

Reference •สตอล์ลิงค์ , วิลเลียม. สถาปัตยกรรมคอมพิวเตอร์ .—

กรุงเทพฯ : เพียร์สัน เอ็ดดูเคช่ัน อินโดไชน่า, 2546 •http://csunplugged.org/image-representation •https://en.wikipedia.org/wiki/Gigabyte •http://en.wikipedia.org/wiki/Floating_point •https://en.wikipedia.org/wiki/Scalable_Vector_Gr

aphics

45