June 14, ‘99 COLORS IN MATLAB.

Slides:



Advertisements
Similar presentations
Introduction to arrays
Advertisements

Laboratory of Image Processing Pier Luigi Mazzeo
Book Scanning & Digital Image Production The VRC Guide to Imaging By Kate Stepp.
Chapter 14 Landsat 7 image of the retreating Malaspina Glacier, Alaska.
CGA 115 Professor Mary A. Malinconico. Questions from Last Week ????????
Computer Vision Chapter 6 Color.
School of Computing Science Simon Fraser University
Graphics File Formats. 2 Graphics Data n Vector data –Lines –Polygons –Curves n Bitmap data –Array of pixels –Numerical values corresponding to gray-
What is color for?.
USER VERIFICATION SYSTEM. Scope Web Interface RGB separation Pervasive.
Image Representation.
CSc 461/561 CSc 461/561 Multimedia Systems Part A: 2. Image.
Color of (digital image) Raed S. Rasheed Agenda Color. Color Image. Color Models – RGB color model. – CMYK color model. – HSV and HSL color model.
9/14/04© University of Wisconsin, CS559 Spring 2004 Last Time Intensity perception – the importance of ratios Dynamic Range – what it means and some of.
Colour Digital Multimedia, 2nd edition Nigel Chapman & Jenny Chapman
Digital Multimedia, 2nd edition Nigel Chapman & Jenny Chapman Chapter 6 This presentation © 2004, MacAvon Media Productions Colour.
 1999 BG Mobasseri1 8/29/2015 MATLAB GRAPHICS - PART II ADVANCED PLOTTING June 4, ‘99.
