Image Processing. CSCI 420 Computer Graphics Lecture 22

Similar documents
Image Processing. Alpha Channel. Blending. Image Compositing. Blending Errors. Blending in OpenGL

Image Processing Computer Graphics I Lecture 15

Image Processing. Blending. Blending in OpenGL. Image Compositing. Blending Errors. Antialiasing Revisited Computer Graphics I Lecture 15

Rasterization Computer Graphics I Lecture 14. Scan Conversion Antialiasing Compositing [Angel, Ch , ]

CS 432 Interactive Computer Graphics

Pixels and Buffers. CS 537 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science

Computer Vision I - Basics of Image Processing Part 1

CSCI 420 Computer Graphics Lecture 14. Rasterization. Scan Conversion Antialiasing [Angel Ch. 6] Jernej Barbic University of Southern California

Rasterization. Rasterization (scan conversion) Digital Differential Analyzer (DDA) Rasterizing a line. Digital Differential Analyzer (DDA)

ECG782: Multidimensional Digital Signal Processing

Graphics Hardware and Display Devices

3. Raster Algorithms. 3.1 Raster Displays. (see Chapter 1 of the Notes) CRT LCD. CS Dept, Univ of Kentucky

EECS 556 Image Processing W 09. Image enhancement. Smoothing and noise removal Sharpening filters

EE795: Computer Vision and Intelligent Systems

Image processing. Reading. What is an image? Brian Curless CSE 457 Spring 2017

Discrete Techniques. 11 th Week, Define a buffer by its spatial resolution (n m) and its depth (or precision) k, the number of

CS559: Computer Graphics. Lecture 12: Antialiasing & Visibility Li Zhang Spring 2008

Buffers and Processing Fragments

Lecture 4: Image Processing

ECG782: Multidimensional Digital Signal Processing

Computer Graphics. Three-Dimensional Graphics VI. Guoying Zhao 1 / 73

Chapter 3: Intensity Transformations and Spatial Filtering

EEM 463 Introduction to Image Processing. Week 3: Intensity Transformations

Relationship between Fourier Space and Image Space. Academic Resource Center

EE795: Computer Vision and Intelligent Systems

Babu Madhav Institute of Information Technology Years Integrated M.Sc.(IT)(Semester - 7)

Lecture 4 Image Enhancement in Spatial Domain

Image Processing. Overview. Trade spatial resolution for intensity resolution Reduce visual artifacts due to quantization. Sampling and Reconstruction

11/1/13. Visualization. Scientific Visualization. Types of Data. Height Field. Contour Curves. Meshes

Visualization. CSCI 420 Computer Graphics Lecture 26

Definition. Blending & Compositing. Front & Back Buffers. Left & Right Buffers. Blending combines geometric objects. e.g.

Why is computer vision difficult?

Working with the BCC Bump Map Generator

Vivekananda. Collegee of Engineering & Technology. Question and Answers on 10CS762 /10IS762 UNIT- 5 : IMAGE ENHANCEMENT.

Digital Image Processing

CS334: Digital Imaging and Multimedia Edges and Contours. Ahmed Elgammal Dept. of Computer Science Rutgers University

BCC Rays Ripply Filter

Buffers, Textures, Compositing, and Blending. Overview. Buffers. David Carr Virtual Environments, Fundamentals Spring 2005 Based on Slides by E.

ME/CS 132: Introduction to Vision-based Robot Navigation! Low-level Image Processing" Larry Matthies"

Outlines. Medical Image Processing Using Transforms. 4. Transform in image space

CMPUT 206. Introduction to Digital Image Processing

Classification of image operations. Image enhancement (GW-Ch. 3) Point operations. Neighbourhood operation

Lecture: Edge Detection

An Introduc+on to Mathema+cal Image Processing IAS, Park City Mathema2cs Ins2tute, Utah Undergraduate Summer School 2010

Image gradients and edges April 11 th, 2017

Image gradients and edges April 10 th, 2018

Image Enhancement in Spatial Domain. By Dr. Rajeev Srivastava

Islamic University of Gaza Faculty of Engineering Computer Engineering Department

Digital Halftoning. Prof. George Wolberg Dept. of Computer Science City College of New York

Lecture #13. Point (pixel) transformations. Neighborhood processing. Color segmentation

Presentation and analysis of multidimensional data sets

Digital Image Processing. Image Enhancement - Filtering

EECE 478. Learning Objectives. Learning Objectives. Rasterization & Scenes. Rasterization. Compositing

The Rasterization Pipeline

Anno accademico 2006/2007. Davide Migliore

CHAPTER 3 IMAGE ENHANCEMENT IN THE SPATIAL DOMAIN

