IMAGE SAMPLING AND IMAGE QUANTIZATION 1. Introduction

Slides:



Advertisements
Similar presentations
ECE 4371, Fall, 2014 Introduction to Telecommunication Engineering/Telecommunication Laboratory Zhu Han Department of Electrical and Computer Engineering.
Advertisements

Digital Coding of Analog Signal Prepared By: Amit Degada Teaching Assistant Electronics Engineering Department, Sardar Vallabhbhai National Institute of.
Chapter 3 Image Enhancement in the Spatial Domain.
CDS 301 Fall, 2009 Image Visualization Chap. 9 November 5, 2009 Jie Zhang Copyright ©
Image Processing IB Paper 8 – Part A
Sampling process Sampling is the process of converting continuous time, continuous amplitude analog signal into discrete time continuous amplitude signal.
Digital Signal Processing – Chapter 11 Introduction to the Design of Discrete Filters Prof. Yasser Mostafa Kadah
 Image Characteristics  Image Digitization Spatial domain Intensity domain 1.
CS 551 / CS 645 Antialiasing. What is a pixel? A pixel is not… –A box –A disk –A teeny tiny little light A pixel is a point –It has no dimension –It occupies.
Digital image processing Chapter 6. Image enhancement IMAGE ENHANCEMENT Introduction Image enhancement algorithms & techniques Point-wise operations Contrast.
CEN352, Dr. Ghulam Muhammad King Saud University
School of Computing Science Simon Fraser University
Filtering CSE P 576 Larry Zitnick
Computer Graphics Recitation 6. 2 Motivation – Image compression What linear combination of 8x8 basis signals produces an 8x8 block in the image?
Digital Image Processing Chapter 4: Image Enhancement in the Frequency Domain.
Science is organized knowledge. Wisdom is organized life.
Image Sampling Moire patterns -
Chapter 2: Digital Image Fundamentals Fall 2003, 劉震昌.
Fourier Transform 2D Discrete Fourier Transform - 2D
Leo Lam © Signals and Systems EE235. Transformers Leo Lam ©
Digital Image Processing, 2nd ed. © 2002 R. C. Gonzalez & R. E. Woods Chapter 4 Image Enhancement in the Frequency Domain Chapter.
Pulse Modulation 1. Introduction In Continuous Modulation C.M. a parameter in the sinusoidal signal is proportional to m(t) In Pulse Modulation P.M. a.
… Representation of a CT Signal Using Impulse Functions
Image Processing 고려대학교 컴퓨터 그래픽스 연구실 cgvr.korea.ac.kr.
Dr Martin Hendry, Dept of Physics and Astronomy University of Glasgow, UK Astronomical Data Analysis I 11 lectures, beginning autumn 2008.
DTFT And Fourier Transform
Chapter 2. Image Analysis. Image Analysis Domains Frequency Domain Spatial Domain.
Lecture 1 Signals in the Time and Frequency Domains
Image Formation. Input - Digital Images Intensity Images – encoding of light intensity Range Images – encoding of shape and distance They are both a 2-D.
1 Chapter 5 Ideal Filters, Sampling, and Reconstruction Sections Wed. June 26, 2013.
Image Resampling CS4670: Computer Vision Noah Snavely.
Image Processing and Sampling
09/19/2002 (C) University of Wisconsin 2002, CS 559 Last Time Color Quantization Dithering.
Lecture 7: Sampling Review of 2D Fourier Theory We view f(x,y) as a linear combination of complex exponentials that represent plane waves. F(u,v) describes.
A Simple Image Model Image: a 2-D light-intensity function f(x,y)
Digital Imaging. Digital image - definition Image = “a two-dimensional function, f(x,y), where x and y are spatial coordinates, and the amplitude of f.
Digital image processing Chapter 3. Image sampling and quantization IMAGE SAMPLING AND IMAGE QUANTIZATION 1. Introduction 2. Sampling in the two-dimensional.
Image Processing Basics. What are images? An image is a 2-d rectilinear array of pixels.
Leo Lam © Signals and Systems EE235 Leo Lam.
7- 1 Chapter 7: Fourier Analysis Fourier analysis = Series + Transform ◎ Fourier Series -- A periodic (T) function f(x) can be written as the sum of sines.
02/05/2002 (C) University of Wisconsin 2002, CS 559 Last Time Color Quantization Mach Banding –Humans exaggerate sharp boundaries, but not fuzzy ones.
2D Sampling Goal: Represent a 2D function by a finite set of points.
Digital Image Processing
IMAGE SAMPLING AND IMAGE QUANTIZATION 1. Introduction
CDS 301 Fall, 2008 Image Visualization Chap. 9 November 11, 2008 Jie Zhang Copyright ©
Lecture 3: The Sampling Process and Aliasing 1. Introduction A digital or sampled-data control system operates on discrete- time rather than continuous-time.
Continuous-time Signal Sampling
Digital Image Processing Image Enhancement in Spatial Domain
Analog-Digital Conversion. Analog outputs from sensors and analog front- ends (analog signal conditioning) have to be converted into digital signals.
Image Enhancement in the Spatial Domain.
Masaki Hayashi 2015, Autumn Visualization with 3D CG Digital 2D Image Basic.
Chapter 4 Dynamical Behavior of Processes Homework 6 Construct an s-Function model of the interacting tank-in-series system and compare its simulation.
Image Resampling & Interpolation
Chapter 4 Dynamical Behavior of Processes Homework 6 Construct an s-Function model of the interacting tank-in-series system and compare its simulation.
… Sampling … … Filtering … … Reconstruction …
Image enhancement algorithms & techniques Point-wise operations
Chapter 3 Sampling.
Digital 2D Image Basic Masaki Hayashi
Sampling rate conversion by a rational factor
Fundamentals Data.
Image Acquisition.
لجنة الهندسة الكهربائية
IMAGE SAMPLING AND IMAGE QUANTIZATION 1. Introduction
Sampling and Quantization
CEN352, Dr. Ghulam Muhammad King Saud University
Chapter 3 Sampling.
ELEN E4810: Digital Signal Processing Topic 11: Continuous Signals
Review and Importance CS 111.
Presentation transcript:

