Lecture 6 Data representation.

Slides:



Advertisements
Similar presentations
HTML popo.
Advertisements

Images Images are a key component of any multimedia presentation.
Information Representation
L.Ghadah R. Hadba CT1514-L1.  Computer Graphics :refers to processing of creating a new image from Geometry, Lighting parameters, Materials and Textures.Using.
Technology ICT Option: Data Representation. Data Representation In our everyday lives, we communicate with each other using analogue data. This data takes.
Lecture # 11 JavaScript Graphics. Scalable Vector Graphics (SVG) Scalable Vector Graphics (SVG), as the name implies, are - scalable (without pixelation):
Graphics on the Web CS575 Spring 2006 Dr.Abbot Student: Andre Liv.
Media: Text “Words and symbols in any form, spoken or written, are the most common system of communication.” ~ unknown.
Introduction to SVG (Part 3) Prepared by K.M.SO Department of Computer Science ver. 2 last update: June 2004.
Image Representation.
Image Representation CS105. Data Representation Text representation – ASCII character set – Unicode – Data compression Images!
Introduction to Computer Graphics
Unicode, character sets, and a a little history. Historical Perspective First came EBCIDIC (6 Bits?) Then in the early 1960s came ASCII – Most computers.
CHARACTERS Data Representation. Using binary to represent characters Computers can only process binary numbers (1’s and 0’s) so a system was developed.
Computer Sciences Department
Introduction to Human Language Technologies Tomaž Erjavec Karl-Franzens-Universität Graz Tomaž Erjavec Lecture: Character sets
Chapter 2 Data Representation. Define data types. Visualize how data are stored inside a computer. Understand the differences between text, numbers, images,
Globalisation & Computer Systems week 5 1. Localisation presentations 2.Character representation and UNICODE UNICODE design principles UNICODE character.
Dale Roberts Department of Computer and Information Science, School of Science, IUPUI CSCI N305 Information Representation: Characters and Images.
Spring /6.831 User Interface Design and Implementation1 Lecture 22: Internationalization.
1 CS 502: Computing Methods for Digital Libraries Lecture 4 Text.
HTML (HyperText Markup Language)
Objective Understand concepts used to create digital graphics. Course Weight : 15% Part Three : Concepts of Digital Graphics.
Digital Terminology. Bitmap A representation consisting of rows and columns of dots of a graphic image stored in computer memory. To display a bitmap.
1 Perception, Illusion and VR HNRS 299, Spring 2008 Lecture 14 Introduction to Computer Graphics.
Dale Roberts Department of Computer and Information Science, School of Science, IUPUI CSCI 230 Dale Roberts, Lecturer Information.
Character Encoding, F onts. Overview Why do character encoding and fonts matter to linguists? How can you identify problems? Why do these problems arise?
SVG for Designers Tom Hoferek. Objectives Introduce SVG Illustrate its capabilities Demonstrate SVG in action Speculate, discuss, answer questions.
1 Scalable Vector Graphics (SVG). 2 SVG SVG is an application language of XML. “SVG is a language for describing two- dimensional graphics in XML. SVG.
Lecture 16 Image Document Formats. Bitmap vs. Vector Images Bitmaps do not generally.
Color and Images. Color The natural colors we see and the colors we see on computer monitors are different. CMYK -natural RGB -monitor.
Data Representation The storage of Text Numbers Graphics.
DATA REPRESENTATION CHAPTER DATA TYPES Different types of data (Fig. 2.1) The computer industry uses the term “MULTIMEDIA” to define information.
Data Representation. What is data? Data is information that has been translated into a form that is more convenient to process As information take different.
© 2001, Penn State University Encoding on the Internet Elizabeth J. Pyatt CETS.
Computer Graphic. Raster graphics In computer graphics, a raster graphics image, digital image, or bitmap, is a data structure representing a generally.
UNITS OF MEASUREMENT 2.01 Understand Digital Raster Graphics.
SVG Scalable Vector Graphics And the SVG Perl Module Tamir Lousky April 2010Rehovot Perl Mongers.
© 2016 AQA. Created by Teachit for AQA Character encoding and Representing images Lesson.
Text and Images Key Revision Points.
Unit 2.6 Data Representation Lesson 3 ‒ Images
CNIT 131 Graphics.
Images Data Representation.
Data Representation Images.
Data Representation.
2.01 Understand Digital Raster Graphics
Computer Systems Nat 4/5 Data Representation Lesson 4:
2.01 Understand Digital Raster Graphics
Binary Representation in Audio and Images
Chapter 4: Scalable Vector Graphics (SVG)
2.01 Understand Digital Raster Graphics
Units of Measurement, Image Resolution, & Color Mode
Intro to Virtual and Web Mapping
Introduction to Computer Graphics
Ch2: Data Representation
2.01 Understand Digital Raster Graphics
2.01 Understand Digital Raster Graphics
D3.js Tutorial (Hands on Session)
Chapter 2 Data Representation.
2.01 Understand Digital Raster Graphics
Introducing Adobe Illustrator
Tutorial 1.3 Using Element Attributes
INFOCODING BASICS & EXAMPLES OF CURRENT USE
Multimedia System Image
Option: Data Representation
Week 10 - HTML SVG Student: Vladislovas Karalius
2.01 Understand Digital Raster Graphics
Lecture 4 - Introduction to Computer Graphics
Option: Data Representation
ASCII and Unicode.
Presentation transcript:

