An improved image analogy method based on adaptive CUDA-accelerated neighborhood matching 745
graph-cut synthesis approach into a global constraint min-
imization problem and supports the image analogy frame-
work.
Many efforts have been made to accelerate texture syn-
thesis. The core of pixel/patch-based texture synthesis is
the nearest neighborhood searching process. In general, the
acceleration methods can be classified into two categories,
of which one adopts tree-based search for a point in high-
dimensional space and the other utilizes image consistency
to accelerate synthesis. For the first kind, it achieves acceler-
ation by considering the neighborhood as a point in a high-
dimensional space and regarding the neighborhood match-
ing process as a nearest point searching problem. The tree
generated by tree-structured vector quantization (TSVQ) [7]
can be used as a data structure for efficient nearest point
query, but it needs large memory space for data structure.
Since querying the nearest neighbor accurately in a high-
dimensional data set is time-consuming, ANN [19] calcu-
lates the approximate most similar neighbor with relatively
long time. The latest released FLANN library [20]isre-
ported to have an order of magnitude speedup than previ-
ous ANN methods. The PCA is employed to reduce the
point’s dimensionality [3, 21] to speed the searching pro-
cess, but it leads to more feature information loss which is
proved to be detrimental to synthesis quality [4]. The precise
nearest neighborhood search performing exhaustive search-
ing is regarded to generate the superior matching results but
to be slow. The precise k nearest neighbor searching [22]
based on GPU architecture is capable to search the exact
nearest point with fast speed, which is adopted in our al-
gorithm to accelerate the pixel-based texture synthesis. An
efficient exact nearest patch matching algorithm for image
processing and editing is proposed [23]. Xu et al. propose
the scheme for edit propagation by exploring adaptive clus-
tering in the affinity space, which reduces both memory us-
age and time significantly without sacrificing visual fidelity
[24]. As for the coherence search method, the time of k-
coherence searching [25] during synthesis is constant and
fast, the drawback is that it requires long pre-processing to
calculate the candidate set. The recently proposed Patch-
Match algorithm [26] is a fast randomized approximation
algorithm for computing the nearest neighbor field between
two disjoint image regions, however, it may get stuck in lo-
cal minima. In recent years, the improvements of GPUs of-
fer a powerful processing platform for parallel computing
and graphic applications [27]. Lefebvre and Hoppe propose
a parallel controllable texture synthesis algorithm based on
GPU using HLSL [21], but it applies only to homogeneous
texture. They further propose appearance space texture syn-
thesis [28], using appearance vectors including non-local in-
formation rather than point-wise color to improve synthesis
quality. Our work draws ideas from parallel synthesis to ac-
celerate synthesis process and is extended to synthesize non-
homogeneous textures.
3 The improved image analogy method based on
adaptive neighborhood matching
For image analogy presented by Hertzmann [3] the neigh-
borhood matching process is performed by adopting both
approximate nearest neighbor search and coherence search
to compute the smallest distance for pixels to be synthesized,
with the parameters tuned to favor coherence over accuracy.
Since two searching strategies are employed simultaneously
for one pixel, their computation time is long. And the pa-
rameters cannot be modified once it has been set. We have
mentioned that for non-homogeneous textures, regions with
large texton structural features need to be matched within
a search space as large as possible, while for smaller tex-
ton structures we need to consider image consistency more.
Thus different textural regions need to be processed by
applying different searching strategies. In this section we
present the new neighborhood matching algorithm which
adaptively selects the appropriate searching strategies based
on textural characters of different regions.
3.1 Image synthesis algorithm based on adaptive
neighborhood matching
Before synthesis, we first generate a user-specified label
map labelB (Fig. 1) for the synthesized result. It is a binary
image corresponding to the expected synthesis result B
,
with different colors representing different searching strate-
gies. As Fig. 1 shows, the black area corresponds to struc-
tural rocks region with large textons, and the white areas
correspond to random grasses region. The labelB map can
be specified by users manually according to B. Since B may
have different color regions, for these regions, we find their
corresponding regions in A
. According to the textons’ sizes
in A, we assign different searching strategies to the regions
in B and generate the binary image labelB. Once labelB is
given, along with the input image A, A
and B, we use our
searching strategy to synthesize B
.
Our algorithm employs hierarchical image pyramids dur-
ing synthesis. The inputs images are A, A
, B and labelB,
and the output result is B
.ForA, A
, B, Gaussian pyramid
is generated. For labelB, the Gaussian pyramid is not appli-
cable, which makes the pixels values blur. Instead, we adopt
voting stack [15] to obtain its pyramid which keeps the bi-
nary values of each pixel. We give the pseudo-code of our al-
Fig. 1 Label map