Principles of Computer Graphics and Image Processing Colors and Visual System (09) RNDr. Martin Madaras, PhD. martin.madaras@stuba.sk
Computer Graphics - Image Processing - Modeling - Rendering - Animation - Advanced Techniques 2
Computer Graphics - Image Processing Image Representation - - Modeling - Rendering - Animation - Advanced Techniques 3
Image Processing - Raster Graphics Image devices - Image representation - Human vision system - Colors - 4
Raster Graphics - Images What is an image? - How to capture images? - How to display images? - - Color What is a color? - How do we perceive the color? - How computers represent the color? - 5
Raster Graphics - Images What is an image? - How to capture images? - How to display images? - - Color What is a color? - How do we perceive the color? - How computers represent the color? - 6
How the lectures should look like #1 Ask questions, please!!! - Be communicative - www.slido.com #PPGSO09 - More active you are, the better for you! - 7
Frame Buffer 8
Color Mixing - Mixture of Red, Green and Blue 9
Color Display 10
Modern Displays LCD - liquid crystal display 11
Pixel PIxEL - Picture Element 12
Color Frame Buffer Each color intensity needs to be stored separately 13
Color Depth Bits per pixel determine image color depth 14
8-bit Palette Each pixel points to a color number in palette Palette is 24bit but contains only 256 colors 15
Display Resolution and Memory - Frame-buffer memory size and speed as limiting factor - 1024x768 24bit - 2.25 MB - 0.79 megapixels - 1920x1080 24bit - 5.94 MB - 2 megapixels - 4096x2160 30bit - 31.64 MB - 8.84 megapixels - For animated displays we need to read the frame buffer at least 24 times per second 16
Double Buffering - Q: What happens if we write directly to the framebuffer ? - We need a second buffer to solve this problem 17
Aspect Ratio - Display aspect ratio TV 4:3 - HDTV 16:9 - 35mm film 3:2 - - Pixel aspect ratio - Nowadays, almost always 1:1 18
Frame-buffer Manipulation - Direct memory access Limited by OS security policies - - Various graphical toolkits and libraries Often slow for complex geometry and 3D graph - - OpenGL and DirectX Fast but requires hardware - 19
What is an image? Rectilinear 2D array of pixels - Reality Digital Image 20
What is an image? Rectilinear 2D array of pixels - Reality Digital Image 21
What is an image? Pixels are NOT little squares! Pixels are samples! - Reality Digital Image 22
What is an image? - For a programmer it is a memory structure - Usually represented as sequence of pixels - Typically line after line, left to right - Pixels have their own structure 23
How to capture images? - Pixels are samples of a continuous function Photoreceptors in eye - CCD chips in digital cameras - Rays in virtual scene - 24
How to display images? - Re-create continuous signal from samples i.e. CRT monitor - 25
Image resolution - Spatial resolution Image has “Width” x “Height” pixels - DPI (dots per inch) is more representative - - Intensity resolution Each pixel has limited “Depth” bits per color - - Temporal resolution Image is updated at “Rate” Hz in case of a video sequence - 26
Raster Graphics - Images What is an image? - How to capture images? - How to display images? - - Color What is a color? - How do we perceive the color? - How computers represent the color? - 27
What is color? - Distribution of energies amongst frequencies of visible light range 28
Visible light - The perceived color of light is characterized by Hue = dominant frequency (peak) - Lightness = luminance (area under curve) - Saturation = excitation purity (ratio of highest to rest) - White light Orange light 29
How do we perceive color? - Color as perceived reflectance of the light source 30
How do we perceive color? - Color as perceived reflectance of the light source 31
Color Perception - The density of cones is not linear - Fovea contains most color cones 32
Color Perception - The density of cones is not linear - Fovea contains most color cones 33
Color representation by computers - Common color models - RGB - CMY - XYZ - HSV - HLS - etc… - Tristimulus / Trichomatic color theory 34
RGB color model - Additive color model - Combining colors will produce white 35
CMY color model - Subtractive color model - Combining colors will cover white, absorbing light 36
RGB and CMY Conversion: R=I-C, G=I-M, B=I-Y 37
CMYK - CMY used in printing can be expensive - Black is cheap - K = Key or blacK - K = min(C,M,Y) - CMY amount is then reduced by K 38
HSV - Hue, Saturation and Value - More natural to manipulate for humans 39
HSL - Hue, Saturation and Lightness - Maximum saturation is at L=0.5 40
Gamma correction - Color intensities are considered linear - Most display devices are non-linear - Intensity(voltage) ~= 2 x Intensity(voltage / 2) y = 𝑦 1/𝛿 41
Color Matching 42
Color Matching 43
Color Matching 44
Color Matching Functions 45
CIE XYZ colors 46
CIE XYZ colors 47
CIE XYZ colors - Commission Internationale de l’ Éclarige 1931 - Device independent, CIE 1931 - Based on three standardized colors X,Y,Z x = X/(X+Y+Z) y = Y/(X+Y+Z) z = Z/(X+Y+Z) 48
CIE xyY chromaticity diagram - Defines color gamut of displays - Mapped on to 2D - x +y + z = 1 49
RGB color gamut - Devices are usually not capable to display all colors 50
Color representation in code - 32bit per channel - Normalized colors: floating point <0,1> for each channel - 8bit per channel - <0,255> range - OpenGL “ GLUByte ” - C++ uint8_t 51
Image Processing - Image Filtering - Pixel operations Filtering - Warping - Composition - Morphing - - Image Manipulation - Sampling and Reconstruction - Quantization and Aliasing 52
Summary Images Pixels are samples Images are 2D arrays Images have limited resolution Colors Visible light spectrum Anatomy of eye and perception Basic color models and their applications CIE chromaticity diagram Gamma correction 53
How the lectures should look like #2 Ask questions, please!!! - Be communicative - www.slido.com #PPGSO09 - More active you are, the better for you! - 54
Next Week Image Processing 55
Acknowledgements Thanks to all the people, whose work is shown here and whose slides were used as a material for creation of these slides: Matej Novotný, GSVM lectures at FMFI UK Peter Drahoš, PPGSO lectures at FIIT STU 56
Questions ?! www.slido.com #PPGSO09 martin.madaras@stuba.sk 57
Recommend
More recommend