Department of Electrical and Computer Engineering

Slides:



Advertisements
Similar presentations
Digital Image Processing Lecture 3: Image Display & Enhancement
Advertisements

Sampling and Pulse Code Modulation
Image Data Representations and Standards
Digital Imaging and Image Analysis
Quantization Prof. Siripong Potisuk.
Capturing and optimising digital images for research Gilles Couzin.
School of Computing Science Simon Fraser University
CSE 589 Applied Algorithms Spring 1999 Image Compression Vector Quantization Nearest Neighbor Search.
1 Preprocessing for JPEG Compression Elad Davidson & Lilach Schwartz Project Supervisor: Ari Shenhar SPRING 2000 TECHNION - ISRAEL INSTITUTE of TECHNOLOGY.
A Parallel Algorithm for Hardware Implementation of Inverse Halftoning Umair F. Siddiqi 1, Sadiq M. Sait 1 & Aamir A. Farooqui 2 1 Department of Computer.
Losslessy Compression of Multimedia Data Hao Jiang Computer Science Department Sept. 25, 2007.
A Parallel Algorithm for Hardware Implementation of Inverse Halftoning Umair F. Siddiqi 1, Sadiq M. Sait 1 & Aamir A. Farooqui 2 1 Department of Computer.
Chapter 2: Digital Image Fundamentals Fall 2003, 劉震昌.
CS559-Computer Graphics Copyright Stephen Chenney Image File Formats How big is the image? –All files in some way store width and height How is the image.
Image Processing 고려대학교 컴퓨터 그래픽스 연구실 cgvr.korea.ac.kr.
Department of Physics and Astronomy DIGITAL IMAGE PROCESSING
IDL GUI for Digital Halftoning Final Project for SIMG-726 Computing For Imaging Science Changmeng Liu
IMAGE SAMPLING AND IMAGE QUANTIZATION 1. Introduction
Lab #5-6 Follow-Up: More Python; Images Images ● A signal (e.g. sound, temperature infrared sensor reading) is a single (one- dimensional) quantity that.
CE Digital Signal Processing Fall 1992 Waveform Coding Hossein Sameti Department of Computer Engineering Sharif University of Technology.
Color and Resolution Introduction to Digital Imaging.
Image Processing and Sampling
Digital image processing Chapter 3. Image sampling and quantization IMAGE SAMPLING AND IMAGE QUANTIZATION 1. Introduction 2. Sampling in the two-dimensional.
Digital Image Processing Lecture 3: Image Display & Enhancement March 2, 2005 Prof. Charlene Tsai.
MACHINE LEARNING 8. Clustering. Motivation Based on E ALPAYDIN 2004 Introduction to Machine Learning © The MIT Press (V1.1) 2  Classification problem:
Computer Vision Introduction to Digital Images.
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.
IT-101 Section 001 Lecture #9 Introduction to Information Technology.
LUT Method For Inverse Halftone 資工四 林丞蔚 林耿賢. Outline Introduction Methods for Halftoning LUT Inverse Halftone Tree Structured LUT Conclusion.
Vector Quantization Vector quantization is used in many applications such as image and voice compression, voice recognition (in general statistical pattern.
Vector Quantization CAP5015 Fall 2005.
Digital Image Processing
3-1 Chapter 3: Image Display The goodness of display of an image depends on (a) Image quality: i) Spatial resolution, ii) Quantization (b) Display device:
Chapter 8 Lossy Compression Algorithms. Fundamentals of Multimedia, Chapter Introduction Lossless compression algorithms do not deliver compression.
1 What is Multimedia? Multimedia can have a many definitions Multimedia means that computer information can be represented through media types: – Text.
Graphics II Image Processing I. Acknowledgement Most of this lecture note has been taken from the lecture note on Multimedia Technology course of University.
ITEC2110, Digital Media Chapter 2 Fundamentals of Digital Imaging 1 GGC -- ITEC Digital Media.
BITMAPPED IMAGES & VECTOR DRAWN GRAPHICS
Chapter 8 Lossy Compression Algorithms
Introduction to Discrete-Time Control Systems fall
LINEAR CLASSIFIERS The Problem: Consider a two class task with ω1, ω2.
The Johns Hopkins University
Analog to digital conversion
Image Processing Digital image Fundamentals. Introduction to the course Grading – Project: 30% – Midterm Exam: 30% – Final Exam : 40% – Total: 100% –
Lossy Compression of Stochastic Halftones with JBIG2
Image Processing and Sampling
Chapter 3 向量量化編碼法.
Sampling rate conversion by a rational factor
Image and Video Processing – An Introduction
School of Electrical and
Scalar Quantization – Mathematical Model
Soutenance de thèse vendredi 24 novembre 2006, Lorient
لجنة الهندسة الكهربائية
Exposing Digital Forgeries by Detecting Traces of Resampling Alin C
A Review in Quality Measures for Halftoned Images
A Data Hiding Scheme Based Upon Block Truncation Coding
PCM & DPCM & DM.
CSC 381/481 Quarter: Fall 03/04 Daniela Stan Raicu
© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
IMAGE SAMPLING AND IMAGE QUANTIZATION 1. Introduction
Foundation of Video Coding Part II: Scalar and Vector Quantization
COMS 161 Introduction to Computing
Image filtering
第 四 章 VQ 加速運算與編碼表壓縮 4-.
Basic Concepts of Digital Imaging
© 2010 Cengage Learning Engineering. All Rights Reserved.
Digital Image Processing Lecture 3: Image Display & Enhancement
Image Filtering Readings: Ch 5: 5. 4, 5. 5, 5. 6, , 5
A Parallel Algorithm for Hardware Implementation of Inverse Halftoning
Presentation transcript:

Department of Electrical and Computer Engineering EEL 6562 Image Processing and Computer Vision Lecture 4 Image Quantization Dr. Dapeng Oliver Wu University of Florida Department of Electrical and Computer Engineering Fall 2016

Outline Introduction Uniform quantization Minimum Mean Squared Error (MMSE) quantization Scalar quantization Vector quantization Machine learning, data mining, bioinformatics, source coding, computer vision, pattern recognition, artificial intelligence Implementation Visual quantization Half toning

Image Sampling Sampling by i = 0 Δx 1 … N - 1 Δy y’ x’ j = 0 1 2 M-1

Examples i N-1 M-1 j

Matrix Representation fmin ≤ f(i, j) ≤ fmax , value in a continuum Popular image size N = 64, M = 64 (26), # of pixels = 4,096. N = 512, M = 512 (29), # of pixels = 262,144. N = 1280, M = 1024, # of pixels = 1,310,720.

Purposes of Quantization Analog to digital conversion (ADC) Use a finite number of (discrete) values to represent infinite number of (continuous) values Compression: Use less number of (discrete) values to represent a continuous/discrete signal It is like election in human society Question: how to choose representative values and the regions being represented? There are infinite number of ways. Which is optimal?

Quantization fmax fmin

A Quantizer Q(f) Quantizer f Q(f) r8 r7 Decision Levels {tk, k = 1, …, L+1} r6 Reconstruction Levels {rk, k = 1, …, L} r5 If r4 f Then Q(f) = rk t1 t2 t3 t4 t5 t6 t7 t8 L levels need bits r3 returns the smallest integer that is bigger than or equal to x r2 Quantizer error r1 r0 r0 r1 r2 r3 r4 r5 r6 r7 r8 f t1 t2 t3 t4 t5 t6 t7 t8

Matrix Representation For grayscale image, 256 levels or 8 bits/pixel is sufficient for most applications For color image, each component (R, G, B) needs 256 levels or 8 bits/pixel (bpp) Storage for typical images 512 x 512, 8 bits grayscale image: 262,144 Bytes 1024 x 768, 24 bits true color image: 2,359,296 Bytes

