Wavelet transform And Its Applications to Image Processing

advertisement
THE HONG KONG
POLYTECHNIC UNIVERSITY
ENG236: Introduction (1)
Rocky K. C. Chang
1
Computer Programming and Basic Software Engineering
References:
1. J. Liberty, Teach Yourself C++ in 24 hours. SAMS,
2005/2009 (electronic book in the library).
2. H. M. Deitel and P. J. Deitel, C++ How To Program,
6th Ed. Prentice Hall, 2008.
3. S. Prata, C++ Primer Plus. Fifth Edition, SAMS,
2005.
2
Computer Programming and Basic Software Engineering
Contents
1.
2.
3.
4.
5.
6.
Introduction (week 1)
A Taste of C++ (week 1)
First semester
The Nuts and Bolts (weeks 2-5)
Basic Software Engineering (weeks 6-7)
Objects and Classes in C++ (weeks 8-9)
Pointers and Arrays (weeks 10-13)
7. Stream I/O
8. Elementary Data Structure
9. Building Graphical User Interface.
3
Second semester
Getting Started
1. What is Computer Programming?
4
Computer Programming and Basic Software Engineering
1. What is Computer Programming?
Computer Programming:
A systematic approach to instruct a
computer doing something for us.
Hardware
I/O devices
CPU
Memory
5
Computer Programming and Basic Software Engineering
1. What is Computer Programming?
Process of Computer Programming
Way of thinking
Computer
Computing
Problems
Operating System
Algorithms
Mapping
and Data
Structures
Hardware
Coding
High-level
Language
6
Application Software
Binding
(Compile, link and load)
Details in the following slides
Computing
Problems
Operating System
Algorithms
Mapping
and Data
Structures
Hardware
Coding
High-level
Language
7
Application Software
Binding
(Compile, link and load)
Computer Programming and Basic Software Engineering
1. What is Computer Programming?
Identify the Problem
•
•
8
Before writing a program, ask yourselves two questions:
1. What is the problem I want to solve?
2. Do I really need to write a program to solve it?
A problem can often be so large that requires the cooperation of a few programs to solve it.
• E.g. To design a computer game
- Design the story
- Design the graphics
- Design the motion
:
Computer Programming and Basic Software Engineering
1. What is Computer Programming?
• Do we need to write a program for the following
problems?
•
Calculate the result of 1 + 1?
No. Just use your fingers!
•
Play a piece of MP3 music using the computer?
•
No. Use application software such as Media Player.
Develop a Web page?
Yes or no, depending on how complicated your
Web page is.
• Usually we need to write a program if the problem
is too complicated and specific to our needs.
9
Computing
Problems
Operating System
Algorithms
Mapping
and Data
Structures
Hardware
Coding
High-level
Language
10
Application Software
Binding
(Compile, link and load)
Computer Programming and Basic Software Engineering
1. What is Computer Programming?
Find the Best Algorithm
• A problem can be solved by different approaches
• Using a clever approach can save you a lot of time
in getting the result
• E.g.
Calculate
1+2+3+4+5+6+7+8+9+
10 + 11 + 12
11 additions
• Solution?
Use algorithm: 12 x (1 + 12) / 2 = 78
1 addition, 1 multiplication, 1 division
11
Seems better, BUT ...
Computer Programming and Basic Software Engineering
1. What is Computer Programming?
• Consider the following situation:
• For a particular computer, it may take 10 s to
compute an addition but uses 100 s to do a
multiplication or division.
Calculate
1+2+3+4+5+6+7+8+9+
10 + 11 + 12
• Do you still want to use algorithm?
Direct addition: 110 sec
Use algorithm: 210 sec
 Algorithm needs to match with the hardware architecture
12
Computing
Problems
Operating System
Algorithms
Mapping
and Data
Structures
Hardware
Coding
High-level
Language
13
Application Software
Binding
(Compile, link and load)
Computer Programming and Basic Software Engineering
1. What is Computer Programming?
Coding
• Computer can only understand 0 and 1.
• The most direct way to communicate with the computer is
to use 0 and 1.
 Machine Language Programming
•
0110001111000010
0001000111100011
Machine
Language
Program
:
Very tedious and can make error easily
:
0011000100001000
14
1000001001010101
Computer Programming and Basic Software Engineering
1. What is Computer Programming?
Coding - Assembly Language
• Assembly Language is created to help human instruct CPU
to work.
• By using a software tool called Assembler, assembly
language programs can be converted into machine language
programs.
Assembly Language
LD
ADD
SUB
LD
15
R0, #05
R0, $1234
:
:
R0, #22
$2345, R0
Machine Language
Assembler
0110001111000010
0001000111100011
:
:
0011000100001000
1000001001010101
Computer Programming and Basic Software Engineering
1. What is Computer Programming?
Coding - High Level Language
• Assembly language programming is still too complicated for
general users.
• They are very different from human languages.
e.g. “Set W equal to W plus X minus Y divided by Z.”
“Repeat the next sequence of instructions until X is less
than 0 or Y equals Z.”
• A high level language is needed to reduce the gap between
human and computers.
16
Computer Programming and Basic Software Engineering
1. What is Computer Programming?
Details in the following slides
Executable
Machine Language Program
1011010101
0101010101
:
Linker
Library
Object code
Compiler
17
Give me
the result
of adding
1 to 10
.cpp
High Level Program
.exe
Computer Programming and Basic Software Engineering
1. What is Computer Programming?
• Compiler: Generate the object code.
• Object code  Similar to the machine
language code but cannot be executed
because of the missing of some information.
• Linker: Resolve the missing information from
the library or other programs.
For a program, it is very common that some of the
information in the program needs to be obtained from
the Library provided by the programming tool. It is
the job of linker to obtain these missing information.
18
Computer Programming and Basic Software Engineering
1. What is Computer Programming?
Coding - High Level Languages
• From time to time, high level languages (HLL) are designed for
different purposes.
• Earlier examples:
BASIC : for simple and general computing (obsolete for long)
COBOL : for data processing (is still using in local banks)
FORTRAN : for scientific computation (has been replaced by C or C++)
• Recent examples:
Pascal: a sophisticated but complicated HLL (replaced by C or C++)
C : a simple structural HLL for general computing (still in use)
• Current examples:
19
C++ : the most well-known object-oriented (OO) language
Java : an OO language designed with the concept of networking.
Computer Programming and Basic Software Engineering
1. What is a Computer?
Programming - C++
• Object-Oriented programming concept is overwhelming.
• OO Programming has the advantage of achieving reuse of
software components.
• The C++ programming language is created to implement the
concept of OO programming.
• C++ is an extension of the C language.
• C++ has become the predominant language for the commercial
software development.
• Standardized by the American National Standards Institute
(ANSI), C++ program is portable to different machines.
20
“Homework”


21
Install Visual Studio 2008 in your PC/notebook.
Locate the electronic book “Teach Yourself
C++ in 24 hours.”
Acknowledgments

22
The slides are based on the set developed by
Dr. Frank Leung (EIE).
Download