<< Chapter < Page | Chapter >> Page > |
[link] is a block diagram that illustrates the method of error diffusion.The current input pixel $f(i,j)$ is modified by means of past quantization errors to give a modified input $\tilde{f}(i,j)$ . This pixel is then quantized to a binary value by $Q$ , using some threshold $T$ . The error $e(i,j)$ is defined as
where $b(i,j)$ is the quantized binary image.
The error $e(i,j)$ of quantizing the current pixel is is diffused to "future" pixels by means of a two-dimensionalweighting filter $h(i,j)$ , known as the diffusion filter . The process of modifying an input pixel by past errors can berepresented by the following recursive relationship.
The most popular error diffusion method, proposed by Floyd and Steinberg, uses the diffusion filter shown in [link] . Since the filter coefficients sum to one,the local average value of the quantized image is equal to the local average gray scale value. [link] shows the halftone image produced by Floydand Steinberg error diffusion. Compared to the ordered dither halftoning, the error diffusion method can be seen to have better contrast performance.However, it can be seen in [link] that error diffusion tends to create "streaking" artifacts, known as worm patterns.
Download the file house.tif for the following section.
truesize
command just after the
image
command.
This will assign one monitor pixel for each image pixel.We will now implement the halftoning techniques described above. Savethe result of each method in MAT files so that you may later analyze and compare their performance.Download the image file house.tif and read it into Matlab. Print out a copy of this image.
First try
the simple thresholding technique based on
[link] ,
using
$T=108$ , and display the result.
In Matlab, an easy way to threshold an image
$X$ is to use the command
Y = 255*(X>T);
. Label the quantized image, and print it out.
Now create an "absolute error" image by subtracting the binary from the original image, and then taking the absolute value.The degree to which the original image is present in the error image is a measure of signal dependence of the quantization error.Label and print out the error image.
Compute the mean square error (MSE), which is defined by
where $NM$ is the total number of pixels in each image. Note the MSE on the printout of the quantized image.
Now try implementing Bayer dithering of size 4. You will first have to compute the dither pattern. The index matrix fora dither pattern of size 4 is given by
Based on this index matrix and [link] , create the corresponding threshold matrix.
For ordered dithering, it is easiest to perform the thresholding
of the image all at once.This can be done by creating a large threshold matrix by
repeating the
$4\times 4$ dither pattern.
For example, the command
T = [T T; T T];
will increase the dimensions
of
$T$ by 2. If this is repeated until
$T$ is at least as large as the
original image,
$T$ can then be trimmed so that is is the same size as
the image. The thresholding can then be performed using the command
Y = 255*(X>T);
.
As above, compute an error image and calculate the MSE. Print out the quantized image, the error image, and note the MSE.
Now try halftoning via the error diffusion technique, using a threshold $T=108$ and the diffusion filter in [link] . It is most straightforward to implement this by performing the followingsteps on each pixel in raster order:
You do not have to quantize the outer border of the image.
As above, compute an error image and calculate the MSE. Print out the quantized image, the error image, and note the MSE.
The human visual system naturally lowpass filters halftone images. To analyze this phenomenon, filter each of the halftone images withthe Gaussian lowpass filter $h$ that you loaded in the previous section (from ycbcr.mat ), and measure the MSE of the filtered versions. Make a table that containsthe MSE's for both filtered and nonfiltered halftone images for each of the three methods. Does lowpass filtering reduce the MSE for each method?
Notification Switch
Would you like to follow the 'Purdue digital signal processing labs (ece 438)' conversation and receive update notifications?