Lossy Coding 2 JPEG. Perceptual Image Coding. Discrete Cosine Transform JPEG. CS559 Lecture 9 JPEG, Raster Algorithms

Similar documents
Rasterization and Graphics Hardware. Not just about fancy 3D! Rendering/Rasterization. The simplest case: Points. When do we care?

From Vertices to Fragments: Rasterization. Reading Assignment: Chapter 7. Special memory where pixel colors are stored.

From Ver(ces to Fragments: Rasteriza(on

Compression Part 2 Lossy Image Compression (JPEG) Norm Zeck

Computing Visibility. Backface Culling for General Visibility. One More Trick with Planes. BSP Trees Ray Casting Depth Buffering Quiz

Computer Graphics : Bresenham Line Drawing Algorithm, Circle Drawing & Polygon Filling

Renderer Implementation: Basics and Clipping. Overview. Preliminaries. David Carr Virtual Environments, Fundamentals Spring 2005

CS 335 Graphics and Multimedia. Image Compression

Introduction ti to JPEG

Topic #1: Rasterization (Scan Conversion)

Topics du Jour. Questions to Start With. What kinds of things we see. What is Computer Graphics? What is computer graphics?

Scan Conversion. CMP 477 Computer Graphics S. A. Arekete

Compression II: Images (JPEG)

DigiPoints Volume 1. Student Workbook. Module 8 Digital Compression

15 Data Compression 2014/9/21. Objectives After studying this chapter, the student should be able to: 15-1 LOSSLESS COMPRESSION

OpenGL Graphics System. 2D Graphics Primitives. Drawing 2D Graphics Primitives. 2D Graphics Primitives. Mathematical 2D Primitives.

Index. 1. Motivation 2. Background 3. JPEG Compression The Discrete Cosine Transformation Quantization Coding 4. MPEG 5.

Computer and Machine Vision

IMAGE COMPRESSION USING FOURIER TRANSFORMS

Compression; Error detection & correction

Scan Conversion. Drawing Lines Drawing Circles

Computer Graphics Prof. Sukhendu Das Dept. of Computer Science and Engineering Indian Institute of Technology, Madras Lecture - 14

Video Compression MPEG-4. Market s requirements for Video compression standard

Rasterization: Geometric Primitives

Features. Sequential encoding. Progressive encoding. Hierarchical encoding. Lossless encoding using a different strategy

Digital Image Representation Image Compression

Computer Vision 2. SS 18 Dr. Benjamin Guthier Professur für Bildverarbeitung. Computer Vision 2 Dr. Benjamin Guthier

IMAGE COMPRESSION. Image Compression. Why? Reducing transportation times Reducing file size. A two way event - compression and decompression

CS Rasterization. Junqiao Zhao 赵君峤

3 Data Storage 3.1. Foundations of Computer Science Cengage Learning

Drawing Fast The Graphics Pipeline

Lecture 8 JPEG Compression (Part 3)

0. Introduction: What is Computer Graphics? 1. Basics of scan conversion (line drawing) 2. Representing 2D curves

Does everyone have an override code?

Image Compression Techniques

Line Drawing Week 6, Lecture 9

CS 450: COMPUTER GRAPHICS REVIEW: DRAWING LINES AND CIRCLES SPRING 2015 DR. MICHAEL J. REALE

Rasterization, or What is glbegin(gl_lines) really doing?

CPSC / Scan Conversion

Multimedia Systems Image III (Image Compression, JPEG) Mahdi Amiri April 2011 Sharif University of Technology

Compression; Error detection & correction

VC 12/13 T16 Video Compression

CMPT 365 Multimedia Systems. Media Compression - Image

Graphics (Output) Primitives. Chapters 3 & 4

In today s lecture we ll have a look at: A simple technique The mid-point circle algorithm

Fundamentals of Video Compression. Video Compression

Lecture 13 Video Coding H.264 / MPEG4 AVC

IT Digital Image ProcessingVII Semester - Question Bank

Chapter - 2: Geometry and Line Generations

Output Primitives. Dr. S.M. Malaek. Assistant: M. Younesi

Perceptual Coding. Lossless vs. lossy compression Perceptual models Selecting info to eliminate Quantization and entropy encoding

MODULE - 4. e-pg Pathshala

Lossy compression CSCI 470: Web Science Keith Vertanen Copyright 2013

Introduction to Computer Science (I1100) Data Storage

Digital Image Processing. Prof. P. K. Biswas. Department of Electronic & Electrical Communication Engineering

Tópicos de Computação Gráfica Topics in Computer Graphics 10509: Doutoramento em Engenharia Informática. Chap. 2 Rasterization.

Review and Implementation of DWT based Scalable Video Coding with Scalable Motion Coding.

EF432. Introduction to spagetti and meatballs

Anatomy of a Video Codec

Scan Converting Lines

JPEG Compression. What is JPEG?

The Traditional Graphics Pipeline

Image Compression Algorithm and JPEG Standard

Professor Laurence S. Dooley. School of Computing and Communications Milton Keynes, UK

Display Technologies: CRTs Raster Displays

JPEG Compression Using MATLAB

Wireless Communication

Raster Displays and Scan Conversion. Computer Graphics, CSCD18 Fall 2008 Instructor: Leonid Sigal

Lecture 5: Compression I. This Week s Schedule

Lecture 8 JPEG Compression (Part 3)

3. (a) Prove any four properties of 2D Fourier Transform. (b) Determine the kernel coefficients of 2D Hadamard transforms for N=8.

Lossy compression. CSCI 470: Web Science Keith Vertanen

Data Representation and Networking

Engineering Mathematics II Lecture 16 Compression

Announcements. Midterms graded back at the end of class Help session on Assignment 3 for last ~20 minutes of class. Computer Graphics

Image Pyramids and Applications

CS 260: Seminar in Computer Science: Multimedia Networking

Four Types of Slope Positive Slope Negative Slope Zero Slope Undefined Slope Slope Dude will help us understand the 4 types of slope

Chapter 8: Implementation- Clipping and Rasterization

Output Primitives Lecture: 3. Lecture 3. Output Primitives. Assuming we have a raster display, a picture is completely specified by:

2D rendering takes a photo of the 2D scene with a virtual camera that selects an axis aligned rectangle from the scene. The photograph is placed into

AUDIOVISUAL COMMUNICATION

Logo & Icon. Fit Together Logo (color) Transome Logo (black and white) Quick Reference Print Specifications

Overview of Computer Graphics

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

Course Syllabus. Website Multimedia Systems, Overview

Digital Signal Processing Lecture Notes 22 November 2010

Topic 5 Image Compression

The Traditional Graphics Pipeline

ECE 417 Guest Lecture Video Compression in MPEG-1/2/4. Min-Hsuan Tsai Apr 02, 2013

The Traditional Graphics Pipeline

(Refer Slide Time: 00:03:51)

ITEC310 Computer Networks II

Review for the Final

Part 1 of 4. MARCH

Image Processing Computer Graphics I Lecture 15

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

Introduction to Computer Graphics (CS602) Lecture 05 Line Drawing Techniques

Digital Video Processing

What is multimedia? Multimedia. Continuous media. Most common media types. Continuous media processing. Interactivity. What is multimedia?

Transcription:

CS559 Lecture 9 JPEG, Raster Algorithms These are course notes (not used as slides) Written by Mike Gleicher, Sept. 2005 With some slides adapted from the notes of Stephen Chenney Lossy Coding 2 Suppose we can only send a fraction of the image Which part? Send half an image: Send the top half (not too good) Halve the image in size (send the low frequency half) Idea: re-order (transform) the image so the important stuff is first 2005 Michael L. Gleicher Perceptual Image Coding Idea: lose stuff in images that is least important perceptually Stuff least likely to notice Stuff most likely to convey image Who knows about this stuff: The experts! Joint Picture Experts Group Idea of perceptual image coding JPEG Key Ideas Frequency Domain (small details are less important) Block Transforms (works on 8x8 blocks) Discrete Cosine Transform (DCT) Control Quantization of frequency components More quality = use more bits Generally, use less bits for HF JPEG Multi-stage process intended to get very high compression with controllable quality degradation Start with YIQ color Why? Recall, it s the color standard for TV Discrete Cosine Transform A transformation to convert from the spatial to frequency domain done on 8x8 blocks Why? Humans have varying sensitivity to different frequencies, so it is safe to throw some of them away Basis functions: 1

Quantization Reduce the number of bits used to store each coefficient by dividing by a given value If you have an 8 bit number (0-255) and divide it by 8, you get a number between 0-31 (5 bits = 8 bits 3 bits) Different coefficients are divided by different amounts Perceptual issues come in here Achieves the greatest compression, but also quality loss Quality knob controls how much quantization is done Entropy Coding Standard lossless compression on quantized coefficients Delta encode the DC components Run length encode the AC components Lots of zeros, so store number of zeros then next value Huffman code the encodings Lossless JPEG With Prediction Predict what the value of the pixel will be based on neighbors Record error from prediction Mostly error will be near zero Huffman encode the error stream Variation works really well for fax messages Video Compression Much bigger problem (many images per second) Could code each image seperately Motion JPEG DV (need to make each image a fixed size for tape) Need to take advantage that different images are similar Encode the Changes? MPEG Motion Picture Experts Group Standards organization MPEG-1 simple format for videos (fixed size) MPEG-2 general, scalable format for video MPEG-4 computer format (complicated, flexible) MPEG-7 future format What about MPEG-3? it doesn t exist (?) MPEG-1 Layer 3 = audio format MPEG Concepts Keyframe Need something to start from Reset when differences get too far Difference encoding Differences are smaller/easier to encode than images Motion Some differences are groups of pixels moving around Block motion Object motion (models) 2

MPEG Frame 1 (keyframe) Frame 1 Find motion vectors Frame 2 (keyframe) lossy Jpeg-like compression Frame 1 (comp) + motion Encode vectors Encode Difference (lossy) Frame 2 Other Practical Tricks Don t really know what is in image Makes it hard to make changes Getting rid of noise Low pass filters Edge-preserving filtering Sharpening Can we actually do it? (no adding aliasing) High-Pass attenuation Unsharp mask (subtract out low frequencies) Feathering Sharp transitions are noticeable Blend/Blur around edges of changes Geometric Graphics Mathematical descriptions of sets of points Rather than sampled representations Ultimately, need sampled representations for display Rasterization Usually done by low-level OS / Graphics Library / Hardware Hardware implementations counter-intuitive Modern hardware doesn t work anything like what you d expect Drawing Points What is a point? Position without any extent Can t see it since it has no extent, need to give it some Position requires co-ordinate system Consider these in more depth later How does a point relate to a sampled world? Points at samples? Pick closest sample? Give points finite extent and use little square model? Use proper sampling Sampling a point Point is a spike need to LPF Gives a circle w/roll-off Point sample this Or Samples look in circular (kernel shaped) regions around their position But, we can actually record a unique splat for any individual point Anti-Aliasing Anti-Aliasing is about avoiding aliasing once you ve aliased, you ve lost Draw in a way that is more precise E.g. points spread out over regions Not always better Lose contrast, might not look even if gamma is wrong, might need to go to binary display, 3

Line drawing Was really important, now, not so important Let us replace expensive vector displays with cheap raster ones Modern hardware does it differently Actually, doesn t draw lines, draws small, filled polygons Historically significant algorithms Line Drawing (2) Consider the integer version (x1,y1) -> (x2,y2) are integers Not anti-aliased (binary decision on pixels) Naïve strawman version: Y = mx + b For x = x1 to x2 y = mx + b set(x,y) Problems: Too much math (floating point) gaps Brezenham s algorithm (and variants) Midpoint method Consider only 1 octant (get others by symmetry) 0 >= m > = 1 Loop over x pixels Guaruntees 1 per column For each pixel, either move up 1 or not If you plotted x,y then choose either x+1,y or x+1,y+1 Trick: how to decide which one easily Same method works for circles (just need different test) Decision variable Implicit equation for line (d=0 means on the line) x k, y k y k+1 d 2 d 1 y k x k+1 d 1 = y-y k d 2 = y k + 1 - y If d 1 < d 2 pick y k otherwise pick y k +1 If d 1 -d 2 < 0 pick y k ^^^--- Δd Derivation Δ d = d 1 d 2 Δ d = (y-y k ) (y k +1-y) y = m(x k +1) + b Δd = 2 (m (x k +1) + b) 2 y k 1 m = Δy /Δ x Multiply both sides by Δx (since we know its positive) ΔdΔx = 2Δy x k +2Δy + 2bΔx 2Δx y k Δx P k = ΔdΔx = 2Δ y x k + 2Δx y k + c c = 2Δy + Δx(2b 1) (all the stuff that doesn t depend on k) Incremental Algorithm Suppose we know p k what is p k+1? p k+1 = p k + 2Δy 2Δx (y k+1 y k ) Since x k+1 = x k +1 And y k+1 y k is either 1 or 0, depending on p k 4

Brezenham s Algorithm Why is this cool? P_k = 2 \Delta y + x Y = y 1 For X = x 1 to x 2 Set X,Y If P k < 0 Y += 1 P k += 2 Δ y 2 Δ x Else: P k += 2Δ y No division! No floating point! No gaps! Extends to circles But Jaggies Lines get thinner as they approach 45 degrees Can t do thick primitives 5