Image Processing. Adam Finkelstein Princeton University COS 426, Spring 2019

Similar documents
Image Processing COS 426

Image Processing. Image Processing. What is an Image? Image Resolution. Overview. Sources of Error. Filtering Blur Detect edges

קורס גרפיקה ממוחשבת 2008 סמסטר ב' Image Processing 1 חלק מהשקפים מעובדים משקפים של פרדו דוראנד, טומס פנקהאוסר ודניאל כהן-אור

Image Processing. What is an image? קורס גרפיקה ממוחשבת 2008 סמסטר ב' Converting to digital form. Sampling and Reconstruction.

Image Processing. Michael Kazhdan ( /657) HB Ch FvDFH Ch. 13.1

Human Vision, Color and Basic Image Processing

IMAGE PROCESSING: AREA OPERATIONS (FILTERING)

Graphics and Image Processing Basics

Prof. Feng Liu. Fall /04/2018

Digital Image Processing

Image Filtering. Median Filtering

>>> from numpy import random as r >>> I = r.rand(256,256);

>>> from numpy import random as r >>> I = r.rand(256,256);

EE482: Digital Signal Processing Applications

Image Processing. Adrien Treuille

CSE 564: Scientific Visualization

Image Processing Computer Graphics I Lecture 20. Display Color Models Filters Dithering Image Compression

02/02/10. Image Filtering. Computer Vision CS 543 / ECE 549 University of Illinois. Derek Hoiem

Achim J. Lilienthal Mobile Robotics and Olfaction Lab, AASS, Örebro University

Image Processing for feature extraction

Image Capture and Problems

Image Enhancement contd. An example of low pass filters is:

Images and Filters. EE/CSE 576 Linda Shapiro

Image Filtering in Spatial domain. Computer Vision Jia-Bin Huang, Virginia Tech

Image Filtering Josef Pelikán & Alexander Wilkie CGG MFF UK Praha

IMAGES AND COLOR. N. C. State University. CSC557 Multimedia Computing and Networking. Fall Lecture # 10

CS534 Introduction to Computer Vision. Linear Filters. Ahmed Elgammal Dept. of Computer Science Rutgers University

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

Filtering. Image Enhancement Spatial and Frequency Based

Digital Image Processing

Table of contents. Vision industrielle 2002/2003. Local and semi-local smoothing. Linear noise filtering: example. Convolution: introduction

CEE598 - Visual Sensing for Civil Infrastructure Eng. & Mgmt.

CS 4501: Introduction to Computer Vision. Filtering and Edge Detection

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

Image Manipulation: Filters and Convolutions

Vision Review: Image Processing. Course web page:

Prof. Feng Liu. Winter /10/2019

Image processing. Image formation. Brightness images. Pre-digitization image. Subhransu Maji. CMPSCI 670: Computer Vision. September 22, 2016

Color Space 1: RGB Color Space. Color Space 2: HSV. RGB Cube Easy for devices But not perceptual Where do the grays live? Where is hue and saturation?

Digital Image Processing. Digital Image Fundamentals II 12 th June, 2017

CSE 564: Visualization. Image Operations. Motivation. Provide the user (scientist, t doctor, ) with some means to: Global operations:

ENEE408G Multimedia Signal Processing

Computer Graphics Fundamentals

CoE4TN4 Image Processing. Chapter 3: Intensity Transformation and Spatial Filtering

Prof. Feng Liu. Fall /02/2018

Color Transformations

Sensors and Sensing Cameras and Camera Calibration

Chapter 3 Part 2 Color image processing

Image Processing. 2. Point Processes. Computer Engineering, Sejong University Dongil Han. Spatial domain processing

Multimedia Systems Giorgio Leonardi A.A Lectures 14-16: Raster images processing and filters

LAB MANUAL SUBJECT: IMAGE PROCESSING BE (COMPUTER) SEM VII

Realistic Image Synthesis

CS/ECE 545 (Digital Image Processing) Midterm Review

Computer and Machine Vision

The Perceived Image Quality of Reduced Color Depth Images

Digital Image Processing. Lecture # 8 Color Processing

Computer Vision for HCI. Noise Removal. Noise in Images

Image Enhancement using Histogram Equalization and Spatial Filtering

Camera Image Processing Pipeline: Part II

Image filtering, image operations. Jana Kosecka

CSCI 1290: Comp Photo

ENGG1015 Digital Images

Image Enhancement in the Spatial Domain Low and High Pass Filtering

Enhancement Techniques for True Color Images in Spatial Domain

A Basic Guide to Photoshop Adjustment Layers

