Professional Documents
Culture Documents
Vector Quantization of Textile Patterns For Jacquard Looms
Vector Quantization of Textile Patterns For Jacquard Looms
Abstract - In jacquard looms, the design to be weaved The input to the scanner is a pattern painted by
is determined by a perforated card. The machine per- the textile designer on special paper using special ink
forating these cards is controlled, in turn, by the color so as to minimize irregularities due to reflections and
textile design on paper, which is digitized by a color brush strokes. The output of the color scanner is a
scanner. The output produced by the color scanner discrete array of integers which represent the color
contains 24bits of color and is at a higher spatial res- at that position. The color resolution of the scanner
olution than desired. We use vector quantization for is 24 bits, and consequently, colors from a range of
color quantization and reduction of spatial resolution. 224 = 16 777 216 different colors are created, whereas
only about a dozen different colored areas are meant to
be produced. The color resolution, therefore, must be
INTRODUCTION reduced. The spatial resolution of the scanner is also
higher than desired: The desired spatial resolution is
The working principle of the jacquard loom is similar dictated by the number of warp and weft threads in
to that of the pianola: it is programmed by a perfo- a centimeter square in the final fabric. Although the
rated card on which the perforations control the hed- spatial resolution of the scannner is adjustible, that
dles independently of each other, determining in effect, value is in general, a multiple of ]IO. Therefore, it
the pattern that is to be weaved. The jacquard loom is necessary to scan at a higher resolution and then
was invented in the nineteenth century, and although reduce this resolution. As a result, both data reduc-
advanced models have emerged over the years, the per- tion and quantization of amplitude must be performed.
forated card principle remairls the same. However, the Vector quantization (VQ) solves these problems simul-
method of transferring a pattern into a perforated card taneously: A block of pixels is represented by a repro-
has changed substantially. Initially, that used t o be duction symbol from a limited alphabet. In our case,
achieved through a human puncher, and used to rep- each symbol represents a color from an alphabet of
resent the most tedious and time consuming part of about twenty colors. After vector quantization into
the weaving process [l]. codewords, we keep only the indices of the codewords,
The current method of transferring the pattern to and discard the actual codewords, as we do not have
the perforated cardhvolves the use of a color scan- to reconstruct the image itself.
ner which transfers the pattern painted on paper to a In the next section, we summarize the use of vector
de&e that uses this data to control the pins that per- quantization for color quantization. We then describe
forate the jacquard cards [2] Since a single mistake on the use of vector quantization for image compression.
the jacquard card will lead to an error in the weave and We then go on to outline our approach, use of vector
will render useless hundreds of meters of material, mis- quantization for color and spatial resolution reduction.
takes are intolerable. For this reason, the scanned pat-
tern is inspected visually and mistakes are corrected
interactively. This stage is currently the most t i m e
VQ FOR COLOR QUANTIZATION
consuming part of the process and the inspection is
still prone t o human error. We try to remedy or al-
The problem of color quantization usually arises due
leviate this problem using vector quantization of the to the limited capabilities of display monitors. When a
scanned image. color image is digitized, each of the R,G, and B compo-
~
OThis study is supported by Boefazid Univusity Research nents is represented by 8 bits, resulting in 224 distinct
h d colors. On the other hand, due to memory restrictions,
109
many display monitors can display only 256 distinct of diagonal edges by jagged ones. Therefore, for better
colors simultaneously. This 256 color palette may be subjective quality, it is preferred t o design a separate
selected from the set of available colors. Therefore, it codebook partition representing edges in addition to a
is needed t o quantize a large range of colors with a codebook partition for shade cells [SI.
limited palette. This problem has been tackled in [4]
using the LBG algorithm.
The LBG algorithm [5]is an iterative method used Color VQ
in vector quantization. Given the number of clusters to
In vector quantization of color images, it is common t o
be formed, it iteratively refines the cluster centers and
use the luminance - chrominance representation since
boundaries. The iteration is stopped when the mean
the chrominance components can be subsampled by a
square error falls below a threshold or remains con- factor of two in two spatial directions without any vi-
stant between iterations. The algorithm is guaranteed sual degradation in picture quality. Two different ap-
to converge to a minimum. However, this minimum
proaches for color VQ are presented in [7]:The first ap-
may be a local minimum of the mean square error. proach is individual component VQ, where each com-
The LBG algorithm is applied to the color quantiza-
ponent is vector quantized as an individual gray-scale
tion problem in [4]as follows: Let X n = [rn,gnlbnIT image. The second approach is combined component
denote the color value of a pixel a t location n and let VQ, where the input vector is defined as a combina-
{qn : 1 5 n 5 M } denote the color palette. The
tion of spatial and spectral components. In the second
algorithm proceeds as follows:
approach, a vector is defined as a block of 4 x 4 lumi-
1. Choose an initial palette nance components and two 2 x 2 chrominance com-
ponents. The former method is computationally less
2. Form M pixel clusters costly while the latter achieves higher compression ra-
tio.
Cm = {xn I I X n - q m l l Il l x n - q k l I l 1 Ik IMI. One disadvantage of the outlined techniques is that
when they are applied to images that have been quan-
3. Recompute the color palette using qm = tized using a limited palette, the reconstructed images
1/ICml CsEc, ~ 8 . contain colors not contained in the original palette.
Therefore, it is necessary t o requantize the images
4. Repeat 2 and 3 until no more changes occur or prior to display. The same problem is encountered
the decrease in mean square error is less than a in the coding of color quantized imges and a different
predetermined amount. approach is proposed in the coding of such images in
It is noted that the selection of the initial palette is [SI: The technique takes advantage of the fact that
crucial in the success of the algorithm. the color vectors can take on only 256 different values
and regards each color as a symbol. The coding prob-
lem is then reduced to coding the image in the space
VQ FOR IMAGE COMPRESSION of symbols instead of the three-dimensional space of
colors. The real difficulty in this approach lies in the
When vector quantization is used for image compres order in which the colors in the palette are assigned
sion, the image is partitioned into blocks of N = n x n symbols. In order to obtain successful results, this
pixels, which form a N-dimensional vector. This vec- ordering should be done so that consecutive symbols
tor is encoded by searching a codebook of represen- are assigned to visually similar colors and so that dis-
tative quantization vectors. Let f = [fi,. . . , f ~ de-] tant ~ symbols represent visually different colors. More
note a vector that is formed from a block of*sizeN specifically, given N colors XI,.. . , X N ,and a distance
of the image. In VQ, f is mapped into another N- measure d ( - ) , it is desired to find an ordering O ( t ) of
dimensional vector r = [ T I , . . . ,r ~ ] The ~ . vector r is these colors such that for all i , j E [l,N] and for all
chosen from L possible quantization symbols in a way m , n E [i,jI,
that minimizes an Euclidean distance measure. The
quantization symbols are chosen so as to be optimal
for a given distribution. The techniques for choosing
the quantization symbols and the different search al- Noting that such a global ordering is hard to obtain,
gorithms for the encoding stage have been reviewed the authors of [SIhave opted for a local ordering of the
and detailed in [3]. colors in a smaller block, where the ordering of the lu-
Vector quantization of images with larger block sizes minance represents an adequate ordering of the colors
(larger than 2 x 2) usually results in the replacement since the color variation within the block is small.
110
VQ FOR SPATIAL AND COLOR RESOLUTION
REDUCTION
I
In our application, we want t o reduce the spatial and l2O0 1
color resolution simultaneously. Vector quantization
techniques have been applied separately to sratial res-
olution reduction (compression) and to color quantiza-
tion. Our approach combines these together and com-
putes a quantized color value for each block of pixels.
We apply the approach used for coding of color
quantized images in [8] to vector quantization: Rather
than vector quantizing the color components sepa-
rately or creating a larger block by combining different
color components from a block of the image, we view Figure 1: Histogram of the color indices of the image
the colors as symbols. The first step then, is finding an in Figure 2a
ordering O(k) such that Equation 1 is satisfied. After
such an ordering is performed, the problem is formu-
lated as follows: Let g = [gl , . . . ,g ~ denote ] ~a vector were conducted on the indices representing the colors
that is formed from a block of size N of a pseudo-image in the palette.
which is formed of symbols resulting from the order- The image in Figure 2a was vector quantized us-
ing O ( k ) of the colors ck in the limited palette of the ing a block size of 3 x 3. The codebook size was 32,
image. This pseudo-image g is mapped into another large enough to represent all colors and edges between
N-dimensional vector r = [ T I , . . . , T N ] ~ For
. codebook them. It is observed that Figure 2a contains a con-
design and code assignment, we use the LBG algorithm siderable amount of noise. Preprocessing the image
~51. prior to vector quantization by median filtering was
an option. However, when that was done, small image
details were lost. Therefore, it was preferred to vector
RESULTS quantize the image as is, and manipulate the vector
quantized image to eliminate the noise.
For the tests, a 256 x 256 region of a textile image Figure 2b shows the result of vector quantization us-
quantized to 256 colors has been used. Figure 2a shows ing the LBG algorithm. The corresponding codebook
the gray-scale printout of that image. The image con- is shown in Figure 3a, where the first and the second
sists of 9 colors: dark blue, teal, lilac, green, yellow, rows show codewords 1-16 and 16-32, respectively. In-
pink, white, orange, and purple. The colors in the 256- spection of the most frequently occuring codewords
color palette are represented by an index ranging from confirms that they correspond to shade cells. The rest
0 to 255. This index, in general, follows an ordering of of the codewords represent either edges or noise. It
colors; for example, different shades of the same color is desired to eliminate the noise and merge the noise
have sequential indices. However, the ordering is ran- cells with the closest shade cells. For this purpose,
dom for different colors, and Equation 1 is not satisfied the codebook was filtered to remove noise. The steps
in general. Figure 1 shows the histogram of the indices involved can be summarized as follows:
of the image in Figure 2a. One would expect to find
9 different impulses in the histogram corresonding to Step 1:
9 differently colored regions. However, due to irregu- Let yi represent the ith codeword, with el-
larities in brush strokes and due to scanner noise, the ements yf,.. . ,yt. Let y f l ) ,. . . ,ytgi rep-
colors are spread out, and false colors corresponding resent the order statistics of the t e se-
to noise are created. As a result, one cannot iifid 9 quence yj. For each codeword, find the stan-
peaks in the histogram. It is clear that one needs a re-
dard deviations of the sequences yi , . . . , y i ,
ordering of the indices in order to differentiate some of
~ f l ) , 7 Y~S),and ~:2),... ,~‘g)r S D , S D m i n ,
the colors properly. However, finding such an ordering - e .
111
I
112
c