Week 7 : String and photo processing. Today’s Tasks  Practice list and string  Convert Decimal to any radix base number  Between Binary and Hexadecimal.

Slides:



Advertisements
Similar presentations
ECE 331 – Digital System Design
Advertisements

2.2 General Positional-Number-System Conversion
Number Systems. 2 The total number of allowable symbols in a number system is called the radix or base of the system. Decimal Numbers: radix = 10 (symbols:
Chapter Chapter Goals Know the different types of numbers Describe positional notation.
ECE 301 – Digital Electronics Course Introduction, Number Systems, Conversion between Bases, and Basic Binary Arithmetic (Lecture #1)
Data Representation in Computers
Chapter 02 Binary Values and Number Systems Nell Dale & John Lewis.
Number System Conversions Lecture L2.2 Section 2.3.
1 Number Systems. 2 Numbers Each number system is associated with a base or radix – The decimal number system is said to be of base or radix 10 A number.
Number Systems & Logic Gates Day 2. Octal Number System Base (Radix)8 Digits0, 1, 2, 3, 4, 5, 6, 7 e.g = =648 1 =88 0 =1 The digit.
BASICS OF COMPUTER APPLICATIONS ASB 102. UNIT 1 Introducing computer system  Number system  What is number system?  Types of number system  Their.
 Binary Binary  Binary Number System Binary Number System  Binary to Decimal Binary to Decimal  Decimal to Binary Decimal to Binary  Octal and Hexadecimal.
Data Representation in Computers. Data Representation in Computers/Session 3 / 2 of 33 Number systems  The additive approach – Number earlier consisted.
Chapter 16 Binary and Hexadecimal Numbers. §16.2 thru 16.3 – Addition and Subtraction of Binary Numbers Binary = Base 2 Addition and subtraction are similar.
CS105 INTRODUCTION TO COMPUTER CONCEPTS BINARY VALUES & NUMBER SYSTEMS Instructor: Cuong (Charlie) Pham.
Based on slides by:Charles Kime & Thomas Kaminski © 2004 Pearson Education, Inc. ECE/CS 352: Digital System Fundamentals Lecture 1 – Number Systems and.
Introduction to Python
Conversion of Number System Conversion Among Bases The possibilities: Hexadecimal DecimalOctal Binary
Data Representation – Chapter 3 Section 3-1. Terminology “Digital” –Discrete, well defined values/steps –Opposite of analog –Analogy: digital is to analog.
NUMBER SYSTEM.
Lecture 4 Last Lecture –Positional Numbering Systems –Converting Between Bases Today’s Topics –Signed Integer Representation Signed magnitude One’s complement.
Chapter 2 Binary Values and Number Systems. 2 2 Natural Numbers Zero and any number obtained by repeatedly adding one to it. Examples: 100, 0, 45645,
Number Systems Ron Christensen CIS 121.
CCE-EDUSAT SESSION FOR COMPUTER FUNDAMENTALS Date: Session III Topic: Number Systems Faculty: Anita Kanavalli Department of CSE M S Ramaiah.
Number systems, Operations, and Codes
Numbering System Base Conversion. Number systems Decimal – 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 Binary – 0, 1 Octal – 0, 1, 2, 3, 4, 5, 6, 7 Hexadecimal system.
Number System. Number Systems Important Number systems – Decimal – Binary – Hexadecimal.
CPS120: Introduction to Computer Science Computer Math: Converting to Decimal.
Positional Notation 642 in base 10 positional notation is:
Number Base Conversions
Introduction to C Programming Chapter 2 : Data Input, Processing and Output.
Type Conversions Implicit Conversion Explicit Conversion.
Data Representation – Chapter 3 Section 3-1. Terminology “Digital” –Discrete, well defined values/steps –Opposite of analog –Analogy: digital is to analog.
Calculations Chapter 11 Library of math functions, and constants cos, sin, tan, abs, min, max, log, random, sqrt, pow, exp Constants.PI,.E Use care with.
EEL 3801C EEL 3801 Part I Computing Basics. EEL 3801C Data Representation Digital computers are binary in nature. They operate only on 0’s and 1’s. Everything.
Octal to Decimal Hexadecimal DecimalOctal Binary.
DECIMALBINARY a) b) c) d) e) f) Revision Exercise DECIMALBINARY a) b) c)
Binary01.ppt Decimal Decimal: Base 10 means 10 Unique numerical digits ,00010,000 Weight Positions 3,
Using Recursion to Convert Number to Other Number Bases Data Structures in Java with JUnit ©Rick Mercer.
Discrete Mathematics Numbering System.
Chapter 2 Number Systems Consists of a set of symbols called digits and a set of relations such as +, -, x, /.
Introduction to Python Dr. José M. Reyes Álamo. 2 Three Rules of Programming Rule 1: Think before you program Rule 2: A program is a human-readable set.
Week 4 : Function with parameters and return values.
NUMBER SYSTEM. Number System Number Base B => B symbols – Base 16(Hexa):0, 1,……9, A,…, E, F – Base 10 (Decimal): 0, 1, 2,……, 7, 8, 9 – Base 8(Octal):
Number Representation Lecture Topics How are numeric data items actually stored in computer memory? How much space (memory locations) is.
29 January 2016Birkbeck College, U. London1 Introduction to Programming Lecturer: Steve Maybank Department of Computer Science and Information Systems.
CEC 220 Digital Circuit Design Number Systems & Conversions Wednesday, Aug 26 CEC 220 Digital Circuit Design Slide 1 of 16.
ECE DIGITAL LOGIC LECTURE 2: DIGITAL COMPUTER AND NUMBER SYSTEMS Assistant Prof. Fareena Saqib Florida Institute of Technology Fall 2016, 01/14/2016.
CS151 Introduction to Digital Design Chapter 1: Digital Systems and Information Lecture 2 1Created by: Ms.Amany AlSaleh.
Chapter 32 Binary Number System. Objectives After completing this chapter, you will be able to: –Describe the binary number system –Identify the place.
Binary Values. Numbers Natural Numbers Zero and any number obtained by repeatedly adding one to it. Examples: 100, 0, 45645, 32 Negative Numbers.
Appendix F Number Systems binary 0, 1 0, 1, 2, 3, 4, 5, 6, 7
Positional Number Systems Decimal, Binary, Octal and Hexadecimal Numbers Wakerly Section
Octal to Decimal Decimal Octal Binary Hexadecimal.
Discrete Mathematics Numbering System.
Number Systems.
Base ‘b’ number for i = 0 to n – 1 for an n digit quantity
CSE 102 Introduction to Computer Engineering
Number Systems and Binary Arithmetic
Binary, Octal and Hex Numbers Copyright Thaddeus Konar
There are 10 types of people of people in this world…
Digital Logic Design (CSNB163)
ECE 301 – Digital Electronics
Chapter Four Data Representation in Computers By Bezawit E.
Numeral systems (radix)
Remember the 10 types of people of people in this world…
Computer Science 1 Review and finish Number base conversion
Chapter 1 Introduction.
Presentation transcript:

Week 7 : String and photo processing

Today’s Tasks  Practice list and string  Convert Decimal to any radix base number  Between Binary and Hexadecimal  Practice more photo processing  Skewing  Caution: Delete your script files (*.py) before shutting down your PC!

Number Conversion (1/3)  How to convert?  Use quotient & remainder  Divide the quotient by the radix base number until the quotient is 0  Write remainders in reverse order  As a result, octal equivalent of decimal number 140 is 214

Number Conversion (2/3)  Define a conversion function  User Inputs  Number - positive integer  Radix - between 2 and 16  Output  Just digits, no gap or another character  123 (O) ‘1’ ‘2’ ‘3’ (x)  “Wrong input!!!” if inputs are not in range  You must use the formatting operator % (TAs will check!!!)  You should implement 2 programs  1. Use a list variable (e.g. converted_number=[])  Print a list to a string  use join()  2. Use a string variable (e.g. converted_number =“”) def deci_to_any(n, radix) :

Number Conversion (3/3) >>> [evaluate dec_to_any.py] Enter a number: 10 Enter a radix: 2 10 in base 10 is 1010 in base 2 >>> [evaluate dec_to_any.py] Enter a number: 61 Enter a radix: in base 10 is 3D in base 16 >>> [evaluate dec_to_any.py] Enter a number: 5 Enter a radix: 17 Wrong Input!!! >>> [evaluate dec_to_any.py] Enter a number: -5 Wrong Input!!!

Skewing (1/2)  Create the image skewed on an angle from the vertical or horizontal Input img Direction Angle Output Vertical -30 Horizontal -30 Horizontal 30 Vertical 30

Skewing (2/2)  Define a skewing function  User Inputs  Direction – vertical or horizontal  Angle – between -89 and 89  Output  Create a new skewed image  “Wrong input!!!” if inputs are not in range  You can use math functions or built-in functions  pi, sin, cos, tan, radians, …  abs  Type conversion def skew(img, …) : 30° ?

Any Questions?