Scan line algorithm. Jacobs University Visualization and Computer Graphics Lab : Graphics and Visualization 272

Ray Tracing. CSCI 420 Computer Graphics Lecture 15. Ray Casting Shadow Rays Reflection and Transmission [Ch ]

Lecture 6: Edge Detection

CS4733 Class Notes, Computer Vision

Filtering and Enhancing Images

Lecture 4: Spatial Domain Transformations

3D graphics, raster and colors CS312 Fall 2010

Exercise Computer graphics (till October 30, 2007)

Intensity Transformation and Spatial Filtering

BCC Textured Wipe Animation menu Manual Auto Pct. Done Percent Done

Computer Graphics. Chapter 4 Attributes of Graphics Primitives. Somsak Walairacht, Computer Engineering, KMITL 1

Lets assume each object has a defined colour. Hence our illumination model is looks unrealistic.

Computer Graphics Lecture 2

IT Digital Image ProcessingVII Semester - Question Bank

Linear Operations Using Masks

Chapter - 2 : IMAGE ENHANCEMENT

Module 13C: Using The 3D Graphics APIs OpenGL ES

Image Enhancement: To improve the quality of images

Pipeline Operations. CS 4620 Lecture Steve Marschner. Cornell CS4620 Spring 2018 Lecture 11

In this lecture. Background. Background. Background. PAM3012 Digital Image Processing for Radiographers

CS130 : Computer Graphics Lecture 2: Graphics Pipeline. Tamar Shinar Computer Science & Engineering UC Riverside

New Features in BCC AVX 4.0

Biometrics Technology: Image Processing & Pattern Recognition (by Dr. Dickson Tong)

(Refer Slide Time 00:17) Welcome to the course on Digital Image Processing. (Refer Slide Time 00:22)

INFOGR Computer Graphics

Color Dithering with n-best Algorithm

Lectures Transparency Case Study

Photometric Processing

Computer Graphics. Shadows

SECTION 5 IMAGE PROCESSING 2

Fall CSCI 420: Computer Graphics. 7.1 Rasterization. Hao Li.

Basic GPU techniques Josef Pelikán CGG MFF UK Praha.

Digital Image Processing. Image Enhancement in the Spatial Domain (Chapter 4)

Image gradients and edges

Ulrik Söderström 17 Jan Image Processing. Introduction

Soft shadows. Steve Marschner Cornell University CS 569 Spring 2008, 21 February

BCC Linear Wipe. When the Invert Wipe Checkbox is selected, the alpha channel created by the wipe inverts.

Pipeline Operations. CS 4620 Lecture 14

Advanced Shading I: Shadow Rasterization Techniques

Homework #1. Displays, Alpha Compositing, Image Processing, Affine Transformations, Hierarchical Modeling

An Interactive Introduction to OpenGL Programming

IMAGE ENHANCEMENT in SPATIAL DOMAIN by Intensity Transformations

Order Independent Transparency with Dual Depth Peeling. Louis Bavoil, Kevin Myers

Edge and local feature detection - 2. Importance of edge detection in computer vision

Transcription:

CSCI 42 Computer Graphics Lecture 22 Image Processing Blending Display Color Models Filters Dithering [Ch 7.13, 8.11-8.12] Jernej Barbic University of Southern California 1

Alpha Channel Frame buffer Simple color model: R, G, B; 8 bits each α-channel A, another 8 bits Alpha determines opacity, pixel-by-pixel α = 1: opaque α = : transparent checkerboard pattern = opacity Source: Wikipedia 2

Blending Blend transparent objects during rendering Achieve other effects (e.g., shadows) 3

Image Compositing Compositing operation Source: s = [s r s g s b s a ] Destination: d = [d r d g d b d a ] b = [b r b g b b b a ] source blending factors c = [c r c g c b c a ] destination blending factors d = [b r s r + c r d r b g s g + c g d g b b s b + c b d b b a s a + c a d a ] Example: overlay n images with equal weight Set α-value for each pixel in each image to 1/n Source blending factor is α Destination blending factor is 1 4

Blending in OpenGL Enable blending glenable(gl_blend); Set up source and destination factors glblendfunc(source_factor, dest_factor); Source and destination choices GL_ONE, GL_ZERO GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA GL_DST_ALPHA, GL_ONE_MINUS_DST_ALPHA Set alpha values: 4th parameter to glcolor4f(r, g, b, alpha) gllightfv, glmaterialfv 5

Blending Errors Operations are not commutative rendering order changes result Operations are not idempotent render same object twice gives different result to rendering once Interaction with hidden-surface removal is tricky Polygon behind opaque polygon(s) should be culled Transparent in front of others should be composited Solution: make z-buffer read-only for transparent polygons with gldepthmask(gl_false); 6