Image Processing: An Overview

Computing for Engineers in Python

Image acquisition. Midterm Review. Digitization, line of image. Digitization, whole image. Geometric transformations. Interpolation 10/26/2016

Image processing for gesture recognition: from theory to practice. Michela Goffredo University Roma TRE

Last Lecture. photomatix.com

Image Enhancement in the Spatial Domain

CSC 320 H1S CSC320 Exam Study Guide (Last updated: April 2, 2015) Winter 2015

INSTITUTIONEN FÖR SYSTEMTEKNIK LULEÅ TEKNISKA UNIVERSITET

Motion illusion, rotating snakes

Color Image Processing

Understand brightness, intensity, eye characteristics, and gamma correction, halftone technology, Understand general usage of color

A Basic Guide to Photoshop CS Adjustment Layers

Color Image Processing

IMAGE PROCESSING: POINT PROCESSES

Head, IICT, Indus University, India

Camera Image Processing Pipeline: Part II

Last Lecture. photomatix.com

Image analysis. CS/CME/BioE/Biophys/BMI 279 Oct. 31 and Nov. 2, 2017 Ron Dror

Matlab (see Homework 1: Intro to Matlab) Linear Filters (Reading: 7.1, ) Correlation. Convolution. Linear Filtering (warm-up slide) R ij

Correction of Clipped Pixels in Color Images

Understanding Matrices to Perform Basic Image Processing on Digital Images

Midterm Examination CS 534: Computational Photography

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

SYLLABUS CHAPTER - 2 : INTENSITY TRANSFORMATIONS. Some Basic Intensity Transformation Functions, Histogram Processing.

Image Processing by Bilateral Filtering Method

DIGITAL IMAGE PROCESSING (COM-3371) Week 2 - January 14, 2002

Study guide for Graduate Computer Vision

Sampling and pixels. CS 178, Spring Marc Levoy Computer Science Department Stanford University. Begun 4/23, finished 4/25.

IMAGE PROCESSING >COLOR SPACES UTRECHT UNIVERSITY RONALD POPPE

Lecture 2: Digital Image Fundamentals -- Sampling & Quantization

Virtual Restoration of old photographic prints. Prof. Filippo Stanco

More image filtering , , Computational Photography Fall 2017, Lecture 4

Multimedia Systems Image II (Image Enhancement) Mahdi Amiri April 2012 Sharif University of Technology

Practical Image and Video Processing Using MATLAB

Fixing the Gaussian Blur : the Bilateral Filter

Transcription:

Image Processing Adam Finkelstein Princeton University COS 426, Spring 2019

Image Processing Operations Luminance Brightness Contrast Gamma Histogram equalization Color Grayscale Saturation White balance Linear filtering Blur & sharpen Edge detect Convolution Non-linear filtering Median Bilateral filter Dithering Quantization Ordered dither Floyd-Steinberg

Image Processing Operations Luminance Brightness Contrast Gamma Histogram equalization Color Grayscale Saturation White balance Linear filtering Blur & sharpen Edge detect Convolution Non-linear filtering Median Bilateral filter Dithering Quantization Ordered dither Floyd-Steinberg

What is Luminance? Measures perceived gray-level of pixel L = 0.30*red + 0.59*green + 0.11*blue 0.5 0.0 0.7 0.9

Luminance Measures perceived gray-level of pixel Luminance Samples of luminance for pixels on one horizontal row of pixels x Figure 19.9 FvDFH

Luminance Luminance Measures perceived gray-level of pixel x Samples of luminance for pixels on one horizontal row of pixels Figure 19.9 FvDFH

Adjusting Brightness What must be done to the RGB values to make this image brighter? Luminance x

Adjusting Brightness Method 1: Convert to HSL, scale L, convert back (more on this shortly ) Method 2: Scale R, G, and B directly o Multiply each of red, green, and blue by a factor o Must clamp to [0..1] always ( [0..1] in floating point but often [0,255] for fixed point ) Luminance Original Brighter x

Adjusting Contrast Compute mean luminance L* over whole image Scale deviation from L* for each pixel L* Original More Contrast

Adjusting Gamma Apply non-linear function to account for difference between brightness and perceived brightness of display I out = I in g Perceived brightness Amount of light g depends on camera and monitor

Histogram Equalization Change distribution of luminance values to cover full range [0-1] http://en.wikipedia.org/wiki/histogram_equalization # Pixels # Pixels Luminance Luminance