Uniform Quantization Equal distances between adjacent decision levels and between adjacent reconstruction levels tl – tl-1 = rl – rl-1 = q Parameters of Uniform Quantization L: levels (L = 2R) B: dynamic range B = fmax – fmin q: quantization interval (stepsize), which is uniform q = B/L = B2-R Quantization function Note: returns the biggest integer that is smaller than or equal to x

A Uniform Quantizer Q(f) r7=fmax-q/2 r6 r5 r4 stepsize q=(fmax-fmin)/8 r0=fmin+q/2 f t0 t1 t2 t3 t4 t5 t6 t7 t8 fmin fmax

Truncated Uniform Quantizer Signal with infinite dynamic range Truncate the lower and higher values to fmin and fmax Parameters fmin, fmax L (R) Quantization function

A Truncated Uniform Quantizer overload region Q(f) r7=fmax-q/2 r6 r5 r4 r3 r2 r1 r0=fmin+q/2 f t0 =-∞ fmin t1 t2 t3 t4 t5 t6 t7 fmax t8 =∞ overload region

Example 1 of Uniform Quantizer The output of a CCD camera is in the range of 0.0 to 5.0 volt L = 256 q = 5 / 256 (volt) The output value in the interval (l * q, (l + 1) * q] is represented by l, l = 0, …, 255. The reconstruction level rl = l * q + q/2, l = 0,…, 255.

Example 2 of Uniform Quantizer Digital Image of 256 gray levels Quantize it into 4 levels fmin= 0, fmax = 256, q = 256 / 4 = 64, q/2 = 32, Compress the image from 8 bits/pixel to 2 bits/pixel. The compression ratio is 4.

Examples of Uniform Quantizer q=8, L=32 Original, L=256 q=16, L=16 q=64, L=4

Performance Measures for a Quantizer Mean squared error (MSE) Peak Signal to Noise Ratio (PSNR)

Implementation of Uniform Quantization Setup the quantization function Q(f) for all possible input level first. Matlab code x = imread('lena_gray.bmp'); [height, width] = size(x); B = 256; x = double(x); % This is the quantization table Q = zeros(256, 1); % Quantized to 16 levels L = 16; q = B / L; for i = 0:255, Q(i+1, 1) = floor(i / q) * q + q /2; end y = zeros(size(x)); for i = 1:height, for j = 1:width, y(i, j) = Q(x(i,j) + 1); MSE = mean(mean((x-y).^2)) PSNR =10*log10(255^2/MSE) % in dB y=uint8(y); imshow(y) L = 16, MSE = 21.6, PSNR=34.8 dB

Quantization Effect – False Contour 1-D Signal 2-D Image f(t) t t f(i,j)=max(I,j)

Minimum Mean Square Error Quantizer Mean squared error (MSE) of a quantizer Where p(f) is the probability density function of f Uniform distribution Gaussian distribution Laplacian distribution MSE for a specific image Minimize E in terms of {tk} and {rk}

Minimum Mean Square Error Quantizer MMSE Quantizer Nearest neighbor condition Centriod condition

MMSE Quantizer for A Uniform Source

MMSE Quantizer Example for a Uniform Source Original Image L=64, MSE=1.507 L=16, MSE=21.624 L=2, MSE=1384.15 L=8, MSE=83.725 L=4, MSE=368.50

MMSE Quantizer for a Non-uniform Source Following conditions may not have a closed form solution Numerical procedures are necessary Tables 4.1 and 4.2 in Jain’s book give the optimal tl and rl for Gaussian and Laplacian sources with unit variance and zero mean. Anil K. Jain, ``Fundamentals of digital image processing,'' Englewood Cliffs, NJ : Prentice Hall, 1989. 

MMSE Quantizer Example for a Gaussian Source Original Image PDF: Gaussian μf=128, σf=36 Uniform Quantization L=16, MSE=22.73 MMSE Quantization L=16, MSE=14.35

Types of Quantization Scalar quantization: Vector quantization Quantize a scalar random variable into representative scalars The scalar random variable can be continuous or discrete Vector quantization Quantize a random vector into representative vectors The random vector can be continuous or discrete

