EE 113D Final Project: Colorization Spring, 2006 Group Members: Johnny Cheng Brian Cheung Austin Wong Professor: R. Jain TA: Rick Lan.

Slides:



Advertisements
Similar presentations
Previously… We created a simulated temperature reader which alerts if too hot or too cold… Download the solved practice to keep in sync: Thermostat.vi.
Advertisements

Microprocessors.
CPU Review and Programming Models CT101 – Computing Systems.
Week 3. Assembly Language Programming  Difficult when starting assembly programming  Have to work at low level  Use processor instructions >Requires.
The 8051 Microcontroller and Embedded Systems
ICS103 Programming in C Lecture 1: Overview of Computers & Programming
Lecture 1: Overview of Computers & Programming
The Little man computer
CENG536 Computer Engineering Department Çankaya University.
Section A A Step-By-Step Description of the System Generator Flow For a Colour Space Convertor In this section, a colour image stored as.
1 Foundations of Software Design Lecture 3: How Computers Work Marti Hearst Fall 2002.
Data Representation Computer Organization &
TK 2633 Microprocessor & Interfacing Lecture 3: Introduction to 8085 Assembly Language Programming (2) 1 Prepared By: Associate Prof. Dr Masri Ayob.
Data Representation COE 205
Connecting with Computer Science, 2e
Level ISA3: Information Representation
1 Lab Session-IV CSIT-120 Spring 2001 Lab 3 Revision and Exercises Rev: Precedence Rules Lab Exercise 4-A Machine Language Programming The “Micro” Machine.
Room: E-3-31 Phone: Dr Masri Ayob TK 2633 Microprocessor & Interfacing Lecture 1: Introduction to 8085 Assembly Language.
1 Lab Session-IV CSIT-120 Fall 2000 Precedence Rules Machine Language Programming The “Micro” Machine The “Micro” Simulator The “Micro” Translator (Thanks.
Number Representation (1) Fall 2005 Lecture 12: Number Representation Integers and Computer Arithmetic.
Manipulating 2D arrays in Java
8051 ASSEMBLY LANGUAGE PROGRAMMING
March 2006Taner Erig - EMU2-1 Metamorphosis of Information How is information represented and how do computers store information?
College Algebra Fifth Edition James Stewart Lothar Redlin Saleem Watson.
Connecting with Computer Science 2 Objectives Learn why numbering systems are important to understand Refresh your knowledge of powers of numbers Learn.
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.
Real Numbers and the Decimal Number System
TERMS TO KNOW. Programming Language A vocabulary and set of grammatical rules for instructing a computer to perform specific tasks. Each language has.
Topic 8: Data Transfer Instructions CSE 30: Computer Organization and Systems Programming Winter 2010 Prof. Ryan Kastner Dept. of Computer Science and.
JPEG C OMPRESSION A LGORITHM I N CUDA Group Members: Pranit Patel Manisha Tatikonda Jeff Wong Jarek Marczewski Date: April 14, 2009.
Computers Organization & Assembly Language
The CPU The Central Presentation Unit Main Memory and Addresses Address bus and Address Space Data Bus Control Bus The Instructions set Mnemonics Opcodes.
Java: Chapter 1 Computer Systems Computer Programming II.
Algorithmic Problem Solving CMSC 201 Adapted from slides by Marie desJardins (Spring 2015 Prof Chang version)
IT253: Computer Organization Lecture 4: Instruction Set Architecture Tonga Institute of Higher Education.
1 Perception, Illusion and VR HNRS 299, Spring 2008 Lecture 14 Introduction to Computer Graphics.
Algorithms and Programming
Replacing colors using if We don’t have to do one-to-one changes or replacements of color We can use if to decide if we want to make a change.  We could.
DEPARTMENT OF COMPUTER SCIENCE & TECHNOLOGY FACULTY OF SCIENCE & TECHNOLOGY UNIVERSITY OF UWA WELLASSA 1 CST 221 OBJECT ORIENTED PROGRAMMING(OOP) ( 2 CREDITS.
Lec 3: Data Representation Computer Organization & Assembly Language Programming.
CNG 140 C Programming Lecture Notes 2 Processing and Interactive Input Spring 2007.
Logical Circuit Design Week 2,3: Fundamental Concepts in Computer Science, Binary Logic, Number Systems Mentor Hamiti, MSc Office: ,
Getting Started with MATLAB 1. Fundamentals of MATLAB 2. Different Windows of MATLAB 1.
CS 111 – Sept. 15 Chapter 2 – Manipulating data by performing instructions “What is going on in the CPU?” Commitment: –Please read through section 2.3.
Introduction to Computers. High Level Structure of a Computer Major Components of a Computer –Central Processing Unit (CPU) – Controls the operation of.
1 COMS 161 Introduction to Computing Title: The Digital Domain Date: September 6, 2004 Lecture Number: 6.
Fixed & Floating Number Format Dr. Hugh Blanton ENTC 4337/5337.
A summary of TOY. 4 Main Components Data Processor Control Processor Memory Input/Output Device.
MECH1500 Chapter 3.
Variables in C Topics  Naming Variables  Declaring Variables  Using Variables  The Assignment Statement Reading  Sections
CMSC 104, Version 8/061L09VariablesInC.ppt Variables in C Topics Naming Variables Declaring Variables Using Variables The Assignment Statement Reading.
Lecture 11 Text mode video
Assembly Variables: Registers Unlike HLL like C or Java, assembly cannot use variables – Why not? Keep Hardware Simple Assembly Operands are registers.
MTH 091 Sections 3.1 and 9.2 Simplifying Algebraic Expressions.
Number Systems. The position of each digit in a weighted number system is assigned a weight based on the base or radix of the system. The radix of decimal.
F453 Module 8: Low Level Languages 8.1: Use of Computer Architecture.
The Little man computer
Image Processing Objectives To understand pixel based image processing
PROGRAMMING THE BASIC COMPUTER
Lec 3: Data Representation
Morgan Kaufmann Publishers
The 8051 Microcontroller and Embedded Systems
Chapter 3 Data Representation
Other Kinds of Arrays Chapter 11
Teaching Computing to GCSE
A Step-By-Step Description of the System Generator Flow
A Step-By-Step Description of the System Generator Flow
CSE 307 Basics of Image Processing
Digital Image Processing
Variables in C Topics Naming Variables Declaring Variables
Presentation transcript:

EE 113D Final Project: Colorization Spring, 2006 Group Members: Johnny Cheng Brian Cheung Austin Wong Professor: R. Jain TA: Rick Lan

Motivation Enhances Visual Appeal of the Image –Photoshop Application –Colorize old photographs Perceptually Enhance the Information Content of the Image –Eg. X-ray imaging, scientific illustration Minimize Human Labor –No longer need to choose colors from a palette to color individual components

Visual Idea Representation +=+=

Method 1. Convert 3 dimensional RGB pixel values to 2 dimensional YCbCr color space. 2. Luminance comparison between source (colored) and destination (grayscale) image. 3. Transfer of CbCr chromaticity values. 4. Convert YCbCr color space back into RGB color space.

YCbCrRGB R´ = 1.164(Y - 16) (Cr - 128) G´ = 1.164(Y - 16) (Cr - 128) (Cb - 128) B´ = 1.164(Y - 16) (Cb - 128)

Procedures: Preparing the Images We took 2 similar 162 x 210 images, one in RGB format and the other in grayscale, and decreased the resolutions to two 8x10 images using Photoshop. Although the pictures are not discernable, colorization can still be seen

Procedures: Preparing the Images Using Matlab, we used the imread command to read in the coefficients of each image The RGB image created an 8x10x3 matrix of coefficients and the grayscale image created an 8x10 matrix of coefficients. We used the Matlab program to perform a luminance comparison between the two image files thus creating a new YCbCr image The RGB image, for consistent dimensions, was converted into a YCbCr format with dimensions 8x10.

Procedures: Assembly Programming The equations that we implemented in assembly language are: R´ = 116(Y - 16) + 160(Cr - 128) G´ = 116(Y - 16) - 81(Cr - 128) - 39(Cb - 128) B´ = 116(Y - 16) + 202(Cb - 128). We used the MACP function from the DSP chip, which multiplied two numbers and added it to the accumulator Syntax for a specific block: A = #0 B = *AR1+ B = B - #16 AR7 = #operand1 *AR7 = B MACP(*AR7,const1,A)

Procedures: Assembly Programming loop1;R´ = 1.164(Y - 16) (Cr - 128) and store it into output1 A = #0;Clears the accumulator B = *AR1+;This section will perform the expression, (Y-16) B = B - #16 AR7 = #operand1;AR7 will hold the address location of operand1 nop *AR7 = B nop MACP(*AR7,const1,A);This will multiply B to const1 (116) and add it the value ;stored in the accumulator B = *AR3+;This will increment the Cr conversion constant matrix B = B - #128;This section will perform the expression, 1.596(Cr - 128) AR7 = #operand2;AR7 will hold the address location of operand2 nop *AR7 = B nop MACP(*AR7,const2,A);This will multiply B to const2 (160) and add it the value ;stored in the accumulator *AR4+ = A;Set accumulator A to output1and then increment AR4 if (*AR0- != 0) goto loop1 ;If the count is not at 0, go back to loop1

Procedures: Output Once we obtained the coefficient values inside the memory, we exported the data onto a dat file, where the values were in hexadecimal format The results would be compared numerically and visually The values were then copied onto an excel spreadsheet and were converted back into decimal form. PhotoshopYCbCr and luminance comparisonConvert to RGB

Understanding the Matlab Code Processing time and memory constraints Choosing the suitable Assembly Code Writing the Assembly Code

Trying to figure out what lines of code meant what and trying to figure out why the author chose to write that particular code was a challenge for us. For example, we needed to understand which lines of code converted the images into its 3-dimensional RGB form and which lines of code did the luminance comparison. Once we got a handle on the matlab code, we realized it was impossible for us to complete the whole process given the amount of time. We decided to cut down on our specifications and only chose a part of the Matlab Code that we were going to imitate on the DSP chip. We decided to focus on changing the image back into its 3- dimensional RGB form from the newly colored YCbCr grayscale image.

Since the amount of time it took to execute the Matlab code on our images exceeded one minute, we didn’t know how long it would take the DSP to perform similar operations. We decided to shrink the image to a more workable size from the 162x210 to a 8x10. It greatly reduced the Matlab processing time to about 10 seconds, which would correlate to a more reasonable job for the DSP chip to carry out.

We had a difficult time finding out which Assembly code to base our project on. We realized that we were basically going to have to write our own code using the similar format and structure as the assembly code from Experiment A (page 78)

Not being fully adept in Assembly, we had a hard time writing some of our code. For instance, we needed to perform a subtraction in some of our RGB conversion equations. There were no arithmetic instructions for doing subtraction, multiplication, and then addition.

After solving our syntax issues, the DSP chip still wasn’t performing any of the algebraic operations correctly. The values obtained from the RGB equations were doubled what was expected. We had initialization problems that occurred with the.data and.output. We copied over the wrong coefficients from Matlab, and thus we were processing the wrong values on the DSP.

Results - Red Scaled DSP HEX Values Scaled DSP Dec Values Un-scaled DSP Dec Values Un-Scaled Matlab Values Scaled Matlab valuesDifferencerelative difference% relative difference CB F A BFC A BB EDC B

Results - Green Scaled DSP HEX Values Scaled DSP Dec Values Un-scaled DSP Dec Values Un-Scaled Matlab Values Scaled Matlab valuesDifferencerelative difference% relative difference 1DDC A E C E D A CA

Results - Blue Scaled DSP HEX Values Scaled DSP Dec Values Un-scaled DSP Dec Values Un-Scaled Matlab Values Scaled Matlab valuesDifferencerelative difference% relative difference CB F A BFC A BB EDC B

Total Average Error: % From Matlab:

A Closer Look Matlab: DSP:

Future Developments 1. Convert 3 dimensional RGB pixel values to 2 dimensional YCbCr color space. 2. Luminance comparison between source (colored) and destination (grayscale) image. 3. Transfer of CbCr chromaticity values. 4. Convert YCbCr color space back into RGB color space.