Image Processing Operations Luminance Brightness Contrast Gamma Histogram equalization Color Grayscale Saturation White balance Linear filtering Blur & sharpen Edge detect Convolution Non-linear filtering Median Bilateral filter Dithering Quantization Ordered dither Floyd-Steinberg

Color processing Color models (last lec.) RGB CMY HSV XYZ La*b* Etc. HSV HSL http://commons.wikimedia.org/wiki/ File:HSV_color_solid_cone_chroma_gray.png

Grayscale Convert from color to gray-levels Original Grayscale ( black&white photo)

Grayscale Convert from color to gray-levels Original Grayscale ( black&white photo) Method 1: Convert to HSL, set S=0, convert back to RGB Method 2: Set RGB of every pixel to (L,L,L)

Adjusting Saturation Increase/decrease color saturation of every pixel

Adjusting Saturation Increase/decrease color saturation of every pixel Method 1: Convert to HSL, scale S, convert back Method 2: R = L + scale * (R-L) same for G&B

White Balance Adjust colors so that a given RGB value is mapped to a neutral color

White Balance Conceptually: Provide an RGB value W that should be mapped to white Perform transformation of color space W

White Balance Von Kries method: adjust colors in LMS color space LMS primaries represent the responses of the three different types of cones in our eyes http://www.blueconemonochromacy.org Wikipedia

White Balance For each pixel RGB: 1) Convert to XYZ color space 2) Convert to LMS color space 3) Divide by L W M W S W the color of white in LMS 4) Convert back to RGB

Image Processing Operations Luminance Brightness Contrast. Gamma Histogram equalization Color Grayscale Saturation White balance Linear filtering Blur & sharpen Edge detect Convolution Non-linear filtering Median Bilateral filter Dithering Quantization Ordered dither Floyd-Steinberg

Blur What is the basic operation for each pixel when blurring an image?

Basic Operation: Convolution Output value is weighted sum of values in neighborhood of input image Pattern of weights is the filter or kernel Box Filter Input Output

Basic Operation: Convolution Output value is weighted sum of values in neighborhood of input image Pattern of weights is the filter or kernel Triangle Filter Input Output

Basic Operation: Convolution Output value is weighted sum of values in neighborhood of input image Pattern of weights is the filter or kernel Gaussian Filter Input Output

Convolution with a Gaussian Filter unrelated pixels uncertain pixels related pixels uncertain pixels unrelated pixels pixel position

Convolution with a Gaussian Filter Output value is weighted sum of values in neighborhood of input image Note to fix slides: weights should sum to 1. Practical solution in next lecture: divide by sum of weights. 0.2 0.4 0.2 Filter Input Output

Convolution with a Gaussian Filter Output value is weighted sum of values in neighborhood of input image 0.2 0.4 0.2 Filter Input Output

Convolution with a Gaussian Filter Output value is weighted sum of values in neighborhood of input image 0.2 0.4 0.2 Filter Input Output

Convolution with a Gaussian Filter Output value is weighted sum of values in neighborhood of input image 0.2 0.4 0.2 Filter Input Output

Convolution with a Gaussian Filter Output value is weighted sum of values in neighborhood of input image 0.2 0.4 0.2 Filter Input Output

Convolution with a Gaussian Filter What if filter extends beyond boundary? 0.2 0.4 0.2 Filter Input Output

Convolution with a Gaussian Filter What if filter extends beyond boundary? 0.4 0.8 Modified Filter Input Output

Convolution with a Gaussian Filter Output contains samples from smoothed input Filter Input Output Figure 2.4 Wolberg

Linear Filtering 2D Convolution o Each output pixel is a linear combination of input pixels in 2D neighborhood with weights prescribed by a filter Filter Input Image Output Image

Linear Filtering 2D Convolution o Each output pixel is a linear combination of input pixels in 2D neighborhood with weights prescribed by a filter Filter Input Image Output Image

Linear Filtering 2D Convolution o Each output pixel is a linear combination of input pixels in 2D neighborhood with weights prescribed by a filter Filter Input Image Output Image

Linear Filtering 2D Convolution o Each output pixel is a linear combination of input pixels in 2D neighborhood with weights prescribed by a filter Filter Input Image Output Image

Linear Filtering 2D Convolution o Each output pixel is a linear combination of input pixels in 2D neighborhood with weights prescribed by a filter Filter Input Image Output Image

Gaussian Blur per-pixel multiplication * input output

Gaussian Blur Output value is weighted sum of values in neighborhood of input image 1 normalized Gaussian function 0

input

Gaussian blur

Linear Filtering Many interesting linear filters Blur Edge detect Sharpen Emboss etc. Filter =?