Digital Images The digital representation of visual information.
Creating scalars, vectors, matrices Ex1 & 2. Dot Product & Cross Product Ex3. Plotting Graphs Ex4. Conversion Table Ex5. Plotting functions Finishing Ex4.
CS 102 Computers In Context (Multimedia)‏ 01 / 28 / 2009 Instructor: Michael Eckmann.
Image Processing Lecture 2 - Gaurav Gupta - Shobhit Niranjan.
Computer Graphics Using “ Adobe Photoshop ” Introduction to E-Learning Center, DAD presents Workshop on Instructor: Mazhar.
Digital Images Chapter 8, Exploring the Digital Domain.
Color Management. How does the color work?  Spectrum Spectrum is a contiguous band of wavelengths, which is emitted, reflected or transmitted by different.
Image Processing & Perception Sec 9-11 Web Design.
Objective Understand concepts used to create digital graphics. Course Weight : 15% Part Three : Concepts of Digital Graphics.
I-1 Steps of Image Generation –Create a model of the objects –Create a model for the illumination of the objects –Create an image (render) the result I.
Colours and Computer Jimmy Lam The Hong Kong Polytechnic University.
1 © 2010 Cengage Learning Engineering. All Rights Reserved. 1 Introduction to Digital Image Processing with MATLAB ® Asia Edition McAndrew ‧ Wang ‧ Tseng.
Chapter 3 Space. Three Kinds of Space Space as format: size, scale, and presentation. Space as the relationships among objects and the areas surrounding.
Color. There are established models of color, each discipline uses it own method for describing and discussing color intelligently.
What are the five colors in the legend? Enter the information below (5 points) 0000FF = = FFFFFF = 00FF00 = FF0000 = Color Theory Legend: income.
Nov 061 Size Control How is a component’s size determined during layout and during resize operations? Three factors determine component sizes: The component’s.
Color. Contents Light and color The visible light spectrum Primary and secondary colors Color spaces –RGB, CMY, YIQ, HLS, CIE –CIE XYZ, CIE xyY and CIE.
MA/CS 3751 Fall 2002 Lecture 24. MA/CS 3752 ginput ginput is a Matlab function which takes one argument input: number of points to select in the image.
Vectors and Matrices In MATLAB a vector can be defined as row vector or as a column vector. A vector of length n can be visualized as matrix of size 1xn.
Graphics. Graphic is the important media used to show the appearance of integrative media applications. According to DBP dictionary, graphics mean drawing.
CS112 Scientific Computation Department of Computer Science Wellesley College Numb3rs Number and image types.
Image Representation. Digital Cameras Scanned Film & Photographs Digitized TV Signals Computer Graphics Radar & Sonar Medical Imaging Devices (X-Ray,
Digital Image Processing Lecture4: Fundamentals. Digital Image Representation An image can be defined as a two- dimensional function, f(x,y), where x.
A color model is a specification of a 3D color co-ordinate system and a visible subset in the co-ordinate System within all colors in a particular color.
Ch 6 Color Image processing CS446 Instructor: Nada ALZaben.
By: Ashley. Spot Color Spot color refers to the process of selecting text or a graphic object such as a circle and then adding a spot of color to it.
DIGITAL IMAGE. Basic Image Concepts An image is a spatial representation of an object An image can be thought of as a function with resulting values of.
Digital Image Processing In The Name Of God Digital Image Processing Lecture6: Color Image Processing M. Ghelich Oghli By: M. Ghelich Oghli
Recap Plots with More than one Line Plots of Complex Arrays Line, Color and Mark Style Axis Scaling and Annotating Plots Subplots Polar Plots Logarithmic.
Introduction to Computer Graphics
Color Web Design Professor Frank. Color Displays Based on cathode ray tubes (CRTs) or back- lighted flat-screen Monitors transmit light - displays use.
CS 101 – Sept. 14 Review Huffman code Image representation –B/W and color schemes –File size issues.
Intelligent Robotics Today: Vision & Time & Space Complexity.
R objects  All R entities exist as objects  They can all be operated on as data  We will cover:  Vectors  Factors  Lists  Data frames  Tables 
Image Representation Last update st March Heejune Ahn, SeoulTech.
Chapter 3 Color Objectives Identify the color systems and resolution Clarify category of colors.
© ExplorNet’s Centers for Quality Teaching and Learning 1 Objective % Understand concepts used to create digital graphics.
Computer Graphics: Achromatic and Coloured Light.
1 of 32 Computer Graphics Color. 2 of 32 Basics Of Color elements of color:
Objective % Explain design concepts used to create digital graphics.
John Federici NJIT Physics Department
Half Toning Dithering RGB CMYK Models
Design Concepts: Module A: The Science of Color
Images In Matlab.
Color Image Representation
Histogram—Representation of Color Feature in Image Processing Yang, Li
COMS 161 Introduction to Computing
Images Presentation Name Course Name Unit # – Lesson #.# – Lesson Name
Color Visualization in Matlab
Images Presentation Name Course Name Unit # – Lesson #.# – Lesson Name
Computer Graphics Module Overview
Non-numeric Data Representation
Objective % Explain design concepts used to create digital graphics.
Presentation transcript:

June 14, ‘99 COLORS IN MATLAB

UNDERSTANDING COLOR To understand color we must first understand color spaces We come in contact with color through: Video(computers,TV’s) Printed matter(magazines, brochures) Real World

ADDITIVE COLOR MODEL Formation of colors on video monitors is through an additive process of 3 color components Red Green Blue Concern is white balance, meaning how white is the white displayed on the monitor Color=w1*red+w2*green+w3*blue

RGB COLOR CUBE Cyan Green White 1 Yellow Color is represented by a point in the RGB cube Blue 1 1 Red Magenta

RGB CUBE

SUBTRACTIVE COLOR MODEL Color formation in printing industry is through the subtractive CMY model Cyan Magenta Yellow Challenge is black balance;to get real black Often black is added as the 4th color, CMYK

HUMAN COLOR MODEL The most accurate model here is hue, saturation and value(brightness) HSV white brightness saturation green red blue hue black

NET REFERENCE ON COLOR There is a comprehensive FAQ on color. You can reach it at http://www.inforamp.net/~poynton/Poynton- colour.html

UNDERSTANDING COLORMAPS At the heart of color control in MATLAB is the concept of colormap Colormap is a 3-column matrix with entries between 0 and 1. Each row defines a particular combination of (R,G,B) to define a color. black 1 1 magenta

FEW MATLAB’s COLORMAPS Image intensity maps to color

Try it! MATLAB comes with few images. To load one of them type load clown Now check your workspace. You will see image data stored in X and colormap stored in map To display the image type image(X) What’s wrong?

Digital image Before going on, let’s define a digital image. A digital image is simply a 2D matrix. Each element of the matrix, pixel, is an integer. For a black and white image pixels are between 0 (black) and 255(white) MATLAB’s matrix oriented structure makes minced meat out of images and image processing

Role of colormap Type out a few values of X. You will see integers. But what is the relationship between these numbers and their actual color? Enter colormap. Colormap is lookup table. It takes an intensity value, say 25, and connects it with some color. To display true colors, you must set monitor’s colormap to the map used at the time the image was created

WORKING WITH COLORMAPS Command colormap(map) sets the colormap to one of preset or user defined values For clown image ,type colormap(map) and watch the result. Now try these colormap(hot) colormap(hsv) colormap(gray)

RECALLING AND SETTING COLORMAPS Current colormap in effect can be found by map=colormap Any (3x1) matrix can be defined by the user and defined as the current colormap by colormap(usermap)

COLOR ASSIGNMENT How is intensity connected to color? last row highest Colormap Data Values maps to lowest first row

COLOR MAPPING RULE Let data range between Zmin and Zmax. Let the colormap rows k run from 1 to m. Then Zmin k=1, row 1 Zmax k=m, row m The middle Z’s follow a linear mapping rule.

Defining your first colormap Plot the peaks function using surf(peaks) Define a colormap, mymap, so that the first row is blue, the second row is green, third row is white and fourth row red. Then set MATLAB’s colormap to mymap. See code next

Try it! Interpret colors you see

ARBITRARY COLOR ASSIGNMENT Color mapping rule is simple: take the minimum of the function and assign it the color of the first row of colormap take the maximum of the function and assign it the color of last row of colormap in-between values take shades of color obtained by a linear mapping of the above two colors Next slide shows you more

ASSIGNING COLORS TO RANGES OF DATA This is what we want to do: assign blue to z<a assign red to z>b assign a continuous color tone(blue to red) for a<z<b b Z a

How to do it? clim property clim is a two element vector [cmin,cmax]. It can be set as follows set(gca, ‘clim’,[cmin cmax]) Colormapping is done as follows z<cmin ---->first row of colormap z>cmax ---->last row of colormap

Try it! Plot the peaks function and display it with view(90,0) Set cmin and cmax to [-2 2],[-3 3] and [-4 4] and see if you can explain the results?

MATLAB’S DEFAULT COLORMAP MATLAB’s default colormap is HSV and can be set via colormap(‘default’) or colormap(‘hsv’) Unless specified otherwise, colormaps are 64x3, i.e. 64 colors Other sizes can be specified, e.g. colormap(hot(128))

Try it! Plot the peaks function in the range(-4:0.2:4) and v=[90,0]. Go through hsv, hot, flag, copper etc. colormaps. Check map’s sizes ?

DEFINING YOUR OWN COLORMAP Want to display the peaks profile in only two colors. Negative values in red and positive values blue. Define a colormap for this purpose.

Pseudorandom color :pcolor Command pcolor(z) draws a rectangular grid of cells with colors determined by z; function height above each cell. Mapping from z to color is determined by colormap

OVERLAYING CONTOURS Do the following: get rid of the grid lines(try shading command) Superimpose black colored gridlines(lookup help on contour)

pcolor and colormap The following will display 32 bins of current colormap z=[1:32;1:32]’ pcolor(z)

WORKING WITH IMAGES A two dimensional image can be modeled by z=f(x,y) where (x,y) is the pixel position and z the corresponding height The height is then mapped to either a grayscale or color range

LOADING IMAGES Images are loaded like sound file. For example load clown Now check your workspace to see which variable is “clown” loaded in. Check the size of the image array and its min and max

DISPLAYING IMAGES There are a number of ways to display an image. For the start use image(z) z is the array your image is loaded in. Check Each element of z specifies the color of a rectangular patch in the image Elements of z are used as indices into the current colormap to determine the color

INDEXED IMAGES MATLAB supports a number of image formats one of which is “indexed” “intensities” in indexed images are not really intensities; they are simply entries into the colormap If image value at (x,y)=32, this simply means that pixel color at (x,y) comes from the row 32 of the colormap

Example of indexed image: clown When you loaded clown you got two arrays X: image data map:colormap Now check image value at position (100,100). I get 4. What color is this pixel?. MATLAB goes to the 4th row of map This row has 3 columns, red=0.29, green=0 and blue=0

How to display the color of a single pixel? In the previous slide we found out that X(100,100) has no green or blue component and is 29%red. But what color is it? Here is a way to do get it. Type image(X(100,100)) Is it what you expect?. Is it reddish?

PLAYING WITH COLORMAPS Unless a digital image is accompanied by a colormap, it is impossible to determine pixel colors Check the colormap that accompanies the loaded image; its size and its contents. Change the colormaps to hot, hsv, cool, gray and see the results

HOMEWORK Plot z=sin(sqrt(x^2+y^2)) in the range(-pi to pi)in increments of 0.2 Make the function appear red for z<-0.5, white for -0.5<z<0.5 and blue for z>0.5 Do the same except for making the colors between red and white follow 32 gradations of colormap hot