Lecture 6 Data representation

Storing information bit can contain only two values: 0 and 1 2 bits can contain four values: 00, 01, 10, 11 and so on: 8 bits can store 256 different data

How to store whole numbers We can store it in 8 bit number, starting from 0 to 255 0 - 0000 0000 255 - 1111 1111

How to store negative and positive ints in 8 bits Set first bit as a sign, so 0 means positive, and 1 is negative 0000 0100 is 4 1000 0100 is -4 But… it will have two zeros: 1000 0000 and 0000 0000 and they are not equal! It stores numbers from -127 to 127, totally 255 numbers

Two's complementary way In negative numbers store complement of number 0000 0100 - 4 1000 0000 - -127 1000 0010 - -125 1111 1111 - -1 It store 256 numbers, from -128 to 127

How to store real (double or float) numbers research it by yourself

Morse code

Storing text To store text early day computer engineers created ASCII code ASCII code was 8 bit, so it means that it can store 256 different characters ASCII contained different symbols, english alphabet (uppercase and lowercase letters)

ASCII code ASCII coding is standard coding in computers. 65 - 93 for capital letters 97 - 123 for lower case letters 48 - 58 for digits ASCII is stored in one byte memory A = 65 = 01000001 z = 123 = 01111011

Problem: How to store non-English characters Early approach: every alphabet used it's own encodings. Problem: How to store text that contains letters from different alphabets

Different encodings Windows-1250 for Central European languages that use Latin script, (Polish, Czech, Slovak, Hungarian, Slovene, Serbian, Croatian, Romanian and Albanian) Windows-1251 for Cyrillic alphabets Windows-1252 for Western languages Windows-1253 for Greek Windows-1254 for Turkish Windows-1255 for Hebrew and etc.

Problem: World alphabets There are many alphabets that are used in the world: Latin (spanish, german, finnish), Arabic (Persian), Hebrew, Chinese hieroglyphs, Korean, Japanese (Hiragana, Katakana), Cyrillic (Kazakh, Tatar, Serbian, Ukrainian), Tamil, Armenian, Mongolian, Greek, georgian. How to represent all of them in one document?

Problem: how to write following text: شخص جيد אדם טוב 좋은 사람 καλό πρόσωπο មនុស្សម្នាក់ដ៏ល្អ நல்ல நபர் Using different encoding for each script won’t allow you to write text with different scripts

Unicode All symbols stored in one table. Modern version contains 28 ancient and historic scripts (alphabets) and 72 modern scripts Contains 110,000 characters Can store text containing different scripts

UTF-8 what is it? UTF-8 (UCS Transformation Format—8-bit) is a variable-width encoding that can represent every character in the Unicode character set. It is compatible with ASCII means any file stored by UTF-8 but from symbols that are present in ASCII, will be same as stored by UTF-8

UTF-8 a = 65 = 01000001 ¢ = 11000010 10100010 € = 11100010 10000010 10101100 欽 = 6B3D

Use Unicode symbols in Python Put following to the first line of python code # -*- coding: utf-8 -*- print u“қазақша”

Images and colors Image is a set of pixels. Pixel is one cell on screen, which contains only one color. Image is stored in sequence of pixels, which is represented by its colors

How to store color Approach #1: Combine three colors: Cyan, Magenta, Yellow. Used in printers. Approach #2: Combine three colors: Red, Green, Blue. Used in displays. In computers it mostly saves every color

CMYk vs RGB Combination of Cyan+Magenta+Yellow gives black, and if there is no color it gives white Whilst combination of Red+Green+Blue gives white, and if there is no color it gives black So why CMY is used in printing and why RGB is used in monitors?

Mixing colors

Image Image is a sequence of pixels Pixel is one cell on screen of monitor, it displays color. Color is a combination of three colors (RED, GREEN, BLUE) Bitmap - is a map of pixels

Bit depth The amount of colours that can be represented in a bitmapped image is dictated by the bit depth. Bit depth Available colours 8 bits per pixel 256 (28) 16 bits per pixel 65,536 (216) 24 bits per pixel 16,777,216 (224)