Blur Convolve with a 2D Gaussian filter Original Blur Filter =

Edge Detection Convolve with a 2D Laplacian filter that finds differences between neighbor pixels Original Detect edges Filter =

Sharpen Sum detected edges with original image Original Sharpened Filter =

Emboss Convolve with a filter that highlights gradients in particular directions Original Embossed Filter =

Side Note: Separable Filters Some filters are separable (e.g., Gaussian) First, apply 1-D convolution across every row Then, apply 1-D convolution across every column HUGE impact on performance (when kernel is big)

Image Processing Operations Luminance Brightness Contrast. Gamma Histogram equalization Color Grayscale Saturation White balance Linear filtering Blur & sharpen Edge detect Convolution Non-linear filtering Median Bilateral filter Dithering Quantization Ordered dither Floyd-Steinberg

Non-Linear Filtering Each output pixel is a non-linear function of input pixels in neighborhood (filter depends on input) Original Paint Stained Glass

Median Filter Each output pixel is median of input pixels in neighborhood

Bilateral Filter Gaussian blur uses same filter for all pixels Blurs across edges as much as other areas Original Gaussian Blur

Bilateral Filter Gaussian blur uses same filter for all pixels Prefer a filter that preserves edges (adapts to content) Original Bilateral Filter

Gaussian Blur Output value is weighted sum of values in neighborhood of input image 1 normalized Gaussian function 0

Bilateral Filter Combine Gaussian filtering in both spatial domain and color domain 1 Bilateral [ I ] = å p Gs r W s p qîs ( p - q ) G ( I - I ) p q I q Spatial Proximity Weight Color Proximity Weight

Bilateral Filtering Combine Gaussian filtering in both spatial domain and color domain

s r = 0.1 s r = 0.25 s r = (Gaussian blur) input s s = 2 s s = 6 s s = 18

Image Processing Operations Luminance Brightness Contrast. Gamma Histogram equalization Color Grayscale Saturation White balance Linear filtering Blur & sharpen Edge detect Convolution Non-linear filtering Median Bilateral filter Dithering Quantization Ordered dither Floyd-Steinberg

Quantization Reduce intensity resolution o Frame buffers have limited number of bits per pixel o Physical devices have limited dynamic range

Uniform Quantization P(x, y) = round( I(x, y) ) where round() chooses nearest value that can be represented. I(x,y) P(x,y) I(x,y) P(x,y) (2 bits per pixel)

Uniform Quantization Images with decreasing bits per pixel: 8 bits 4 bits 2 bits 1 bit Notice contouring.

Reducing Effects of Quantization Intensity resolution / spatial resolution tradeoff Dithering o Random dither o Ordered dither o Error diffusion dither Halftoning o Classical halftoning

Dithering Distribute errors among pixels o Exploit spatial integration in our eye o Display greater range of perceptible intensities Original (8 bits) Uniform Quantization (1 bit) Floyd-Steinberg Dither (1 bit)

Random Dither Randomize quantization errors o Errors appear as noise P(x,y) P(x,y) I(x,y) I(x,y) P(x, y) = round(i(x, y) + noise(x,y))

Random Dither Original (8 bits) Uniform Quantization (1 bit) Random Dither (1 bit)

Ordered Dither Pseudo-random quantization errors o Matrix stores pattern of threshholds o Pseudo-code for 1-bit output: i = x mod n j = y mod n thresh = (D(i,j)+1)/(n 2 +1) if (I(x,y) > thresh) P(x,y) = 1 else P(x,y) = 0 0 1/5 2/5 3/5 4/5 1 thresholds o Can be generalized to n-bit output, by comparing quantization error to threshhold.

Ordered Dither Original (8 bits) Random Dither (1 bit) Ordered Dither (1 bit)

Ordered Dither Recursion for Bayer s ordered dither matrices 4x4 matrix gives 17 gray levels: https://en.wikipedia.org/wiki/ordered_dithering

Error Diffusion Dither Spread quantization error over neighbor pixels o Error dispersed to pixels right and below o Floyd-Steinberg weights: 3/16 + 5/16 + 1/16 + 7/16 = 1.0 Figure 14.42 from H&B

Error Diffusion Dither Original (8 bits) Random Dither (1 bit) Ordered Dither (1 bit) Floyd-Steinberg Dither (1 bit)

Summary Color transformations Different color spaces useful for different operations Filtering Compute new values for image pixels based on function of old values in neighborhood Dithering Reduce visual artifacts due to quantization Distribute errors among pixels Exploit spatial integration in our eye