Llyod Algorithm When the distribution of the signal is unknown The quantizer is designed based on a training set containing representative samples tl and rl are determined iteratively, based on the nearest neighbor and centroid conditions, respectively.

Lloyd Algorithm (for scalar quantization) Iterative algorithms for determining MMSE quantizer parameters Can be based on a pdf or training data Iterate between centroid condition (election) and nearest neighbor condition (partitioning)

Generalized Lloyd Algorithm (for vector quantization) Start with initial codewords Iterate between centroid condition (senator election) and nearest neighbor condition (constituency partitioning)

Visual Quantization Reduce the artifact of false contour Better visual perception (Human eyes are very sensitive to edges) Might produce worse MSE

Pseudo Random Noise Quantizer f Uniform Quantizer Q() Step size: q + g + + + + - h Random Noise Generator Uniform in (-q/2, q/2)

Example 8 Level Pseudo Random 8 Level Uniform Quantizer MSE=85.84 8 Level Pseudo Random Noise Quantizer MSE=86.09

Halftoning Halftoning Use 2 levels to render a multi-level image Create the illusion of continuous-tone pictures on bi-level printers or display devices. E.g, representing gray scale image using 2 levels (black and white) CMYB color printer (using cyan, magenta, yellow, black toners) Black/white printer (using black toner) monochrome monitor

Dithering Halftoning is achieved by dithering Two Level Quantizer f + fw + (Multiple levels) - fb (Two levels; applied to one dot) Dither Signal d For a B/W printer, 600 dpi (dots per inch); one square inch has 360,000 dots. # of dots in black determines gray level.

Types of Dithering Ordered dithering Error-diffusion-based dithering

d Ordered Dither Signal Dither signal d(m,n) is obtained by repeating a kxk dither matrix Dk(m,n) d(m, n) = Dk([m]k, [n]k), where [m]k means m modulo k. Criteria for the dither matrix Contains sufficiently distinct values Similar values should be separated as far as possible Dk d Dk Dk Dk Dk Dk … … …

Recursive Design of the Dither Matrix Define D2 Recursion where Uk is a kxk matrix of 1’s. Usage Dk needs to be scaled and shifted, q=256/2k

Example K = 4, q = 16 fb=64 fw=192 Halftoning with k=4, q=16 2 Level Uniform Quantization Halftoning with k=4, q=16

Halftoning Using Error Diffusion + - e[n-1] Delay

Quantization Summary Typically L = 28 = 256 and we have log2(L) = log2(28) = 8 bit quantization. From now on omit references to fmin; fmax and unless otherwise stated assume that the original digital images are quantized to 8 bits or 256 levels. To denote this refer to as taking integer values k where 0≤k≤255, i.e., let us say that {0, …, 255}

Homework 2 Using Matlab or C or any other computer language, to implement uniform quantization of the grayscale image in “YourLastNameGray.jpg” obtained in HW1. Your program should do the following: i) read a grayscale image into an array; ii) quantize and save the quantized image in a different array; iii) compute the MSE between the original and quantized images; and iv) display and print the quantized image. Your program should allow you to vary the reconstruction level (L). Record the MSE obtained with L=64, 32, 16, 8, and save the quantized images with corresponding L values, MSE values, and PSNR values. Your submission should include 1) your computer program file and 2) an MS WORD file that contains L values, MSE values, PSNR values, and the images. Please put the images in the WORD file, instead of in JPEG files. JPEG files are not allowed to upload as separate files.

Homework 2 Put your solution in a single WORD file or a single pdf file. Submit your homework in the format of WORD file, Matlab file, or pdf through E-Learning web site under the directory of Homework 2. Please submit your homework in separate files (e.g., *.m or *.doc or *.pdf). Please do not submit zip files or JPEG files. JPEG files should be embedded in a WORD file or pdf file. Due: 4pm, 9/14

Reading “Digital Image Processing”, Chapter 2 (Section 2.4.1 – 2.4.3)