340 likes | 540 Views
Lecture 6. Graphics, Number Systems. Bit-map Graphics. Similar to real painting on the canvas, there is no way to change something but paint over it. Bit-mapped graphics become ragged when you shrink or enlarge them. Painting: Bit-Mapped Graphics.
E N D
Lecture 6 Graphics, Number Systems
Bit-map Graphics • Similar to real painting on the canvas, there is no way to change something but paint over it. • Bit-mapped graphics become ragged when you shrink or enlarge them.
Painting: Bit-Mapped Graphics • Paint pixels on the screen with a pointing device • Select painting tools from a tools palette • Create bit-mapped graphics • Realism of the images isdetermined by the amount ofmemory allocation per pixel • Resolution is determinedby the density of pixels
Painting: Bit-Mapped Graphics • The outlinedareas can befilled with acolor or witha pattern
Digital Image Processing:Photographic Editing by Computer • You can edit high-resolution bit-mapped images • Select editing toolsfrom a palette • Alter digitizedphotographs andgraphics from paintprograms
Image Formats • BMP • The bit-mapped file format used by Microsoft Windows. • TIFF (Tagged Image File Format) • A standard file format for storing images as bit maps. It is used especially for scanned images because it can support any size, resolution, and color depth
Image Formats (cont) • GIF (Graphics Interchange Format) • A standard for digitized images compressed with the LZW algorithm (not image-specific, can be used for any data, in Unix a command compress). Allows for features such a transparent background, animation. Used in the Internet for small icon-like images.
Image Formats (cont) • JPEG (Joint Photographic Experts Group) • JPEG is designed for compressing either full-color or gray-scale digital images of "natural", real-world scenes. It does not work so well on non-realistic images, such as cartoons or line drawings. JPEG does not handle compression of black-and-white (1 bit-per-pixel) images or moving pictures. Used in the Internet for photos.
Vector Graphics • A vector image consist of objects such as lines, rectangles, circles, etc. that can be easily moved around and resized. • An object is usually chosen by a mouse click, and could be resized by dragging its borders. • Objects stay separate from each other all the time.
Vector Graphics • Such properties of an object as line thickness, color, fill pattern can be easily changed after the object was created. • Several objects may be grouped in on composed object. • A composed object can be broken down to the original objects it was made from. • Objects can be arranged in several layers, so that they overlap in a defined manner.
Drawing: Object-Oriented Graphics • Draw the shapesof objects with apointing device • The paletteof drawingsoftware differsfrom that ofpainting software
Drawing: Object-Oriented Graphics • Shapes: • Are stored as formulas (text) describing how to draw that shape the allows infinite resolution and requires less memory • The shape formulas allow for infinite resolution of the image • The shape formulas alsomean fewer memory demands
Image Formats • Formats of drawing programs (e.g. xfig) • PostScript, PDF • Graphics file format developed by Adobe Systems. Postscript is widely used on Unix for distributing and printing documents. Portable Document Format (PDF) is de-facto standard for documents in the Internet
Painting Pixels vs.Drawing Object Shapes • Painting pixels: • More control over textures,shading and fine detail • Used to create screendisplays (for videogames, multimediapresentations, andWeb pages)
Painting Pixels vs.Drawing Object Shapes • Painting pixels: • Used for simulatingnatural paint media • Used to embellishphotographic images
Painting Pixels vs.Drawing Object Shapes • Drawing object shapes: • Better choice for creating printed graphs, charts, and illustrations with clean lines and smooth shapes
CAD/CAM: From Picturesto Products • Engineers,architect, and designersuse (computer-aided design) CADsoftware to designor manufactureproducts • AutoCAD
Screen shot • In Linux it is possible to save an image of whole display, a fragment of the display or a window using Grab-feature in the xv-program. • In Windows it is possible to take save an image of the currently active window by pressing <Alt>-<PrintScreen>, or of the whole display by pressing just <PrintScreen>. The image is then place into clipboard, and can be pasted for example into a WordPerfect document or into Paint program.
A Bit About Bits A bit (binary digit) • is the smallest unit of information • can have two values - 1 and 0. Binary digits, or bits, can represent numbers, codes, or instructions. On Off
Bits as Numbers Binary number system - a system that denotes all numbers and combinations of two digits. The binary system uses two digits to represent the numbers 0 and 1.
Bits, Bytes, and Buzzwords Common terms might describe file size or memory size: Bit: smallest unit of information Byte: a grouping of eight bits of information K: (kilobyte); about 1,000 bytes of information - technically 1024 bytes equals 1K of storage.
Bits, Bytes, and Buzzwords MB: (megabyte); about 1 million bytes of information GB: (gigabyte); about 1 billion bytes of information TB: (terabyte); about 1 million megabytes of information
Decimal System • Humans have 10 fingers: count in DECIMAL • Numbers 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, ... • Use 10 digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 • We know that 5304 = 5*103+3*102+0*101+4*100 • Base 10
Binary System • BINARY numbers: • 0, 1, 10, 11, 100, 101, 110, 111, 1000, 1001, 1010, 1011, .... • Written with only 2 digits: "0" and "1" • In the same way as for decimal, 1011 (binary) = 1*23+0*22+1*21+1*20= 11 (decimal) • Base 2 • Converting from binary to decimal is simple, just as for 1011 above.
Binary System (contd.) • How to know if 1011 is in binary or in decimal? Subscripts are used to show the base: 10112 (binary number), 101110 (decimal number) • Converting from decimal to binary a little bit more tricky, we skip this, check some book if you are interested. • Large binary numbers are cumbersome to write
Hexadecimal System • Heavily used in modern computers to represent binary data • Numbers: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 1A, 1B, ... • Base 16 • Again the same idea: • 1A16 =1*161+10*160 = 2610
Hex (cont.) • Groups of 4 bits • 4 bits: 24 = 16 combinations... ... use digits 0-9 and A, B, C, D, E, F • Converting between binary and hex is straightforward: • 10111101112 => 10 1111 0111 => 10(=2) 1111(=F) 0111(=7) => 2F716
Octal System • Octal was used in computers with byte length of 6 bits • Numbers: 0, 1, 2, 3, 4, 5, 6, 7, 10, 11, 12, 13, 14, 15, 16, 17, 20, ... • Base 8 • Groups of 3 bits • 3 bits: 23 = 8 combinations... use digits 0-7
Octal (cont.) • Converting between binary and octal is straightforward: 10111101112 => 1 011 110 111 => 1(=1) 011(=3) 110(=6) 111(=7) =>13678 • In UNIX chmod command takes absolute mode for file access rights in octal
Example Decimal Binary Octal Hex (base 10) (base 2) (base 8) (base 16) 0 0000 0 0 1 0001 1 1 2 0010 2 2 3 0011 3 3 4 0100 4 4 5 0101 5 5 6 0110 6 6 7 0111 7 7 8 1000 10 8 9 1001 11 9 10 1010 12 A 11 1011 13 B 12 1100 14 C 13 1101 15 D 14 1110 16 E 15 1111 17 F 35 10 0011 43 23 100 110 0100 144 64 255 1111 1111 377 FF
Bits as Codes ASCII - American Standard Code for Information Interchange - most widely used code, represents each character as a unique 7-bit code.
Character Tables • ISO Latin1 • 8-bit code • Extension to ASCII (ASCII is compatible) • Has characters for European languages • Cyrillic • A dozen of different encodings • Mostly used: • KOI8 for UNIX • Windows-1251 • Unicode (16 bits) includes ALL characters from ALL languages (!) • Character Sets in browsers