Modifying pictures with loops

Size: px
Start display at page:

Download "Modifying pictures with loops"

Transcription

1 Chapter 3 Modifying pictures with loops We are now ready to work with the pictures. From a programming perspective. So far, the only structure we have done is sequential. For example, the following function def pickandshow(): myfile=pickafile() mypict=makepicture(myfile) show(mypict) is executed as a one-pass sequence. Sometimes, we need more general and flexible structures, such as conditional and loop. Let s have a look. 1

2 Control Structures There are three basic structures in any highlevel programs: sequential, conditional and repetitive. Below is an example of a sequential structure. Get up; Having breakfast; Having a class; Having the next class; Having lunch; Having another class; Having one more class; Having supper; Watching TV; Go to bed; 2

3 Conditional operation The conditional operation lets the algorithm to ask a question, and, based on the answer, selects the next operation to perform. Below is the most commonly used structure. If "a true-false" condition is true Then first set of operations Else second set of operations. It evaluates the condition first to see if it is true or false, and then executes the first, or the second set, of operations, accordingly. In either case, continues with the next operation. 3

4 An example 1. Get values for gallons, start and end 2. Set the value of distance to (end start) 3. Set the value of average to (distance/gallons) 4. Print the value of average 5. If average > 25.0 Then 6. Print the massage You are getting good gas mileage. 7. Else Print the massage You are not getting a good gas mileage. 8. Stop 4

5 Iterative operation An iterative operation repeats a block of operations, i.e., Repeat step i to step j until a "condition" becomes true step i: operation step i+1: operation... step j: operation It performs all operations from step i to step j, inclusive, until the condition becomes true. The block from step i to step j is called the loop body, and the condition is called a termination condition, which is used to control the loop. 5

6 An example 1. Repeat step 2 to step 10 until response is no 2. Get values for gallons, start and end 3. Set the value of distance to (end start) 4. Set the value of average to (distance/gallons) 5. Print the value of average 6. If average > 25.0 Then 7. Print the massage You are getting good gas mileage. 8. Else Print the massage You are not getting a good gas mileage. 9. Print the massage Do you want to repeat? 10. Get a value for response from the user 11. Stop 6

7 More iterative structure The following prints out 1 through 10: int count = 1; while (count <= 10){ cout << count; count = count + 1; } It can also be done with the following: for (count=1; count <= 10; count++){ cout << count; } 7

8 Image representation Before discussing media processing, we have to understand better how a picture is represented. JPEG is one way to represent an image, which is an international standard to store images with high quality but less space. It is a lossy representation in the sense that it does not store 100% of the original information by throwing away some of the unnecessary information. For all the practical purposes, a JPEG file works just fine. In a bit more details, a JPEG file is kept in a 2 dimensional matrix, which is a sequence of elements each with an associated index number. When we use such a matrix to represent a picture, each element is called a pixel, i.e., an element of picture, which is identified with a coordinate, such as (231, 125). 8

9 An example Below shows the cursor, and the close-up view of the cursor and that of the line below the cursor. The following Python expression identifies the pixel (10, 100) of a picture pict: getpixl(pict, 10, 100) We can also use the built-in Picture Tool to identify the coordinate of any pixel within a chosen picture. 9

10 How could this happen? It turns out that our sensory apparatus can t distinguish small bits out of a whole. We simply can t see much details as well as an eagle. We also have a different system for processing a color image from that for processing a blackand-white image (luminance). We use the latter to detect motion and size of an object. This lack of resolution is what makes picture digitization possible: We simply break up (digitize) an image to a whole bunch of pixels, and can t really tell the difference between the two, when there are enough of them. 10

11 How about the color? When we use a matrix to represent a color picture, each pixel is also associated with a color, which is a combination of three basic ones, red, green, and blue, according to the RGB Color model. We usually use one byte to represent each color. Thus, using three bytes for three colors, we can come up with 2 24, about 16 million different colors. 11

12 Other models CMYB is another model for color in which any color is decomposed as a combination of four basics ones: Cyan, Magenta, Yellow, and Black. It is often used in the printers. Yet another one is the HSV, in which a color is represented as a combination of three ingredients: Hue (type of the color), Saturation (gray to dark) and Value (brightness): 12

13 Different colors For example, (0, 0, 0) represents black; (255, 255, 255) represents white; (50, 50, 50) represents dark gray; and (100, 100, 100) a bit lighter. Below shows a matrix of 8 pixels, with different colors and their codes. 13

14 How big is it? Once we have identified a picture object (How?), we can find out its size, i.e., its width and height in terms of the number of pixels, with the getwidth and getheight commands as follows: >>>print getwidth(pict) >>>print getheight(pict) In general, given a picture pict, getwidth(pict) finds out the number of columns and getheight finds out the number of rows. Let s check it out with, e.g., arch.jpg. 14

15 Get and set the color We manipulate a picture in Python by making a picture object out of a JPEG file, then changing the properties, mainly the colors, of the pixels of that picture. To get the color of a pixel of a picture object, pict, we use the following expression: >>>pixel1=getpixel(pict, 1, 100) >>>print getcolor(pixel1) To get just the green component, we say >>>print getgreen(getpixel(pict, 1, 100)) To set the color of the above pixel to yellow, we can do the following: >>>setcolor(pixel1, yellow) Question: Did we do it? 15

16 Another example Let s see what does the following sequence do, with the Picture Tool. Assume that we have picked an image file to work with, we might have the following session: >>>pixel2=getpixel(pict, 1, 1) >>>print pixel2 Pixel, color=color r=214 g=165 b=132 >>>print getx(pixel2) 1 >>>print gety(pixel2) 1 >>>print getred(pixel2)

