Presentation is loading. Please wait.

Presentation is loading. Please wait.

02/05/2002 (C) University of Wisconsin 2002, CS 559 Last Time Color Quantization Mach Banding –Humans exaggerate sharp boundaries, but not fuzzy ones.

Similar presentations


Presentation on theme: "02/05/2002 (C) University of Wisconsin 2002, CS 559 Last Time Color Quantization Mach Banding –Humans exaggerate sharp boundaries, but not fuzzy ones."— Presentation transcript:

1 02/05/2002 (C) University of Wisconsin 2002, CS 559 Last Time Color Quantization Mach Banding –Humans exaggerate sharp boundaries, but not fuzzy ones

2 02/05/2002 (C) University of Wisconsin 2002, CS 559 Today Homework 1 is due –Box up front Dithering (Digital Halftoning)

3 02/05/2002 (C) University of Wisconsin 2002, CS 559 Dithering (Digital Halftoning) Mach bands can be removed by adding noise along the boundary lines General perceptive principle: replaced structured errors with noisy ones and people complain less Old industry dating to the late 1800’s –(Can’t say since the turn of the century!) –Methods for producing grayscale images in newspapers and books

4 02/05/2002 (C) University of Wisconsin 2002, CS 559 Dithering to Black-and-White Black-and-white is still the preferred way of displaying images in many areas –Black ink is cheaper than color –Printing with black ink is simpler and hence cheaper –Paper for black inks is not special To get color to black and white, first turn into grayscale: I=0.299R+0.587G+0.114B –This formula reflects the fact that green is more representative of perceived brightness than blue is

5 02/05/2002 (C) University of Wisconsin 2002, CS 559 Sample Images

6 02/05/2002 (C) University of Wisconsin 2002, CS 559 Threshold Dithering For every pixel: If the intensity < 0.5, replace with black, else replace with white –0.5 is the threshold –This is the naïve version of the algorithm To keep the overall image brightness the same, you should: –Compute the average intensity over the image –Use a threshold that gives that average –For example, if the average intensity is 0.6, use a threshold that is higher than 40% of the pixels, and lower than the remaining 60% For all dithering we will assume that the image is gray and that intensities are represented as 0-1.0 –If you have a 0-255 image, you can scale all the thresholds (multiply by 255)

7 02/05/2002 (C) University of Wisconsin 2002, CS 559 Naïve Threshold Algorithm

8 02/05/2002 (C) University of Wisconsin 2002, CS 559 Random Modulation Add a random amount to each pixel before thresholding –Typically add uniformly random amount from [-a,a] Pure addition of noise to the image –As stated above, we are adding uniformly random noise –For better results, add better quality noise –For instance, use Gaussian noise Should use same procedure as before for choosing threshold Not good for black and white, but OK for more colors –Add a small random color to each pixel before finding the closest color in the table

9 02/05/2002 (C) University of Wisconsin 2002, CS 559 Random Modulation

10 02/05/2002 (C) University of Wisconsin 2002, CS 559 Ordered Dithering Break the image into small blocks Define a threshold matrix –Use a different threshold for each pixel of the block –Compare each pixel to its own threshold The thresholds can be clustered, which looks like newsprint The thresholds can be “random” which looks better Threshold matrix

11 02/05/2002 (C) University of Wisconsin 2002, CS 559 Clustered Dithering 1 8517325 156211 2174912 1819132416 1420102322

12 02/05/2002 (C) University of Wisconsin 2002, CS 559 Dot Dispersion 1 117610 41415 59812 133162

13 02/05/2002 (C) University of Wisconsin 2002, CS 559 Pattern Dithering Compute the intensity of each sub-block and index a pattern NOT the same as before –Here, each sub-block has one of a fixed number of patterns – pixel is determined only by average intensity of sub-block –In ordered dithering, each pixel is checked against the dithering matrix before being turned on

14 02/05/2002 (C) University of Wisconsin 2002, CS 559 Floyd-Steinberg Dithering Start at one corner and work through image pixel by pixel –Usually scan top to bottom in a zig-zag Threshold each pixel Compute the error at that pixel: The difference between what should be there and what you did put there Propagate error to neighbors by adding some proportion of the error to each unprocessed neighbor e 3/165/161/16 7/16

