This preview shows page 1. Sign up to view the full content.
Unformatted text preview: Image CGT 511
Computer Images
Bedřich Beneš, Ph.D.
Purdue University
Department of Computer Graphics Technology Is continuous 2D image function 2D intensity light function
z=f(x,y) defined over a square 0 x,y 1
Continuous image is mathematical abstraction! © Bedrich Benes Image Digital Image the value of z can be: a single value I ‐ intensity of the light (grayscale) B ‐ 0/1 binary continuous image a triplet RGB, CMY, HSV, HLS, etc. an array samples of spectrum a[256] Is a discretization of a continuous image © Bedrich Benes discrete image function z=I(x,y) x,y = 0,1,…N, M, N x M the image resolution
z can be the same as in the continuous case
© Bedrich Benes Digital Image Digitalization Discrete image
a matrix picture elements ‐ pixels a process of making a continuous function discrete Pixel is determined by discrete coordinates e,g., [5, 3] and has some value z pixel 1) Sampling
2) Quantization 12345678
© Bedrich Benes Examples: DVD, cell phone, computer image, video camera, tungsten fluorescent light
ca e a, tu gste uo esce t
t
It is a two step process 12345678 © Bedrich Benes Rasterization Pasteurization • Process of finding the best pixels for a continuous object
• Examples:
Bresenham’s algorithm for lines and circles
Digital Differential Analyzer for lines
etc • Pasteurization
is the process of heating liquids for the purpose of destroying bacteria, protozoa, molds, and yeasts. The process was named after its creator, French chemist and microbiologist Louis Pasteur. • Source: [Wikipedia] © Bedrich Benes © Bedrich Benes Sampling Sampling Error Taking values of a continuous function in equally spread intervals • Decreasing the spatial resolution introduces
Pixelization error Sampling frequency f how often the sample is taken
continuous
function © Bedrich Benes samples x Sampling Error f 1
x entire span has
one value • It has much worse presence as alias • (we will talk about it later) © Bedrich Benes Quantization
• is rounding a number to a defined value e.g., 1.2 to 1; 1.4 to 1; 1.6 to 2; etc
• Typically, it assigns a representative to an interval (do you remember the adaptive palette?) © Bedrich Benes © Bedrich Benes 6
5
4 5
4
3
3
2
2
1
1
Original continuous
values 0 0
New
discrete
values Quantization Error Mach Band Effects • Some information is lost
• The introduced error is called quantization error
• Audio ‐ quantization noise
• Images ‐as Mach Band effects
Ernst Mach 1938‐1916 © Bedrich Benes Mach Band Effects © Bedrich Benes Computer Images
1) Raster images
A raster image has given resolution and we (usually) cannot distinguish objects
consists of pixels
examples: TGA, JPG, GIF, TIF, PCX, BMP, PNG, etc. © Bedrich Benes 16.7 millions, 256, 64, 32, 16, 4 colors © Bedrich Benes Computer Images OCR 2) Vector • Object recognition in pixels
is a task of computer vision
• Very hard task • Works well for clearly defined problems
OCR (optical character recognition)
converting scanned text into letters
use semantic information (“he is” rather than “he ic”) a database of 2D objects image usually has NO resolution can be scaled to arbitrary size.
examples: WMF (windows metafile), PS (postscript),Clip Arts, Flash, PDF
© Bedrich Benes © Bedrich Benes Image Compression ‐ motivation Compression Factor Example:
How much space do we need for 5 minutes of uncompressed video?
Answer:
25 fps, 768x524 pixels, RGB ~ 3 bytes/pixel
25[fps]*60[sec]*5[min]*768*524*3 [bytes]=
=9 [Giga bytes] Compression factor
is the ratio between compressed and uncompressed representation © Bedrich Benes Example:
TGA has 0.25MB and the same file as JPEG has 51kbytes. Find the compression factor.
Solution
compression factor is 51/250 = 0.204, i.e., JPEG takes 20% of the size © Bedrich Benes Compression Compression Data
is the mean by which the information is conveyed Data redundancy:
data that is not carrying any new information
"I was there only with John. We were two."
(psycho visual redundancy) Data compression:
reducing the amount of data required to represent given quantity of information © Bedrich Benes Data irrelevancy:
Part of information that cannot be distinguished when missing
© Bedrich Benes Compression Run Length Encoding (RLE) Two basic groups of compression algorithms Idea: Lossless (error free) decreases redundancy
Lossy (non error free) decreases irrelevancy sequence of equal values is substituted by a pair
[# of repetitions, number] Example: Lossless: 10 10 10 10 10 10 10 10 10 = 9 x 10 Lossy: 12 11 10 12 11 11 11 10 11 (approx. by)
11 11 11 11 11 11 11 11 11 = 9x11 Example:
021111111122220000 can be written as
10 12 81 42 40
Compression factor 10/18 = 0.56 © Bedrich Benes © Bedrich Benes Run Length Encoding (RLE) Run Length Encoding (RLE) Noisy sequence: 01010101 we get 10 11 10 11 10 11 10 11 Compression factor = 16/8 = 2 (!) Solution: we define a special symbols “(“ and “)” that denote beginning and ending of an uncompressed sequence
Example: 1212222222221212 = (121) 9 2 (1212)
Compression factor = 13/16=0.8125 This is called the negative compression © Bedrich Benes © Bedrich Benes Run Length Encoding ‐ Summary Lempel‐Ziv‐Welch (LZW) •
•
•
•
•
•
•
• Idea: Lossless (no error)
good for cartoons, handwritings
good for large areas of the same color
bad for noisy images
used in compressed TGA, TIFF
known since 1952, used in FAX machines
2D run length encoding also exists © Bedrich Benes find the most frequented longest sequences and replace them by short ones so called dictionary based encoding © Bedrich Benes Lempel‐Ziv‐Welch (LZW) Lempel‐Ziv‐Welch (LZW) Example:
An alphabet {A, B, CC, XYZ}
Sequence: 123457988123458777987712345(length=26)
Make dictionary, find the coded sequence and get the compression factor. Dictionary: 12345= A – 3x in the sequence
798 = B – 2x in the sequence
77 = CC – 2x in the sequence
8
= XYZ – 1x
Old sequence: 123457988123458777987712345
New seq.: A B XYZ A XYZ CC B CC A (length15)
Compression factor = 15/26 = 0.5769 © Bedrich Benes Lempel‐Ziv‐Welch (LZW) summary
• good for noisy images
• also good for large areas of the same color
• slow compression, fast decompression (asymmetric) • complex algorithm
• used in GIF, TIFF, PNG
• also in ZIP, Compress, gzip, RAR, LHARC, ZOO
• very good compression technique
• lossless
© Bedrich Benes © Bedrich Benes JPEG
•
•
•
•
•
•
• Joint Photographic Experts Group (ISO)
it is lossy compression
based on DCT (discrete cosine transform)
fast and good compression
always introduces artifacts
Optimized is usually smaller
Progressive (interlacing) © Bedrich Benes JPEG Adobe® PostScript (PS)
•
•
•
•
• © Bedrich Benes Original JPEG compression it is a page description language
allows also inclusion of bitmaps
communication language for printers
text or binary format
no internal compression ‐ but can be © Bedrich Benes Adobe® PostScript (PS) Summary %!PSAdobe2.0 EPSF2.0
EPSF
%%BoundingBox: 63 266 549 526
%%Pages: 1
%%EndComments
%%EndProlog
%%Page: 1 1
% lower left corner
63 266 translate
% size of image (on paper, in 1/72inch coords)
486.00000 259.99200 scale
259
scale
486 260 8
% dimensions of data
[486 0 0 260 0 260]
% mapping matrix
{currentfile pix readhexstring pop}
Image
fffffffffffffFfffffffffffffffffffffffffffffffffffffff00000ffffff0000000fffff...
showpage
% stop using temporary dictionary
end
%%Trailer • continuous and discrete image © Bedrich Benes • digitalization ‐ sampling and quantization
• Pixelization and Mach band effect
• Compression factor
• RLE, LZW
• raster and vector images
© Bedrich Benes Readings
Rafael Gonzales, Richard Woods, Digital Image Processing, Addison Wesley Publishing, 1993, pages 307 ‐> Peter Shirley et al, Fundamentals of Computer Graphics 2nd edition, pp 71‐118 © Bedrich Benes ...
View Full
Document
 Fall '08
 Mohler,J

Click to edit the document details