17 >>>color=getcolor(pixel2) >>>print color color r=214 g=165 b=132 >>>newcolor=makecolor(0, 100, 0) >>>print newcolor color r=0 g=100 b=0 >>>setcolor(pixel2, newcolor) >>>print getcolor(pixel2) color r=0 g=100 b=0 >>>show(pict) 17

18 A bit more yellow If we want to set the colors of five adjacent pixels to yellow, we could do the following: def ABitYellow(): file=pickafile() pict=makepicture(file) show(pict) setcolor(getpixel(pict, 11, 100), yellow) setcolor(getpixel(pict, 11, 101), yellow) setcolor(getpixel(pict, 11, 102), yellow) setcolor(getpixel(pict, 11, 103), yellow) setcolor(getpixel(pict, 11, 104), yellow) repaint(pict) show(pict) It is clear that the above is just a sequential structure. Let s check out if it works. 18

19 How to work on the whole thing? We often want to process the whole picture, i.e., all the pixels. It will be pretty boring, even impossible, to process one pixel at a time, for 10,000 pixels. Now, the iterative structure kicks right in, which takes over the boring part. For example, we can use the following program to make a picture less red. def decreasered(picture): for pixel in getpixels(picture): value = getred(pixel) setred(pixel, value*0.5) The above code, for all the pixels, one by one, gets the red component of its color, cuts it by half, then sends it back. Homework: 3.3,

20 A bit more details The key instruction in the above program is the following: for pixel in getpixels(picture): value = getred(pixel) setred(pixel, value*0.5) In the above the first line for pixel in getpixels(picture): specifies what data to process within the loop. Here we want to process all the pixels we may get out of the picture object picture. The variable name pixel refers to a value returned by the function getpixel, which is to get each and every pixel from the picture. Although we can use any name, such as p, x, y, etc to refer to a pixel, pixel looks pretty natural. 20

21 The loop structure Moreover, the word for in this first line indicates a loop. In fact, all the pixels are lined up in a sequence, all the pixels in the first line, followed by all in the second line,..., followed by all the pixels in the last line. With the for loop, all the pixels will be taken in in this order: the loop begins with the first one, do something with it, then moves to the next pixel, do exactly the same thing,..., until it gets the last pixel, do the same thing, and quits. Question: How does the computer know what to do with a pixel when it is taken in? Answer: The next part takes care of it. 21

22 The loop body The next segment is the loop body. value = getred(pixel) setred(pixel, value*0.5) This part tells what to do in each iteration of this loop. For this specific example, it states that, for each value of pixel, or for each pixel, we want to get out its red component, chop it off by 50%, then set this value back. This is equivalent to say we decrease the red component of each pixel by half. Let s see what it does. 22

23 How does it work? Below is the original picture of a fish pond: Now the changed picture Homework: 3.2,

24 Take out the blue We can also clear away the blue component of all the pixels, by setting the blue component of all the pictures to 0, as follows: def clearblue(picture): for p in getpixels(picture): setblue(p, 0) Question: What will the picture look like? Answer: Let s see. Homework: 3.7 and

25 Add something on It is pretty easy to use Python to do some image doctoring. For example, we might want to add a sunset effect to a beach picture, using the following code. def makesunset(picture): for p in getpixels(picture): value=getblue(p) setblue(p, value*0.7) value=getgreen(p) setgreen(p, value*0.7) The idea is to take off 30% of the blue and green to let the red stand out. Let s see what it does to a picture. Question: What happens if we simply add on more red, rather than taking off both green and blue, say, by 30%? Homework:

26 Add a bit sunshine Below is the original picture of a beach: and the same one at sunset: 26

27 An alternative way An important concept in programming is called modular programming, which means that one function does one and only one thing. Thus, we might solve the sunset problem as follows: def makesunset(picture): reduceblue(picture) reducegreen(picture) def reduceblue(picture): for p in getpixels(picture): value=getblue(p) setblue(p, value*0.7) def reducegreen(picture): for p in getpixels(picture): value=getgreen(p) setblue(p, value*0.7) 27

28 A couple of notes 1. We call such an idea hierarchical decomposition, or divide and conquer. This is a pretty useful concept. To solve something big and/or complicated, we cut it into a bunch of smaller and/or easier ones, solve them one by one, and then combine the solution. 2. Although the same name p occurs in all the three functions, they have nothing to do with each other. They are local in each function. 3. The three functions constitute one program, thus, they should be entered in the same file, and get loaded together. 28

29 Python also provides two functions, makelighter and makedarker that lighten and darken the color of a pixel, respectively. Below shows a program that makes use of the makelighter feature. def lighten(picture): for px in getpixels(picture): color=getcolor(px) makelighter(color) setcolor(px, color) 29

30 Create a negative image It is pretty easy to write a program to get the negative image of a picture object, as follows. It simply get the negative value of the color of each and every pixel of the involved picture. def negative(picture): for px in getpixels(picture): red=getred(px) green=getgreen(px) blue=getblue(px) negcolor=makecolor(255-red,255-green,255-blue) setcolor(px, negcolor) 30

31 Convert to grayscale Nowadays, when we take a picture, we often use a color camera. But, sometimes we really miss the old-fashioned black-and-white picture. It turns out pretty easy to do such a conversion if you have digitized that picture. What we could do is to average the three color components for all the pixels as follows: def grayscale1(picture): for px in getpixels(picture): in=(getred(px)+getgreen(px)+getblue(px))/3 setcolor(px, makecolor(in, in, in)) It does work, but it turns out that we could do better, if we take into consideration that we perceives blue to be darker than red, even if they share the same amount. Thus, we should give blue less weight, and more to red, and even more to green, when calculating the average. 31