15 02/05/2002 (C) University of Wisconsin 2002, CS 559 Floyd-Steinberg Dithering

16 02/05/2002 (C) University of Wisconsin 2002, CS 559 Color Dithering All the same techniques can be applied, with some modification –Below is Floyd-Steinberg: Error is difference from nearest color in the color table, error propagation is the same

17 02/05/2002 (C) University of Wisconsin 2002, CS 559 Images as Signals We can view images as a signal - a value that changes over space Spatial domain: signal is given as values at points in space Frequency Domain: signal is given as values of frequency components

18 02/05/2002 (C) University of Wisconsin 2002, CS 559 Why Signal Processing? Reconstruction: –What happens when a monitor converts a set of points into a continuous picture? –How do we enlarge images? Sampling: –How do we know how many pixels are required? Jaggies, Aliasing –How do we avoid jagged, pixelated lines Digital Signal Processing provides the tools

19 02/05/2002 (C) University of Wisconsin 2002, CS 559 A Striking Example

20 02/05/2002 (C) University of Wisconsin 2002, CS 559 Periodic Functions Fact: Any periodic signal can be represented as a sum of sine and cosine waves with harmonic frequencies –If one function has frequency f, then its harmonics are function with frequency nf for integer n Sequence of boxes is:

21 02/05/2002 (C) University of Wisconsin 2002, CS 559 Boxes as Sum of Cosines

22 02/05/2002 (C) University of Wisconsin 2002, CS 559 General Functions A non-periodic function can be represented as a sum of sin’s and cos’s of (possibly) all frequencies: F(  ) is the spectrum of the function f(x) –The spectrum is how much of each frequency is present in the function –We’re talking about functions, not colors, but the idea is the same

23 02/05/2002 (C) University of Wisconsin 2002, CS 559 Fourier Transform F(  ) is computed from f(x) by the Fourier Transform:

24 02/05/2002 (C) University of Wisconsin 2002, CS 559 Example: Box Function

25 02/05/2002 (C) University of Wisconsin 2002, CS 559 Box Function and Its Transform

26 02/05/2002 (C) University of Wisconsin 2002, CS 559 Cosine and Its Transform 1  If f(x) is even, so is F(  )

27 02/05/2002 (C) University of Wisconsin 2002, CS 559 Sine and Its Transform 1  -- If f(x) is odd, so is F(  )

28 02/05/2002 (C) University of Wisconsin 2002, CS 559 Constant Function and Its Transform The constant function only contains the 0 th frequency – it has no wiggles

29 02/05/2002 (C) University of Wisconsin 2002, CS 559 Delta Function and Its Transform Fourier transform and inverse Fourier transform are qualitatively the same, so knowing one direction gives you the other

30 02/05/2002 (C) University of Wisconsin 2002, CS 559 Shah Function and Its Transform

31 02/05/2002 (C) University of Wisconsin 2002, CS 559 Gaussian and Its Transform (the same)

32 02/05/2002 (C) University of Wisconsin 2002, CS 559 The spectrum of a functions tells us the relative amounts of high and low frequencies –Sharp edges give high frequencies –Smooth variations give low frequencies A function is bandlimited if its spectrum has no frequencies above a maximum limit –sin, cos are band limited –Box, Gaussian, etc are not Qualitative Properties

33 02/05/2002 (C) University of Wisconsin 2002, CS 559 Functions to Images Images are 2D, discrete functions 2D Fourier transform uses product of sin’s and cos’s (things carry over naturally) Fourier transform of a discrete, quantized function will only contain discrete frequencies in quantized amounts –In particular, we can store the Fourier transform of a discrete image in the same amount of space as we can store the image Numerical algorithm: Fast Fourier Transform (FFT) computes discrete Fourier transforms


Download ppt "02/05/2002 (C) University of Wisconsin 2002, CS 559 Last Time Color Quantization Mach Banding –Humans exaggerate sharp boundaries, but not fuzzy ones."

Similar presentations


Ads by Google