PBM PBM file format to represent bitmap images. So 1 means white, and 0 means black

PNM PNM file format to represent color images

Vector graphics Vector graphics are stored as a list of attributes. The attributes are used by the computer to create the graphic. Rather than storing the data for each pixel, the computer will generate an object by looking at its attributes It saves geometrical information about image.

Raster (Bitmap) vs Vector graphics

Raster vs Vector Loads faster: Raster. Can be zoomed without lose of quality: Vector Takes less memory for simple figures: Vector Used in typography: Vector Best for real-world images: Raster try to understand why?

SVG (Scalable vector graphics) SVG most common vector graphics format. Used in web pages and in mobile applications Format that is based on XML, and can create vector graphics.

SVG example <svg xmlns="http://www.w3.org/2000/svg" version="1.1"> <circle cx="100" cy="50" r="40" stroke="black" stroke-width="2" fill="red" /> </svg>

SVG example <svg height="210" width="500"> <polygon points="200,10 250,190 160,210" style="fill:lime;stroke:purple;stroke-width:1" /> </svg> <svg height="80" width="300"> <g fill="none"> <path stroke="red" d="M5 20 l215 0" /> <path stroke="black" d="M5 40 l215 0" /> <path stroke="blue" d="M5 60 l215 0" /> </g> <svg height="150" width="400"> <defs> <linearGradient id="grad1" x1="0%" y1="0%" x2="100%" y2="0%"> <stop offset="0%" style="stop-color:rgb(255,255,0);stop-opacity:1" /> <stop offset="100%" style="stop-color:rgb(255,0,0);stop-opacity:1" /> </linearGradient> </defs> <ellipse cx="200" cy="70" rx="85" ry="55" fill="url(#grad1)" />

SVG animation <svg height="60" width="200"> <text x="0" y="15" fill="red" transform="rotate(30 20,40)">I love SVG</text> Sorry, your browser does not support inline SVG. </svg> <svg width="400" height="400"> <rect x="20" y="20" width="250" height="250" style="fill:blue"> <animate attributeType="CSS" attributeName="opacity" from="1" to="0" dur="5s" repeatCount="indefinite" /> </rect> <svg width="600" height="600"> <g transform="translate(100,100)"> <text id="TextElement" x="0" y="0" style="font-family:Verdana;font-size:24; visibility:hidden"> It's SVG! <set attributeName="visibility" attributeType="CSS" to="visible" begin="1s" dur="5s" fill="freeze" /> <animateMotion path="M 0 0 L 100 100" begin="1s" dur="5s" fill="freeze" /> <animateTransform attributeName="transform" attributeType="XML" type="rotate" from="-30" to="0" begin="1s" dur="5s" fill="freeze" /> <animateTransform attributeName="transform" attributeType="XML" type="scale" from="1" to="3" additive="sum" begin="1s" dur="5s" fill="freeze" /> </text> </g>

Plain text data/file formats That are standard data formats that are stored in plain form This file formats are used to interchange data in web, applications and etc. JSON XML HTML CSV

XML: extensible markup language <group name=”D03”> <student id=”332”>John Black</student> <student id=”321”>Mike Pawn</student> <student id=”320”>Jeremy King</student> </group>

JSON: javascript object notation [ { name: “A04”, students: [ {id:”332”,name:“John Black”}, {id:”322”,name:“Jeremy King”} ] },{ name: “B04”, [ {id:”332”,name:“John Black”}, } ]

CSV Tabular data saved in CSV format name,surname,group steve,jobs,A03 michael,phelps,B03 Can be opened by Excel, used for sending tabular information

Have questions? What were these texts? They were document formats Who uses them? Developers use it, to send data between different applications Can we use other format or create format by ourselves? Yes, but this are standard formats, so everyone knows it, and also there are tons of libraries working with them

HTML Hyper Text Markup Language: is markup language that stores how elements are placed on a web-page <html> <body> <h1>Header</h1> </body> </html>

HTML <p>Paragraph</p> <h1>Header</h1> <img src="1.jpg"/> <ul><li>Item</li><li>Item</li><li>Item</li></ul> <a href="1.html">Link to item</a>

Browsers Web browsers retrieve data (mostly HTML code) from server and displays it on screen Nowadays browsers are free, but before people had to buy browsers

History of browser 1990 - World Wide Web browser (later renamed to Nexus) 1993 - Mosaic (later called Netscape) 1995 - Internet Explorer, as answer to Netscape 1996 - Opera 2004 - Firefox 1.0. on the base of Netscape 2003 - Apple’s Safari 2008 - Google’s Chrome

Usage of browsers