32 A better way We thus come to the following revised program for the gray scale conversion. def grayscale(picture): for px in getpixels(picture): newred=getred(px)*0.299 newgreen=getgreen(px)*0.587 newblue=getblue(px)*0.114 luminance = newred+newgreen+newblue setcolor(px, makecolor (luminance, luminance, luminance)) Homework: 3.9 and

Picture Encoding and Manipulation. We perceive light different from how it actually is

Picture Encoding and Manipulation. We perceive light different from how it actually is Picture Encoding and Manipulation We perceive light different from how it actually is Color is continuous Visible light is wavelengths between 370 and 730 nm That s 0.00000037 and 0.00000073 meters But

More information

Review of concepts. What is a variable? Storage space to keep data used in our programs Variables have a name And also a type Example:

Review of concepts. What is a variable? Storage space to keep data used in our programs Variables have a name And also a type Example: Chapter 3 For Loops Review of concepts What is a variable? Storage space to keep data used in our programs Variables have a name And also a type Example: Age = 19 CourseTitle = CS140 In this course we

More information

Introduction to Programming. My first red-eye removal

Introduction to Programming. My first red-eye removal + Introduction to Programming My first red-eye removal + What most schools don t teach https://www.youtube.com/watch? v=nkiu9yen5nc The hour of code https://www.youtube.com/watch? v=fc5fbmsh4fw If 'coding'

More information

Working with Images: Global vs. Local Operations

Working with Images: Global vs. Local Operations Processing Digital Images Working with Images: Global vs. Local Operations CSC121, Introduction to Computer Programming ORIGINAL IMAGE DIGITAL FILTER digital images are often processed using digital filters

More information

CS 100 Introduction to Computer Science Solutions to Final Sample Questions, Fall 2015

CS 100 Introduction to Computer Science Solutions to Final Sample Questions, Fall 2015 Introduction to Computer Science Solutions to Final Sample Questions, Fall 2015 1. For each of the following pieces of code, indicate what color p would have at the end of the code if it is black when

More information

CS 100 Introduction to Computer Science Final Sample Questions, Fall 2015

CS 100 Introduction to Computer Science Final Sample Questions, Fall 2015 Introduction to Computer Science Final Sample Questions, Fall 2015 1. For each of the following pieces of code, indicate what color p would have at the end of the code if it is black when the code starts.

More information

Exercise NMCGJ: Image Processing

Exercise NMCGJ: Image Processing Exercise NMCGJ: Image Processing A digital picture (or image) is internally stored as an array or a matrix of pixels (= picture elements), each of them containing a specific color. This exercise is devoted

More information

Image Perception & 2D Images

Image Perception & 2D Images Image Perception & 2D Images Vision is a matter of perception. Perception is a matter of vision. ES Overview Introduction to ES 2D Graphics in Entertainment Systems Sound, Speech & Music 3D Graphics in

More information

Image Representation and Processing

Image Representation and Processing Image Representation and Processing cs4: Computer Science Bootcamp Çetin Kaya Koç cetinkoc@ucsb.edu Çetin Kaya Koç http://koclab.org Summer 2018 1 / 22 Pixel A pixel, a picture element, is the smallest

More information

Working with Images: Special Effects

Working with Images: Special Effects Power of Choice Working with Images: Special Effects CSC121, Introduction to Computer Programming conditional processing is a powerful tool for creating special effects with digital images choosing alternative

More information

2. Color spaces Introduction The RGB color space

2. Color spaces Introduction The RGB color space Image Processing - Lab 2: Color spaces 1 2. Color spaces 2.1. Introduction The purpose of the second laboratory work is to teach the basic color manipulation techniques, applied to the bitmap digital images.

More information

YIQ color model. Used in United States commercial TV broadcasting (NTSC system).

YIQ color model. Used in United States commercial TV broadcasting (NTSC system). CMY color model Each color is represented by the three secondary colors --- cyan (C), magenta (M), and yellow (Y ). It is mainly used in devices such as color printers that deposit color pigments. It is

More information

CSE1710. Big Picture. Reminder

CSE1710. Big Picture. Reminder CSE1710 Click to edit Master Week text 10, styles Lecture 19 Second level Third level Fourth level Fifth level Fall 2013 Thursday, Nov 14, 2013 1 Big Picture For the next three class meetings, we will

More information

Chapter 8. Representing Multimedia Digitally

Chapter 8. Representing Multimedia Digitally Chapter 8 Representing Multimedia Digitally Learning Objectives Explain how RGB color is represented in bytes Explain the difference between bits and binary numbers Change an RGB color by binary addition

More information

Black and White Photoshop Conversion Techniques

Black and White Photoshop Conversion Techniques Black and White Photoshop Conversion Techniques Andrew Gibson on Jan 27th 2011 Final Product What You'll Be Creating A quick glance through any photography or fashion magazine, or at the photos on social

More information

Brief Introduction to Vision and Images

Brief Introduction to Vision and Images Brief Introduction to Vision and Images Charles S. Tritt, Ph.D. January 24, 2012 Version 1.1 Structure of the Retina There is only one kind of rod. Rods are very sensitive and used mainly in dim light.

More information

Compression and Image Formats

Compression and Image Formats Compression Compression and Image Formats Reduce amount of data used to represent an image/video Bit rate and quality requirements Necessary to facilitate transmission and storage Required quality is application

More information

Introduction to Color Theory

Introduction to Color Theory Systems & Biomedical Engineering Department SBE 306B: Computer Systems III (Computer Graphics) Dr. Ayman Eldeib Spring 2018 Introduction to With colors you can set a mood, attract attention, or make a

