F
(
I
j
)
C
for all
I
j
∈ {
I
1
,I
2
,...,I
n
}
subsampled
1
by factor 2,and then filtering all those images using the range block (
A
·
B
denotes element-wise multiplication):
M
=
Cov
(
I
j
,R
) =
F
−
1
(
F
(
I
j
)
C
·F
(
R
))
(7)In the array
M
,
M
(
u,v
)
will then contain
R
xy
ˆ
D
xy
forthe domain block
ˆ
D
at the position
2
u,
2
v
in the image to becompressed, so that the matching of a domain block againsta range block can be done in 10 flops analogous to the singleimage variant presented in [13].The algorithm hence uses one preprocessing loop and twonested loops over all images:
Algorithm 1
MULTI-IMAGE-PIFS
(
I
1
,I
2
,...,I
n
)
1:
for
I
j
∈ {
I
1
,I
2
,...,I
n
}
do
2:
Scale
I
j
down by
2
, store result in
S
3:
Precalculate:
4:
F
j
=
F
(
S
)
C
5:
r
j,u,v
=
x<u,y<v
I
j,x,y
for all
u,v
6:
r
2
j,u,v
=
x<u,y<v
I
2
j,x,y
for all
u,v
7:
d
j,u,v
=
x<u,y<v
S
x,y
for all
u,v
8:
d
2
j,u,v
=
x<u,y<v
S
2
x,y
for all
u,v
9:
end for
10:
for
I
j
∈ {
I
1
,I
2
,...,I
n
}
do
11:
for
all range blocks
R
∈
I
j
do
12:
Calculate
K
=
F
(
R
))
13:
for
I
k
∈ {
I
1
,I
2
,...,I
n
}
do
14:
Calculate
M
=
F
−
1
(
F
k
·
K
)
15:
for
all domain blocks
D
k,m
∈
I
k
do
16:
Calculate
c,l
from
M,r
j
,r
2
j
,d
k
,d
2
k
17:
Quantize
c,l
18:
Calculate
k,m
from
c,l,M,r
j
,r
2
j
,d
k
,d
2
k
19:
end for
20:
end for
21:
Find smallest
from all
k,m
22:
if
>
max
then
23:
Split range block
R
24:
else
25:
Write out
k,m,c,l
26:
end if
27:
end for
28:
end for
III. I
MAGE SIMILARITY
Image databases typically consist of tens of thousands of images. The algorithm needs to compress all images in a groupas a whole
2
, and, more importantly, also needs to decompressthe whole group in order to retrieve a single image.
1
We assume a fixed size for the Fourier transform, big enough to encompassall images
I
1
, . . . I
n
. When
F
is applied to an image or a block smaller thanthis size, it is zero-extended.
2
Images can be added to a compressed file by allowing the new imageto reference the already existing images, but not vice versa. Also, addingan image to a compressed file provides worse compression results comparedto adding the image to the initial set. It’s also slower, as all domain block information needs to be calculated again.
Hence, it’s desirable to split the input data into manageableclusters. Here, the opportunity presents itself to organize theclusters in a way that compression is optimized, i.e., thatrelevance is paid to the fact which images benefit most fromeach other if placed into the same cluster.In order to partition the database in such a way, a metricspecifying a kind of compression distance between to imagesneed to be devised (so that the clustering algorithm will knowwhich images are “similar” and should be placed in the samegroup).Using the normalized compression distance (NCD) from[14], this can be expressed as
NCD
I
1
,I
2
=
C
I
1
,I
2
−
min
(
C
I
1
,C
I
2
)
max
(
C
I
1
,C
I
2
)
(8)with
C
I
1
,...,I
n
the compressed filesize of compressing im-ages
I
1
,I
2
,...,I
n
together, and
C
I
k
the filesize of a compres-sion run on just a single image.This metric can both be interpreted as similarity between
I
1
,I
2
as well as the quality of a cluster formed by
I
1
,I
2
. Alower value of
NCD
I
1
,I
2
denotes that
I
1
and
I
2
have a moreclose resemblance.It’s important to notice that, in our case, the NCD is notnecessarily a “true” metric (The PIFS compressor is not a“normal” compressor [14]). In particular,
NCD
I,I
= 0
if the PIFS algorithm considers only domain blocks larger thanregion blocks (As in our case
3
). This is due to the fact thatthe “second” image doesn’t contain any additional informationwhich improves the compression of the first image (Thedomain blocks don’t differ from those already available fromthe first image).This abnormal behaviour of the metric function disappears,however, once the images are at least slightly dissimilar(see Fig. 3), so this doesn’t present a problem in practicalapplications.We found that at least for some clustering algorithms, it’ssometimes more efficient and produces better results if wework on a slightly simpler function, the function of preservedbytes:
b
+
I
1
,I
2
,...,I
n
=
C
I
1
+
C
I
2
+
...
+
C
I
n
−
C
I
1
,I
2
,...,I
n
(9)The function
b
+
can also be applied to image groups of more than two images, and describes the number of bytesthat were saved by combining the images
I
1
,I
2
,...,I
n
into acommon cluster, which is also a more intuitive way of defininga similarity function. The higher the value of
b
+
I
1
,I
2
,...,I
n
, themore resemblance between
I
1
,I
2
,...,I
n
.Since during clustering, a huge number of images need tobe “compared”, it’s advisable to find faster approximations to
3
It’s possible for region blocks and domain blocks to be of the same sizewith the algorithm still converging, as long as the mappings between imagesare never circular. This can be accomplished by disallowing mappings fromany image
I
j
to the images
I
j
, I
j
+1
, . . . , I
n
. Algorithm constructed usingthis kind of model bear a close resemblance to the motion compensationtechnique used in video compression.