IMAGE SAMPLING AND IMAGE QUANTIZATION 1. Introduction Digital image processing Chapter 3. Image sampling and quantization IMAGE SAMPLING AND IMAGE QUANTIZATION 1. Introduction 2. Sampling in the two-dimensional space Basics on image sampling The concept of spatial frequencies Images of limited bandwidth Two-dimensional sampling Image reconstruction from its samples The Nyquist rate. The alias effect and spectral replicas superposition The sampling theorem in the two-dimensional case Non-rectangular sampling grids and interlaced sampling The optimal sampling Practical limitations in sampling and reconstruction 3. Image quantization 4. The optimal quantizer The uniform quantizer 5. Visual quantization Contrast quantization Pseudo-random noise quantization Halftone image generation Color image quantization

Fig 1 Image sampling and quantization / Analog image display Digital image processing Chapter 3. Image sampling and quantization 1.           Introduction                                   Fig 1 Image sampling and quantization / Analog image display  

2. Sampling in the two-dimensional space Basics on image sampling Digital image processing Chapter 3. Image sampling and quantization 2.           Sampling in the two-dimensional space Basics on image sampling               x y f(x,y)                    

1-D signal (time varying) 2-D signal (grey scale image) Digital image processing Chapter 3. Image sampling and quantization The concept of spatial frequencies - Grey scale images can be seen as a 2-D generalization of time-varying signals (both in the analog and in the digital case); the following equivalence applies: 1-D signal (time varying) 2-D signal (grey scale image) Time coordinate t Space coordinates x,y Instantaneous value: f(t) Brightness level, point-wise: f(x,y) A 1-D signal that doesn’t vary in time (is constant) = has 0 A.C. component, and only a D.C. component A perfectly uniform image (it has the same brightness in all spatial locations); the D.C. component = the brightness in any point The frequency content of a 1-D signal is proportional to the speed of variation of its instantaneous value in time: νmax ~ max(df/dt) The frequency content of an image (2-D signal) is proportional to the speed of variation of its instantaneous value in space: νmax,x ~ max(df/dx); νmax,y ~ max(df/dy) => νmax,x , νmax,y = “spatial frequencies” Discrete 1-D signal: described by its samples => a vector: u=[u(0) u(1) … u(N-1)], N samples; the position of the sample = the discrete time moment Discrete image (2-D signal): described by its samples, but in 2-D => a matrix: U[M×N], U={u(m,n)}, m=0,1,…,M-1; n=0,1,…,N-1. The spectrum of the time varying signal = the real part of the Fourier transform of the signal, F(ω); ω=2πν. The spectrum of the image = real part of the Fourier transform of the image = 2-D generalization of 1-D Fourier transform, F(ωx,ωy) ωx=2πνx; ωy=2πνy