More information

Removing Red Eye. Removing Red Eye

Removing Red Eye. Removing Red Eye 2 Removing Red Eye When the flash of the camera catches the eye just right (especially with light colored eyes), we get bounce back from the back of the retina. This results in red eye We can replace the

More information

Computers and Imaging

Computers and Imaging Computers and Imaging Telecommunications 1 P. Mathys Two Different Methods Vector or object-oriented graphics. Images are generated by mathematical descriptions of line (vector) segments. Bitmap or raster

More information

Colors in Images & Video

Colors in Images & Video LECTURE 8 Colors in Images & Video CS 5513 Multimedia Systems Spring 2009 Imran Ihsan Principal Design Consultant OPUSVII www.opuseven.com Faculty of Engineering & Applied Sciences 1. Light and Spectra

More information

CSE1710. Big Picture. Reminder

CSE1710. Big Picture. Reminder CSE1710 Click to edit Master Week text 09, styles Lecture 17 Second level Third level Fourth level Fifth level Fall 2013! Thursday, Nov 6, 2014 1 Big Picture For the next three class meetings, we will

More information

UWCSE BRIDGE. August 4-5, 2008

UWCSE BRIDGE. August 4-5, 2008 UWCSE BRIDGE Workshop August 4-5, 2008 Hal Perkins Computer Science & Engineering University of Washington perkins@cs.washington.edu What s Up? In two afternoons: Learn how to write programs in Python

More information

Computer Programming

Computer Programming Computer Programming Dr. Deepak B Phatak Dr. Supratik Chakraborty Department of Computer Science and Engineering Session: Digital Images and Histograms Dr. Deepak B. Phatak & Dr. Supratik Chakraborty,

More information

Color Theory: Defining Brown

Color Theory: Defining Brown Color Theory: Defining Brown Defining Colors Colors can be defined in many different ways. Computer users are often familiar with colors defined as percentages or amounts of red, green, and blue (RGB).

More information

In order to manage and correct color photos, you need to understand a few

In order to manage and correct color photos, you need to understand a few In This Chapter 1 Understanding Color Getting the essentials of managing color Speaking the language of color Mixing three hues into millions of colors Choosing the right color mode for your image Switching

More information

Additive Color Synthesis

Additive Color Synthesis Color Systems Defining Colors for Digital Image Processing Various models exist that attempt to describe color numerically. An ideal model should be able to record all theoretically visible colors in the

More information

LECTURE 07 COLORS IN IMAGES & VIDEO

LECTURE 07 COLORS IN IMAGES & VIDEO MULTIMEDIA TECHNOLOGIES LECTURE 07 COLORS IN IMAGES & VIDEO IMRAN IHSAN ASSISTANT PROFESSOR LIGHT AND SPECTRA Visible light is an electromagnetic wave in the 400nm 700 nm range. The eye is basically similar

More information

Color. Chapter 6. (colour) Digital Multimedia, 2nd edition