Outline Blending Display Color Models Filters Dithering 7

Displays and Framebuffers Image stored in memory as 2D pixel array, called framebuffer Value of each pixel controls color Video hardware scans the framebuffer at 6Hz Depth of framebuffer is information per pixel 1 bit: black and white display 8 bit: 6 colors at any given time via colormap 16 bit: 5, 6, 5 bits (R,G,B), 2 16 = 65,536 colors 24 bit: 8, 8, 8 bits (R,G,B), 2 24 = 16,777,216 colors 8

Fewer Bits: Colormaps colormap, k=2 the pixels (indices into colormap) the image Colormap is array of RGB values, k bits each (e.g., k=8) Each pixel stored not the color, but an index into colormap All 2 24 colors can be represented, but only 2 k colors at a time Poor approximation of full color Colormap hacks: affect image without changing framebuffer (only colormap) 9

More Bits: Graphics Hardware 24 bits: RGB + 8 bits: A (α-channel for opacity) + 16 bits: Z (for hidden-surface removal) * 2: double buffering for smooth animation = 96 bits For 124 * 768 screen: 9 MB Easily possible on modern hardware 1

Image Processing 2D generalization of signal processing Image as a two-dimensional signal Point processing: modify pixels independently Filtering: modify based on neighborhood Compositing: combine several images Image compression: space-efficient formats Other topics Image enhancement and restoration Computer vision 11

Outline Blending Display Color Models Filters Dithering 12

Point Processing Process each pixel independently from others Input: a(x,y); Output: b(x,y) = f(a(x,y)) Useful for contrast adjustment, false colors Examples for grayscale, v 1 f(v) = v (identity) f(v) = 1-v (negate image) f(v) = v p, p < 1 (brighten) f(v) = v p, p > 1 (darken) f(v) v 13

Gamma Correction Example of point processing Compensates monitor brightness nonlinearities (older monitors) Γ = 1.; f(v) = v Γ =.5; f(v) = v 1/.5 = v 2 Γ = 2.5; f(v) = v 1/2.5 = v.4 14

Signals and Filtering Audio recording is 1D signal: amplitude(t) Image is a 2D signal: color(x,y) Signals can be continuous or discrete Raster images are discrete In space: sampled in x, y In color: quantized in value Filtering: a mapping from signal to signal 15

Linear and Shift-Invariant Filters Linear with respect to input signal Shift-invariant with respect to parameter Convolution in 1D a(t) is input signal b(s) is output signal h(u) is filter Convolution in 2D 16

Filters with Finite Support Filter h(u,v) is except in given region Example: 3 x 3 blurring filter As function In matrix form 17

Blurring Filters Average values of surrounding pixels Can be used for anti-aliasing Size of blurring filter should be odd What do we do at the edges and corners? For noise reduction, use median, not average Eliminates intensity spikes Non-linear filter 18

Examples of Blurring Filter Original Image Blur 3x3 mask Blur 7x7 mask 19

Example Noise Reduction Original image Image with noise Median filter (5x5) 2

Edge Filters Task: Discover edges in image Characterized by large gradient Approximate square root Approximate partial derivatives, e.g. 21

Sobel Filter Very popular edge detection filter Approximate: Output is a, computed as follows: Sobel filter is non-linear Square and square root (more exact computation) Can also use absolute value (faster computation) 22

23 Sample Filter Computation One part (of the two) of the Sobel filter Detects vertical edges -1-1 -2 1 1 2 4 1 a b h

Example of Edge Filter Original image Edge filter, then brightened 24

Outline Blending Display Color Models Filters Dithering

Dithering Compensates for lack of color resolution Give up spatial resolution for color resolution Eye does spatial averaging original web-safe colors, no dithering web-safe colors, with dithering Source: Wikipedia 26

Black/White Dithering For gray scale images Each pixel is black or white From far away, eye perceives color by fraction of white For 3x3 block, 1 levels of gray scale 27

Color Dithering Dither RGB separately Store quantized color as a k-bit value (often k=8) original image 6 colors per RGB channel dithered, k=3 only 8 colors per RGB channel Source: Wikipedia 28

Halftoning Regular patterns create artifacts Avoid stripes Avoid isolated pixels (e.g. on laser printer) Monotonicity: keep pixels on at higher intensities Floyd-Steinberg dithering Example of good 3x3 dithering matrix For intensity n, turn on pixels..n 1 Source: Wikipedia 29

Summary Display Color Models 8 bit (colormap), 24 bit, 96 bit Filters Blur, edge detect, sharpen, despeckle (noise removal) Dithering 3