The spectrum of a limited bandwidth image and its spectral support Digital image processing Chapter 3. Image sampling and quantization Images of limited bandwidth Limited bandwidth image = 2-D signal with finite spectral support: F(νx, νy) = the Fourier transform of the image: The spectrum of a limited bandwidth image and its spectral support

Two-dimensional sampling (1) Digital image processing Chapter 3. Image sampling and quantization Two-dimensional sampling (1) The common sampling grid = the uniformly spaced, rectangular grid: Image sampling = read from the original, spatially continuous, brightness function f(x,y), only in the black dots positions ( only where the grid allows):  

Two-dimensional sampling (2) Digital image processing Chapter 3. Image sampling and quantization Two-dimensional sampling (2) Question: How to choose the values Δx, Δy to achieve: the representation of the digital image by the min. number of samples, at (ideally) no loss of information? (I. e.: for a perfectly uniform image, only 1 sample is enough to completely represent the image => sampling can be done with very large steps; on the opposite – if the brightness varies very sharply => very many samples needed) The sampling intervals Δx, Δy needed to have no loss of information depend on the spatial frequency content of the image. Sampling conditions for no information loss – derived by examining the spectrum of the image  by performing the Fourier analysis: The sampling grid function g(Δx, Δy) is periodical with period (Δx, Δy) => can be expressed by its Fourier series expansion:  

Two-dimensional sampling (3) Digital image processing Chapter 3. Image sampling and quantization Two-dimensional sampling (3) Since: Therefore the Fourier transform of fS is:  The spectrum of the sampled image = the collection of an infinite number of scaled spectral replicas of the spectrum of the original image, centered at multiples of spatial frequencies 1/Δx, 1/ Δy.  

Original image spectrum – 3D Original image spectrum – 2D Digital image processing Chapter 3. Image sampling and quantization Original image Original image spectrum – 3D Original image spectrum – 2D 2-D rectangular sampling grid Sampled image spectrum – 3D Sampled image spectrum – 2D

Image reconstruction from its samples Digital image processing Chapter 3. Image sampling and quantization Let us assume that the filtering region R is rectangular, at the middle distance between two spectral replicas:

1-D sinc function 2-D sinc function Digital image processing Chapter 3. Image sampling and quantization Since the sinc function has infinite extent => it is impossible to implement in practice the ideal LPF it is impossible to reconstruct in practice an image from its samples without error if we sample it at the Nyquist rates. Practical solution: sample the image at higher spatial frequencies + implement a real LPF (as close to the ideal as possible). 1-D sinc function 2-D sinc function

The Nyquist rate. The aliasing. The fold-over frequencies Digital image processing Chapter 3. Image sampling and quantization The Nyquist rate. The aliasing. The fold-over frequencies   Note: Aliasing may also appear in the reconstruction process, due to the imperfections of the filter! How to avoid aliasing if cannot increase the sampling frequencies? By a LPF on the image applied prior to sampling! The Moire effect “Jagged” boundaries

Non-rectangular sampling grids. Interlaced sampling grids Digital image processing Chapter 3. Image sampling and quantization Non-rectangular sampling grids. Interlaced sampling grids Interlaced sampling   Optimal sampling = Karhunen-Loeve expansion:

Digital image processing Chapter 3. Image sampling and quantization Image reconstruction from its samples in the real case The question is: what to fill in the “interpolated” (new) dots? Several interpolation methods are available; ideally – sinc function in the spatial domain; in practice – simpler interpolation methods (i.e. approximations of LPFs).  

Digital image processing Chapter 3. Image sampling and quantization  Image interpolation filters:  

Digital image processing Chapter 3. Image sampling and quantization  Image interpolation examples: 1. Rectangular (zero-order) filter, or nearest neighbour filter, or box filter: Original Sampled Reconstructed  

Digital image processing Chapter 3. Image sampling and quantization  Image interpolation examples: 2. Triangular (first-order) filter, or bilinear filter, or tent filter: Original Sampled Reconstructed  

Digital image processing Chapter 3. Image sampling and quantization  Image interpolation examples: 3. Cubic interpolation filter, or bicubic filter – begins to better approximate the sinc function: Original Sampled Reconstructed  

Digital image processing Chapter 3. Image sampling and quantization Practical limitations in image sampling and reconstruction   Fig. 7 The block diagram of a real sampler & reconstruction (display) system     Fig. 8 The real effect of the interpolation

Digital image processing Chapter 3. Image sampling and quantization 3. Image quantization   Fig. 9 The quantizer’s transfer function 3.1. Overview