Color. Chapter 6. (colour) Digital Multimedia, 2nd edition Color (colour) Chapter 6 Digital Multimedia, 2nd edition What is color? Color is how our eyes perceive different forms of energy. Energy moves in the form of waves. What is a wave? Think of a fat guy (Dr.

More information

Images and Colour COSC342. Lecture 2 2 March 2015

Images and Colour COSC342. Lecture 2 2 March 2015 Images and Colour COSC342 Lecture 2 2 March 2015 In this Lecture Images and image formats Digital images in the computer Image compression and formats Colour representation Colour perception Colour spaces

More information

Digitizing Color. Place Value in a Decimal Number. Place Value in a Binary Number. Chapter 11: Light, Sound, Magic: Representing Multimedia Digitally

Digitizing Color. Place Value in a Decimal Number. Place Value in a Binary Number. Chapter 11: Light, Sound, Magic: Representing Multimedia Digitally Chapter 11: Light, Sound, Magic: Representing Multimedia Digitally Fluency with Information Technology Third Edition by Lawrence Snyder Digitizing Color RGB Colors: Binary Representation Giving the intensities

More information

Digital Images. CCST9015 Oct 13, 2010 Hayden Kwok-Hay So

Digital Images. CCST9015 Oct 13, 2010 Hayden Kwok-Hay So Digital Images CCST9015 Oct 13, 2010 Hayden Kwok-Hay So 1983 Oct 13, 2010 2006 Digital Images - CCST9015 - H. So 2 Demystifying Digital Images Representation Hardware Processing 3 Representing Images R

More information

RGB COLORS. Connecting with Computer Science cs.ubc.ca/~hoos/cpsc101

RGB COLORS. Connecting with Computer Science cs.ubc.ca/~hoos/cpsc101 RGB COLORS Clicker Question How many numbers are commonly used to specify the colour of a pixel? A. 1 B. 2 C. 3 D. 4 or more 2 Yellow = R + G? Combining red and green makes yellow Taught in elementary

More information

Computer Graphics. Si Lu. Fall er_graphics.htm 10/02/2015

Computer Graphics. Si Lu. Fall er_graphics.htm 10/02/2015 Computer Graphics Si Lu Fall 2017 http://www.cs.pdx.edu/~lusi/cs447/cs447_547_comput er_graphics.htm 10/02/2015 1 Announcements Free Textbook: Linear Algebra By Jim Hefferon http://joshua.smcvt.edu/linalg.html/

More information

Wireless Communication

Wireless Communication Wireless Communication Systems @CS.NCTU Lecture 4: Color Instructor: Kate Ching-Ju Lin ( 林靖茹 ) Chap. 4 of Fundamentals of Multimedia Some reference from http://media.ee.ntu.edu.tw/courses/dvt/15f/ 1 Outline

More information

Stamp Colors. Towards a Stamp-Oriented Color Guide: Objectifying Classification by Color. John M. Cibulskis, Ph.D. November 18-19, 2015

Stamp Colors. Towards a Stamp-Oriented Color Guide: Objectifying Classification by Color. John M. Cibulskis, Ph.D. November 18-19, 2015 Stamp Colors Towards a Stamp-Oriented Color Guide: Objectifying Classification by Color John M. Cibulskis, Ph.D. November 18-19, 2015 Two Views of Color Varieties The Color is the Thing: Different inks

More information

Human Vision, Color and Basic Image Processing

Human Vision, Color and Basic Image Processing Human Vision, Color and Basic Image Processing Connelly Barnes CS4810 University of Virginia Acknowledgement: slides by Jason Lawrence, Misha Kazhdan, Allison Klein, Tom Funkhouser, Adam Finkelstein and

More information

5/17/2009. Digitizing Color. Place Value in a Binary Number. Place Value in a Decimal Number. Place Value in a Binary Number

5/17/2009. Digitizing Color. Place Value in a Binary Number. Place Value in a Decimal Number. Place Value in a Binary Number Chapter 11: Light, Sound, Magic: Representing Multimedia Digitally Digitizing Color Fluency with Information Technology Third Edition by Lawrence Snyder RGB Colors: Binary Representation Giving the intensities

More information

Digital Images. Back to top-level. Digital Images. Back to top-level Representing Images. Dr. Hayden Kwok-Hay So ENGG st semester, 2010

Digital Images. Back to top-level. Digital Images. Back to top-level Representing Images. Dr. Hayden Kwok-Hay So ENGG st semester, 2010 0.9.4 Back to top-level High Level Digital Images ENGG05 st This week Semester, 00 Dr. Hayden Kwok-Hay So Department of Electrical and Electronic Engineering Low Level Applications Image & Video Processing

More information

4/9/2015. Simple Graphics and Image Processing. Simple Graphics. Overview of Turtle Graphics (continued) Overview of Turtle Graphics

4/9/2015. Simple Graphics and Image Processing. Simple Graphics. Overview of Turtle Graphics (continued) Overview of Turtle Graphics Simple Graphics and Image Processing The Plan For Today Website Updates Intro to Python Quiz Corrections Missing Assignments Graphics and Images Simple Graphics Turtle Graphics Image Processing Assignment

More information

Title goes Shadows and here Highlights

Title goes Shadows and here Highlights Shadows Title goes and Highlights here The new Shadows and Highlights command in Photoshop CS (8) is a great new tool that will allow you to adjust the shadow areas of an image while leaving the highlights

More information

Digital Image Processing. Lecture # 8 Color Processing

Digital Image Processing. Lecture # 8 Color Processing Digital Image Processing Lecture # 8 Color Processing 1 COLOR IMAGE PROCESSING COLOR IMAGE PROCESSING Color Importance Color is an excellent descriptor Suitable for object Identification and Extraction

More information

2. Color spaces Introduction The RGB color space

2. Color spaces Introduction The RGB color space 1 Image Processing - Lab 2: Color spaces 2. Color spaces 2.1. Introduction The purpose of the second laboratory work is to teach the basic color manipulation techniques, applied to the bitmap digital images.

More information

Color Transformations

Color Transformations Color Transformations It is useful to think of a color image as a vector valued image, where each pixel has associated with it, as vector of three values. Each components of this vector corresponds to

More information

Introduction. The Spectral Basis for Color

Introduction. The Spectral Basis for Color Introduction Color is an extremely important part of most visualizations. Choosing good colors for your visualizations involves understanding their properties and the perceptual characteristics of human

More information

You Know More Than You Think ;) 3/6/18 Matni, CS8, Wi18 1

You Know More Than You Think ;) 3/6/18 Matni, CS8, Wi18 1 You Know More Than You Think ;) 3/6/18 Matni, CS8, Wi18 1 Digital Images in Python While Loops CS 8: Introduction to Computer Science, Winter 2018 Lecture #13 Ziad Matni Dept. of Computer Science, UCSB

More information

Computer Graphics: Graphics Output Primitives Primitives Attributes

Computer Graphics: Graphics Output Primitives Primitives Attributes Computer Graphics: Graphics Output Primitives Primitives Attributes By: A. H. Abdul Hafez Abdul.hafez@hku.edu.tr, 1 Outlines 1. OpenGL state variables 2. RGB color components 1. direct color storage 2.

More information

Dr. Shahanawaj Ahamad. Dr. S.Ahamad, SWE-423, Unit-06

Dr. Shahanawaj Ahamad. Dr. S.Ahamad, SWE-423, Unit-06 Dr. Shahanawaj Ahamad 1 Outline: Basic concepts underlying Images Popular Image File formats Human perception of color Various Color Models in use and the idea behind them 2 Pixels -- picture elements

More information

Sampling Rate = Resolution Quantization Level = Color Depth = Bit Depth = Number of Colors

Sampling Rate = Resolution Quantization Level = Color Depth = Bit Depth = Number of Colors ITEC2110 FALL 2011 TEST 2 REVIEW Chapters 2-3: Images I. Concepts Graphics A. Bitmaps and Vector Representations Logical vs. Physical Pixels - Images are modeled internally as an array of pixel values

More information

PHOTOSHOP. pixel based image editing software (pixel=picture element) several small dots or pixels make up an image.

PHOTOSHOP. pixel based image editing software (pixel=picture element) several small dots or pixels make up an image. Photoshop PHOTOSHOP pixel based image editing software (pixel=picture element) several small dots or pixels make up an image. RESOLUTION measurement of the total number of pixels displayed determines the

