S → [T, T, T, T, w, T, T, T, T ]((1, 0, 0, 0, 0, 0, 0, 0), (∞, ∞, 0, ∞, ∞, ∞, ∞, ∞); (1)
(−1, 8, 0, 0, 0, 0, 0, 0)) (2)
T → U ((0, 1, 0, 0, 0, 0, 0, 0), (0, ∞, ∞, 0, ∞, ∞, ∞, 71); (0, −1, 1, 0, 0, 0, 0, 1))
|
(3)
F ((0, 1, 0, 0, 0, 0, 0, 0), (0, ∞, 0, 0, ∞, ∞, ∞, 0);(0, −1, 0, 1, 0, 0, 0, 0))
|
(4)
C ((0, 1, 0, 1, 0, 0, 0, 0) , ∞; (0, −1, 0, 0, 1, 0, 0, 0)) (5)
U → S ((0, 0, 1, 0, 0, 0, 0, 0), (∞, 0, ∞, ∞, ∞, ∞, ∞, ∞); (1, 0, −1, 0, 0, 0, 0, 0)) (6)
F → C ((0, 0, 0, 1, 0, 0, 0, 0), (∞, 0, ∞, ∞, ∞, ∞, ∞, ∞); (0, 0, 0, −1, 1, 0, 0, 0)) (7)
C → b ((0, 0, 0, 0, 1, 0, 0, 0), (∞, ∞, ∞, ∞, ∞, 4, ∞, ∞); (0, 0, 0, 0, −1, 1, 0, 0))
|
(8)
g((0, 0, 0, 0, 1, 5, 0, 0), (∞, ∞, ∞, ∞, ∞, ∞, 2, ∞);(0, 0, 0, 0, −1, 0, 1, 0))
|
(9)
C ((0, 0, 0, 0, 1, 5, 3, 0) , ∞; (0, 0, 0, 0, 0, −5, −3, 0)) (10)
Figure 2: Rules for grammar G
carpet
.
and none of F appear as labels of squares in the pic-
ture, then the square labelled A may be divided into
equal squares with labels x
11
, x
12
, . . . , x
mm
.
Definition 6. A random context picture grammar
G = (V
N
, V
T
, P, (S, σ)) has a finite alphabet V of la-
bels, consisting of disjoint subsets V
N
of variables and
V
T
of terminals. P is a finite set of productions of
the form A → [x
11
, x
12
, . . . , x
mm
](P ; F ) with m ∈ N
+
,
where A ∈ V
N
, x
11
, x
12
, . . . , x
mm
∈ V and P , F ⊆ V
N
.
Finally, there is an initial labelled square (S, σ) with
S ∈ V
N
.
Definition 7. For an RCPG G and pictorial forms
Π and Γ, we write Π =⇒ Γ if there is a pro-
duction A → [x
11
, x
12
, . . . , x
mm
](P ; F ) in G, Π con-
tains a labelled square (A, α), l(Π\
{
(A, α)
}
) ⊇ P and
l(Π \
{
(A, α)
}
) ∩ F =
/
0, and Γ = (Π \
{
(A, α)
}
) ∪
{
(x
11
, α
11
), (x
12
, α
12
), . . . , (x
mm
, α
mm
)
}
. As above,
=⇒
∗
denotes the reflexive transitive closure of =⇒.
Definition 8. The (random context) gallery G(G)
generated by a grammar G = (V
N
, V
T
, P, (S, σ)) is
{
Φ
|
{(S, σ)} =⇒
∗
Φ and l(Φ) ⊆ V
T
}
. An element
of G(G) is called a picture.
Examples of RCPGs and random context galleries
can be found in (Ewert, 2009). It has been shown that
every RCPG can be written as a BCPG (Ewert et al.,
2017; Mpota, 2018).
2.4 Spatial Color Distribution
Descriptor
One of the key elements in this research is to deter-
mine the similarity of the generated pictures. There
are many content based image retrieval systems that
measure the similarity of pictures based on different
features, like color, texture, content and layout. The
main feature of the pictures generated in this research
is color, and hence color descriptors were considered
more appropriate. There exist many color descriptors
for measuring similarity. We have considered several
CBIR systems and decided to use the spatial color
distribution descriptor (Chatzichristofis et al., 2010),
since (Okundaye et al., 2013) observed that the SpCD
provided better retrieval results for syntactically gene-
rated pictures than correlograms (Huang et al., 1997),
color histograms (Swain and Ballard, 1991) or other
color features. Although tree edit distance, which was
introduced in (Pawlik and Augsten, 2011), was found
to generate good results for pictures generated by tree
grammars (Okundaye et al., 2013), we chose not to
use it, as the pictures in this research were not ge-
nerated using tree grammars. There also exist many
CIBR systems that include spatial information. The
SpCD is a compact composite descriptor which com-
bines color and spatial color distribution (Chatzichris-
tofis et al., 2010). This descriptor is suitable for colo-
red pictures that contain a small number of colors and
texture regions, eg., hand-drawn sketches and colored
graphics such as the ones generated by picture gram-
mars. We calculated similarity according to this des-
criptor with the Img(Rummager) application (Chat-
zichristofis et al., 2009).
3 RESULTS
For this research, it is important to measure if per-
ceptual similarity correlates to the SpCD, because we
need to be sure that the results from the mathematical
measure reflect what people think. For this, we con-
ducted an online survey to evaluate the level of con-
sistency between perceptual similarity and the SpCD.
We obtained 408 responses through the online sur-
vey. Most of the respondents were staff members or
students from the University of the Witwatersrand, Jo-
hannesburg. Other respondents were contacts of the
Measuring Perceptual Similarity of Syntactically Generated Pictures
247