Digital image processing Chapter 3. Image sampling and quantization 3.2. The uniform quantizer The quantizer’s design: Denote the input brightness range: Let B – the number of bits of the quantizer => L=2B reconstruction levels The expressions of the decision levels: The expressions of the reconstruction levels: Computation of the quantization error: for a given image of size M×N pixels, U – non-quantized, and U’ – quantized => we estimate the MSE: E.g. B=2 => L=4

Digital image processing Chapter 3. Image sampling and quantization Examples of uniform quantization and the resulting errors: B=1 => L=2 Non-quantized image Quantized image Quantization error; MSE=36.2 The histogram of the non-quantized image

Digital image processing Chapter 3. Image sampling and quantization Examples of uniform quantization and the resulting errors: B=2 => L=4 Non-quantized image Quantized image Quantization error; MSE=15 The histogram of the non-quantized image

Digital image processing Chapter 3. Image sampling and quantization Examples of uniform quantization and the resulting errors: B=3 => L=8; false contours present Non-quantized image Quantized image Quantization error; MSE=7.33 The histogram of the non-quantized image

Digital image processing Chapter 3. Image sampling and quantization 3.2. The optimal (MSE) quantizer (the Lloyd-Max quantizer)

Digital image processing Chapter 3. Image sampling and quantization (Gaussian) , or (Laplacian)   ( variance , - mean)

Digital image processing Chapter 3. Image sampling and quantization Examples of optimal quantization and the quantization error: B=1 => L=2 Non-quantized image Quantized image The quantization error; MSE=19.5 The evolution of MSE in the optimization, starting from the uniform quantizer The non-quantized image histogram

Digital image processing Chapter 3. Image sampling and quantization Examples of optimal quantization and the quantization error: B=2 => L=4 Non-quantized image Quantized image The quantization error; MSE=9.6 The evolution of MSE in the optimization, starting from the uniform quantizer The non-quantized image histogram

Digital image processing Chapter 3. Image sampling and quantization Examples of optimal quantization and the quantization error: B=3 => L=8 Non-quantized image Quantized image The quantization error; MSE=5 The evolution of MSE in the optimization, starting from the uniform quantizer The non-quantized image histogram

Digital image processing Chapter 3. Image sampling and quantization 3.3. The uniform quantizer = the optimal quantizer for the uniform grey level distribution:

Digital image processing Chapter 3. Image sampling and quantization 3.4. Visual quantization methods In general – if B<6 (uniform quantization) or B<5 (optimal quantization) => the "contouring" effect (i.e. false contours) appears in the quantized image. The false contours (“contouring”) = groups of neighbor pixels quantized to the same value <=> regions of constant gray levels; the boundaries of these regions are the false contours. The false contours do not contribute significantly to the MSE, but are very disturbing for the human eye => it is important to reduce the visibility of the quantization error, not only the MSQE. Solutions: visual quantization schemes, to hold quantization error below the level of visibility. Two main schemes: (a) contrast quantization; (b) pseudo-random noise quantization Uniform quantization, B=4 Optimal quantization, B=4 Uniform quantization, B=6

Digital image processing Chapter 3. Image sampling and quantization 3.4. Visual quantization methods a. Contrast quantization The visual perception of the luminance is non-linear, but the visual perception of contrast is linear uniform quantization of the contrast is better than uniform quantization of the brightness contrast = ratio between the lightest and the darkest brightness in the spatial region just noticeable changes in contrast: 2% => 50 quantization levels needed  6 bits needed with a uniform quantizer (or 4-5 bits needed with an optimal quantizer)  

Digital image processing Chapter 3. Image sampling and quantization Examples of contrast quantization: For c=u1/3:  

Digital image processing Chapter 3. Image sampling and quantization Examples of contrast quantization: For the log transform:  

Digital image processing Chapter 3. Image sampling and quantization b. Pseudorandom noise quantization (“dither”) Large dither amplitude Uniform quantization, B=4 Prior to dither subtraction Small dither amplitude

Digital image processing Chapter 3. Image sampling and quantization

Halftone images generation Digital image processing Chapter 3. Image sampling and quantization Halftone images generation Fig.14 Digital generation of halftone images   Demo: http://markschulze.net/halftone/index.html Fig.15 Halftone matrices

Digital image processing Chapter 3. Image sampling and quantization Fig.3.16

Digital image processing Chapter 3. Image sampling and quantization Color images quantization Fig.17 Color images quantization