More information

Prof. Feng Liu. Fall /02/2018

Prof. Feng Liu. Fall /02/2018 Prof. Feng Liu Fall 2018 http://www.cs.pdx.edu/~fliu/courses/cs447/ 10/02/2018 1 Announcements Free Textbook: Linear Algebra By Jim Hefferon http://joshua.smcvt.edu/linalg.html/ Homework 1 due in class

More information

12 Color Models and Color Applications. Chapter 12. Color Models and Color Applications. Department of Computer Science and Engineering 12-1

12 Color Models and Color Applications. Chapter 12. Color Models and Color Applications. Department of Computer Science and Engineering 12-1 Chapter 12 Color Models and Color Applications 12-1 12.1 Overview Color plays a significant role in achieving realistic computer graphic renderings. This chapter describes the quantitative aspects of color,

More information

Image processing & Computer vision Xử lí ảnh và thị giác máy tính

Image processing & Computer vision Xử lí ảnh và thị giác máy tính Image processing & Computer vision Xử lí ảnh và thị giác máy tính Color Alain Boucher - IFI Introduction To be able to see objects and a scene, we need light Otherwise, everything is black How does behave

More information

Multimedia Systems Color Space Mahdi Amiri March 2012 Sharif University of Technology

Multimedia Systems Color Space Mahdi Amiri March 2012 Sharif University of Technology Course Presentation Multimedia Systems Color Space Mahdi Amiri March 2012 Sharif University of Technology Physics of Color Light Light or visible light is the portion of electromagnetic radiation that

More information

Technology and digital images

Technology and digital images Technology and digital images Objectives Describe how the characteristics and behaviors of white light allow us to see colored objects. Describe the connection between physics and technology. Describe

More information

Digital Image Processing. Lecture # 6 Corner Detection & Color Processing

Digital Image Processing. Lecture # 6 Corner Detection & Color Processing Digital Image Processing Lecture # 6 Corner Detection & Color Processing 1 Corners Corners (interest points) Unlike edges, corners (patches of pixels surrounding the corner) do not necessarily correspond

More information

Figure 1: Energy Distributions for light

Figure 1: Energy Distributions for light Lecture 4: Colour The physical description of colour Colour vision is a very complicated biological and psychological phenomenon. It can be described in many different ways, including by physics, by subjective

More information

Color. Used heavily in human vision. Color is a pixel property, making some recognition problems easy

Color. Used heavily in human vision. Color is a pixel property, making some recognition problems easy Color Used heavily in human vision Color is a pixel property, making some recognition problems easy Visible spectrum for humans is 400 nm (blue) to 700 nm (red) Machines can see much more; ex. X-rays,

More information

Color and More. Color basics

Color and More. Color basics Color and More In this lesson, you'll evaluate an image in terms of its overall tonal range (lightness, darkness, and contrast), its overall balance of color, and its overall appearance for areas that

More information

Color: Readings: Ch 6: color spaces color histograms color segmentation

Color: Readings: Ch 6: color spaces color histograms color segmentation Color: Readings: Ch 6: 6.1-6.5 color spaces color histograms color segmentation 1 Some Properties of Color Color is used heavily in human vision. Color is a pixel property, that can make some recognition

More information

Mahdi Amiri. March Sharif University of Technology

Mahdi Amiri. March Sharif University of Technology Course Presentation Multimedia Systems Color Space Mahdi Amiri March 2014 Sharif University of Technology The wavelength λ of a sinusoidal waveform traveling at constant speed ν is given by Physics of

More information

Implementation of Colored Visual Cryptography for Generating Digital and Physical Shares

Implementation of Colored Visual Cryptography for Generating Digital and Physical Shares Implementation of Colored Visual Cryptography for Generating Digital and Physical Shares Ahmad Zaky 13512076 1 Program Studi Teknik Informatika Sekolah Teknik Elektro dan Informatika Institut Teknologi

More information

Chapter 3 Part 2 Color image processing

Chapter 3 Part 2 Color image processing Chapter 3 Part 2 Color image processing Motivation Color fundamentals Color models Pseudocolor image processing Full-color image processing: Component-wise Vector-based Recent and current work Spring 2002

More information

Digital Image Processing Color Models &Processing

Digital Image Processing Color Models &Processing Digital Image Processing Color Models &Processing Dr. Hatem Elaydi Electrical Engineering Department Islamic University of Gaza Fall 2015 Nov 16, 2015 Color interpretation Color spectrum vs. electromagnetic

More information

Introduction to computer vision. Image Color Conversion. CIE Chromaticity Diagram and Color Gamut. Color Models

Introduction to computer vision. Image Color Conversion. CIE Chromaticity Diagram and Color Gamut. Color Models Introduction to computer vision In general, computer vision covers very wide area of issues concerning understanding of images by computers. It may be considered as a part of artificial intelligence and

More information

ENGG1015 Digital Images

ENGG1015 Digital Images ENGG1015 Digital Images 1 st Semester, 2011 Dr Edmund Lam Department of Electrical and Electronic Engineering The content in this lecture is based substan1ally on last year s from Dr Hayden So, but all

More information

DESIGN & DEVELOPMENT OF COLOR MATCHING ALGORITHM FOR IMAGE RETRIEVAL USING HISTOGRAM AND SEGMENTATION TECHNIQUES

DESIGN & DEVELOPMENT OF COLOR MATCHING ALGORITHM FOR IMAGE RETRIEVAL USING HISTOGRAM AND SEGMENTATION TECHNIQUES International Journal of Information Technology and Knowledge Management July-December 2011, Volume 4, No. 2, pp. 585-589 DESIGN & DEVELOPMENT OF COLOR MATCHING ALGORITHM FOR IMAGE RETRIEVAL USING HISTOGRAM

More information

This Color Quality guide helps users understand how operations available on the printer can be used to adjust and customize color output.

This Color Quality guide helps users understand how operations available on the printer can be used to adjust and customize color output. Page 1 of 7 Color quality guide This Color Quality guide helps users understand how operations available on the printer can be used to adjust and customize color output. Quality Menu Selections available

More information

Color & Compression. Robin Strand Centre for Image analysis Swedish University of Agricultural Sciences Uppsala University

Color & Compression. Robin Strand Centre for Image analysis Swedish University of Agricultural Sciences Uppsala University Color & Compression Robin Strand Centre for Image analysis Swedish University of Agricultural Sciences Uppsala University Outline Color Color spaces Multispectral images Pseudocoloring Color image processing

More information

Sampling and Reconstruction. Today: Color Theory. Color Theory COMP575

Sampling and Reconstruction. Today: Color Theory. Color Theory COMP575 and COMP575 Today: Finish up Color Color Theory CIE XYZ color space 3 color matching functions: X, Y, Z Y is luminance X and Z are color values WP user acdx Color Theory xyy color space Since Y is luminance,

More information

Color Image Processing

Color Image Processing Color Image Processing Selim Aksoy Department of Computer Engineering Bilkent University saksoy@cs.bilkent.edu.tr Color Used heavily in human vision. Visible spectrum for humans is 400 nm (blue) to 700

More information

Bettina Selig. Centre for Image Analysis. Swedish University of Agricultural Sciences Uppsala University

Bettina Selig. Centre for Image Analysis. Swedish University of Agricultural Sciences Uppsala University 2011-10-26 Bettina Selig Centre for Image Analysis Swedish University of Agricultural Sciences Uppsala University 2 Electromagnetic Radiation Illumination - Reflection - Detection The Human Eye Digital

More information

Chapter 3 Graphics and Image Data Representations

Chapter 3 Graphics and Image Data Representations Chapter 3 Graphics and Image Data Representations 3.1 Graphics/Image Data Types 3.2 Popular File Formats 3.3 Further Exploration 1 Li & Drew c Prentice Hall 2003 3.1 Graphics/Image Data Types The number

More information

Computer Science 1 (1021) -- Spring 2013 Lab 2 & Homework 1 Image Manipulation I. Topics covered: Loops, Color, Brightness, and Contrast

Computer Science 1 (1021) -- Spring 2013 Lab 2 & Homework 1 Image Manipulation I. Topics covered: Loops, Color, Brightness, and Contrast Computer Science 1 (1021) -- Spring 2013 Lab 2 & Homework 1 Image Manipulation I Topics covered: Loops, Color, Brightness, and Contrast Lab due end of lab Jan16, 2013, HW due in class Jan 23 Each student

More information

Brightness Calculation in Digital Image Processing

Brightness Calculation in Digital Image Processing Brightness Calculation in Digital Image Processing Sergey Bezryadin, Pavel Bourov*, Dmitry Ilinih*; KWE Int.Inc., San Francisco, CA, USA; *UniqueIC s, Saratov, Russia Abstract Brightness is one of the

More information

Fig Color spectrum seen by passing white light through a prism.

Fig Color spectrum seen by passing white light through a prism. 1. Explain about color fundamentals. Color of an object is determined by the nature of the light reflected from it. When a beam of sunlight passes through a glass prism, the emerging beam of light is not

More information

Image Processing & Perception

Image Processing & Perception Image Processing & Perception Seeing is believing. : Proverb Your robot has a small digital camera that can be used to take pictures. A picture taken by a digital camera is represented as an image. As

More information

MATLAB Image Processing Toolbox

MATLAB Image Processing Toolbox MATLAB Image Processing Toolbox Copyright: Mathworks 1998. The following is taken from the Matlab Image Processing Toolbox users guide. A complete online manual is availabe in the PDF form (about 5MB).

More information

Assistant Lecturer Sama S. Samaan

Assistant Lecturer Sama S. Samaan MP3 Not only does MPEG define how video is compressed, but it also defines a standard for compressing audio. This standard can be used to compress the audio portion of a movie (in which case the MPEG standard

More information

Correction Techniques

Correction Techniques 10 Advanced Color Correction Techniques Learning Objectives After completing this chapter, you will be able to: Explain how a computer monitor displays color. Describe how color is created in the printing

More information

Color Balancing Techniques

Color Balancing Techniques Written by Jonathan Sachs Copyright 1996-2007 Digital Light & Color Introduction Color balancing refers to the process of removing an overall color bias from an image. For example, if an image appears

More information

6 Color Image Processing

6 Color Image Processing 6 Color Image Processing Angela Chih-Wei Tang ( 唐之瑋 ) Department of Communication Engineering National Central University JhongLi, Taiwan 2009 Fall Outline Color fundamentals Color models Pseudocolor image

More information

LECTURE 02 IMAGE AND GRAPHICS

LECTURE 02 IMAGE AND GRAPHICS MULTIMEDIA TECHNOLOGIES LECTURE 02 IMAGE AND GRAPHICS IMRAN IHSAN ASSISTANT PROFESSOR THE NATURE OF DIGITAL IMAGES An image is a spatial representation of an object, a two dimensional or three-dimensional

More information

CHAPTER 3 I M A G E S

CHAPTER 3 I M A G E S CHAPTER 3 I M A G E S OBJECTIVES Discuss the various factors that apply to the use of images in multimedia. Describe the capabilities and limitations of bitmap images. Describe the capabilities and limitations

More information

Image Representation using RGB Color Space

Image Representation using RGB Color Space ISSN 2278 0211 (Online) Image Representation using RGB Color Space Bernard Alala Department of Computing, Jomo Kenyatta University of Agriculture and Technology, Kenya Waweru Mwangi Department of Computing,

More information

COLOR AS A DESIGN ELEMENT

COLOR AS A DESIGN ELEMENT COLOR COLOR AS A DESIGN ELEMENT Color is one of the most important elements of design. It can evoke action and emotion. It can attract or detract attention. I. COLOR SETS COLOR HARMONY Color Harmony occurs

More information

1 Li & Drew c Prentice Hall Li & Drew c Prentice Hall 2003

1 Li & Drew c Prentice Hall Li & Drew c Prentice Hall 2003 Chapter 3 Graphics and Image Data Representations 3.1 Graphics/Image Data Types 3.2 Popular File Formats 3.3 Further Exploration 3.1 Graphics/Image Data Types The number of file formats used in multimedia

More information

IMAGE PROCESSING >COLOR SPACES UTRECHT UNIVERSITY RONALD POPPE

IMAGE PROCESSING >COLOR SPACES UTRECHT UNIVERSITY RONALD POPPE IMAGE PROCESSING >COLOR SPACES UTRECHT UNIVERSITY RONALD POPPE OUTLINE Human visual system Color images Color quantization Colorimetric color spaces HUMAN VISUAL SYSTEM HUMAN VISUAL SYSTEM HUMAN VISUAL

More information

Pictures and Arrays. You have been returned to where you were last working. Return to syllabus Edit preferences

Pictures and Arrays. You have been returned to where you were last working. Return to syllabus Edit preferences Media Programming in One Month ANJILAIAH TUDUM - Sign Out My Courses Help More You have been returned to where you were last working. Return to syllabus Edit preferences MODULE 1: VARIABLES, OPERATORS

More information

Color Image Processing

Color Image Processing Color Image Processing Dr. Praveen Sankaran Department of ECE NIT Calicut February 11, 2013 Winter 2013 February 11, 2013 1 / 23 Outline 1 Color Models 2 Full Color Image Processing Winter 2013 February

More information

Subjective evaluation of image color damage based on JPEG compression

Subjective evaluation of image color damage based on JPEG compression 2014 Fourth International Conference on Communication Systems and Network Technologies Subjective evaluation of image color damage based on JPEG compression Xiaoqiang He Information Engineering School

More information

Image and video processing (EBU723U) Colour Images. Dr. Yi-Zhe Song

Image and video processing (EBU723U) Colour Images. Dr. Yi-Zhe Song Image and video processing () Colour Images Dr. Yi-Zhe Song yizhe.song@qmul.ac.uk Today s agenda Colour spaces Colour images PGM/PPM images Today s agenda Colour spaces Colour images PGM/PPM images History

More information

Color. Used heavily in human vision. Color is a pixel property, making some recognition problems easy

Color. Used heavily in human vision. Color is a pixel property, making some recognition problems easy Color Used heavily in human vision Color is a pixel property, making some recognition problems easy Visible spectrum for humans is 400 nm (blue) to 700 nm (red) Machines can see much more; ex. X-rays,

More information

Bitmap Image Formats

Bitmap Image Formats LECTURE 5 Bitmap Image Formats CS 5513 Multimedia Systems Spring 2009 Imran Ihsan Principal Design Consultant OPUSVII www.opuseven.com Faculty of Engineering & Applied Sciences 1. Image Formats To store

More information

ImagesPlus Basic Interface Operation

ImagesPlus Basic Interface Operation ImagesPlus Basic Interface Operation The basic interface operation menu options are located on the File, View, Open Images, Open Operators, and Help main menus. File Menu New The New command creates a

More information

Commercial Art 1 Photoshop Study Guide. 8) How is on-screen image resolution measured? PPI - Pixels Per Inch

Commercial Art 1 Photoshop Study Guide. 8) How is on-screen image resolution measured? PPI - Pixels Per Inch Commercial Art 1 Photoshop Study Guide To help prepare you for the Photoshop test, be sure you can answer the following questions: 1) What are the three things should you do when you first open a Photoshop

More information

IMAGE INTENSIFICATION TECHNIQUE USING HORIZONTAL SITUATION INDICATOR

IMAGE INTENSIFICATION TECHNIQUE USING HORIZONTAL SITUATION INDICATOR IMAGE INTENSIFICATION TECHNIQUE USING HORIZONTAL SITUATION INDICATOR Naveen Kumar Mandadi 1, B.Praveen Kumar 2, M.Nagaraju 3, 1,2,3 Assistant Professor, Department of ECE, SRTIST, Nalgonda (India) ABSTRACT

More information

Using Adobe Photoshop

Using Adobe Photoshop Using Adobe Photoshop 4 Colour is important in most art forms. For example, a painter needs to know how to select and mix colours to produce the right tones in a picture. A Photographer needs to understand

More information

Adventures in HSV Space Darrin Cardani

Adventures in HSV Space Darrin Cardani Adventures in HSV Space Darrin Cardani dcardani@buena.com Abstract: Describes how to convert RGB images into HSV space and why you would want to do so. It also describes some new techniques for choosing

More information

CS 262 Lecture 01: Digital Images and Video. John Magee Some material copyright Jones and Bartlett

CS 262 Lecture 01: Digital Images and Video. John Magee Some material copyright Jones and Bartlett CS 262 Lecture 01: Digital Images and Video John Magee Some material copyright Jones and Bartlett 1 Overview/Questions What is digital information? What is color? How do pictures get encoded into binary

More information