Escolar Documentos
Profissional Documentos
Cultura Documentos
CORRESPONDENCE
I. INTRODUCTION
In a number of applications using line drawings, the need arises
for generating a digital line which is a fixed distance r away from
another digital line. For example, in cartography, a two line description of a road or a railroad may have to be generated from the
center line information; in mechanical drawings the thickness of a
part shown by a single line may have to be shown by having a second
line next to it.
A rich literature exists on digital handling and manipulation of
line drawings [1], [2]. However, it is interesting to note that despite
its importance and usefulness to digital processing of line drawings,
no direct solution to the problem of drawing a line parallel to a
digital line has been presented in the literature [3}-[5].
A quick analysis of the problem shows that a case for which this
problem has a trivial solution is when the original line A is a continuous straight line or a digital line along one of 8 principal directions
for a rectangular digitization grid. In both of these cases, the parallel
line is obtained by a simple translation. In most other cases of a
continuous or digital line, the solution is nontrivial.
Before proceeding any further, let us define what we mean by a
line "parallel" to an arbitrary,line. Let d(Bi,A,) be the distance
between two points B1 and As. Considering the line A as a set of
points {A,] let
d(Bi,A)
(1)
min Id(Bi,Ai) Ai E AI.
Then we define line B to be parallel to line A at a distance r from
it if the distance between any point on B to the point set A is exactly
r, i.e.,
=
+ 4) mod 8.
Bi I d(Bi,A) = r}.
(2) (aiGiven
the description of the line as Ao and {fai, starting from Ao
If A and B are digital lines, the requirement of exact distance r we can easily traverse or follow the line in the forward direction.
has to be relaxed to allow the points of line B to fall on grid points. Back links are required to be able to traverse the line in the backward
Mathematically we may define line B to be the locus of points direction.
The operation of the algorithm requires the capability of examining
satisfying the definition above. In most cases, it is not easy to come
B=
locus
even
if
we
know the
20742.
any (X,Y) point to check if any lines pass through it. This may be
done by storing the line information in a two-dimensional index
array. The index array contains 3 entries for each of the two-dimensional digitization grid being considered. These entries are the line
number and the forward and back link. As only a few bits are required for each of these entries they can be coded easily in a single
word of memory. Note that a code is required to indicate that no
984
1975
Fig. 2.
C(i)
f'
C2
distance along the line is more than 7rr. A curve having more than 1
unconnected segment results in such cases.
The chain code description of lines allows one to easily replace
a portion of a line between two points by another line between
those points by appropriately changing the forward and back links
at the end locations in the index array or by actually replacing the
chain codes in the sequence. Further, as we are treating lines as
directed lines the detection of the inside/outside relationship is
straightforward. This can be done simply by going around the circle
C(i) from a point which is inside B (i - 1) and then detecting intersections. One such point is Co (i) which is on C(i) in the direction
aib, the back link at Ai. As Ai-, lies on the line joining Co(i) and
Ai,Co is less than r away from Ai-, and hence is inside B (i - 1).
In an actual implementation a number of additional complications
arise due to the geometry of C (i) and B (i - 1). While we only need
to go around C (i) once, at each point we need to know whether it is
inside or outside B (i - 1). For this purpose we use a flag PUTFLAG
which has a value 0 when C(i) is inside B(i - 1) and a value 1
when it is outside. We begin traversing C(i) from the point Co
which we know is inside and hence we may set PUTFLAG to zero.
The basic philosophy of this algorithm is to examine the points
on circle C (i) starting from Co. All points of C (i) for which PUTFLAG
is 1 are entered as a part of B (i) in the index array, i.e., an entry
is made at that point for B(i) having the forward and back links
specified by the corresponding links of C (i).
In Fig. 3, the intersections of line B (i - 1) and C (i) are shown
as very clearly marked. In practice, for digitized curves a number of
situations may arise at the intersection points. The action to be
taken under various conditions is shown in Table I. The action
985
CORRESPONDENCE
TABLE I
Initial
PUTFLAG
Intersect
with
B(i - 1)
O
O
O
O
O
O
O
1
1
1
1
1
1
1
No
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Location
of bf
wrt C(i)
Location
of bb
wrt C(i)
along cf
inside
inside
along cb
along cb
along cb
outside
along cf
outside
along cf
inside
outside
along cf
along cf
isinde
outside
outside
outside
inside
along cb
along cb
along cf
inside
along cb
Make an
entry
in B(i)
No
Yes
No
Yes
No
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Forward
Back
New
Link for Link for Deletion
PUTFLAG B(i) entry B(i) entry Pointer
0
1
0
1
0
0
1
1
1
1
1
0
0
0
cf
ef
bb
cf
cf
cf
cf
cf
bf
bf
bf
bb
cb
cb
cb
cb
cb
eb
cb
bb
bf
bf
bb
bb
bf
bb
.x
depends on the direction of B (i - 1) with respect to C (i) at the at the end because the curve B (i) is always a complete curve for
point of intersection. In this table cf and cb represent the forward and the portion of A considered that far.
If this algorithm is implemented as discussed above 2irr points
back links of C(i) at that point. The actions to be taken depend on
the value of PUTFLAG and the location of bf and bb, the forward and have to be examined for every point on line A. This number may be
back links of the line B (i - 1) relative to C(i), at that point. The reduced to half by examining only those points of C(i) which lie
actions consist of adjusting the value of PuTFLAG, deciding to make on or outside C(i - 1).
an entry for B(i) with specified values of the links and marking
IV. EXAMPLES
some points of B (i - 1) for deletion.
As noted above, those portions of B (i - 1) which lie inside C(i)
A number of examples of this algorithm are presented in Figs.
have to be deleted. This can be accomplished by marking the points
5,
6, and 7. The original line A is shown in Figs. 5 (a), 6 (a), and 7 (a).
of B (i - 1) which are just inside C (i). The last column of the Table
I indicates the link to be used from the point under consideration A line B parallel to the line A at a distance of 5 was generated fot
to go to the point to be marked for deletion. A blank entry indicates each example and the final results are shown in Figs. 5 (b), 6 (b), and
7(b). The operation of this algorithm is further illustrated in the
that no point is to be marked.
As illustrated in Fig. 4, in a rectangular grid system, two lines output of intermediate processing for the example of Fig. 5 in Fig.
may intersect at a nongrid point. If we only examine points along the 5(c)-(f), and for the example of Fig. 6 in Figs. 6(c)-(g).
circle C (i), then we may miss the occurrence of such intersections
V. CONCLUDING REMARKS
which can be easily detected by testing for an intersection when the
cf has an odd value. We may test the point at (cf + 1) mod 8 from
While the discussion above assumed the curve C to be a circle,
Ct to check if B passes through there and has a forward or back any closed curve specified by a chain code sequence can be used
link which is perpendicular to cf pointing outside, i.e., is equal to with equal ease. The type of parallel curve we get will depend on the
(cf - 2)mod 8. When this occurs, the point of line B is marked for shape of the curve used. For example, rectangles will avoid the
deletion, and the value of PUTFLAG is changed from 0 to 1 or from 1 roundoff at sharp corners but will elongate more along one direction
to 0. An entry for the point under consideration is made only if compared to its perpendicular direction. The propagation approach
PUTFLAG was originally 1. The forward and back links are adjusted mentioned in the introduction does not allow the use of any arbitrary
to maintain the connectivity of B(i) by entering the forward link curve and is better suited for square or octagons as curve C.
as (cf - l)mod s and back link as cb. If PUTFLAG WaS originally zero,
The algorithm presented here used a fixed circle as the curve
no entry is made but the links are adjusted to maintain the connec- which was moved along the line A. Depending on the application,
tivity when the next point is entered. At that stage, the value we may modify the curved based on some parameters of the system.
PUTFLAG iS one.
For example, a different curve may be used for each value of aif.
The actions of Table I have to be considered for every point on
The simplicity of this algorithm makes it suitable as a primitive
C(i) starting from Co until we return to Co. At that time B(i) has step to carry out complex processing of lines. For example, the
been generated. Some old values of B(i - 1), which represent its crowding conditions near a line could be detected by finding how
arcs found to be inside C (i), may still have to be deleted. Both ends many other lines are- inside of B.
of these arcs are marked and therefore the deletion can be accomplished simply by tracing from one marked point to the other for
ACKNOWLEDGMENT
each arc.
I am grateful to Prof. A. Rosenfeld for his comments on the
The initiation of this algorithm requires that B (0) be set as C (0),
a circle with center at Ao and radius r. No special action is required manuscript and for pointing out how the parallel approach could be
986
B
B
B
AAAAAAAAAAA
AI
A
B
B
B
B
Ba
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
B
B
B
B
B
B
B
B
B
B
B
A
BBBBBBBBBBBBBBB
BBBBBBB
BEIBBB
BB
BB
B
B
B
B
B
B
B
B
B
B
B
A
A
A
A
A
A
A
A
A
A
A
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
BBBBB
BB
B
8BBBBS
BBBBBBBBBBBBBBB
AA
BB
B
A
AAAAAAAAAAA
B
B
AA
AAAAAAAAAAA
B
B
B
A
B
B
B
B
B
B
B
B
a
B
B
B
B
B
a
B
B
BBBBBBBBBBBBBBB
BB
B
(c)
(b)
A
A
A
A
A
A
A
A
A
A
A
B
B
B
B
B
BBBBB
BBBBB
AAAAAAAAAAA
B
B
BB
(a6)
BB
a
B
B
B
B
B
1975
BB
B
B
B
B
B
B
BBBBB
BBBBB
E3BBBB
(d)
(e)
Fig. 5.
BBBB8
B3
(f)
(a) The original line consisting of 51 points. (b) The final result
line B is drawn at
(c)- (f ) Intermediate results after the algorithm has processed 11, 21, 31,
and 41 points of the line A, respectively.
B
B
-B
B8
BAAa
BBBBBBB
A'
Ba
A
B
BBBBBB8BBBB
987
CORRESPONDENCE
BBBBBBBBBBBBBBBBBBBB
BBBBB
AAAAAAAAAAAAAAANA
A
A
A
A
A
AA
AA
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
3B
A
A
AAAAAAAAAAAAAAAA
BBBBBBBBBBBBBBBBBBBB
BBBBBBBBBBBBBBBBB
3
B
B
a BBBBBBBBBBB
BB
BBBBB
3
a
A
A
A
B
B
B
B
B
A
A
BBBa BBBBBBBBBBBBBB
B
B
8
B
B
B
B
B
B
B
B
B
B
B
B
B
B
a
a
B
a
B
B8BBB
B
B
B
B
BBBBB
B
B
B
B
d
B
B
Fig. 6.
B
B
B
B
3
B
3
B
B
13
B
B
A
A
A
A
B
B
B
B
B
B
B
B
A
A
A
A
A
A
A
A
A
A
B
a
BBBB3
BB3BBB
B
3
38
3
3
B
AAAAAAAAAAAAAAAA
(d)
(e)
B
B
3
B
B
a
BBBBBBBBBBBBBBBBBBBB
B
B
BB339BBBBBBR3B3aBBBB
_3BB
B
B
B
B
B
BB3BB
A
A
A
3BBBBBBBBBBBB5
A
A
A
A
AAAAAAAAAAAAAAAA
BB
B B
B
B
AAAAAAAAAAAAAAAA
A
A
A
A
A
A
A
A
A
BBRBBB
A
a
8
B
(c)
8
8
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
BBBBBB
B
B
B
B
B
BBBBBBBBBBBBBBBBBBBB
B
B
AAAAAAAAAAAAAA
A
A
B B
B
B
B
B
B
B
AAAAAAAAAAAAAAAA
A
A
B
A
A
A
3
A
A
73
A
A
3
A
3BBBBB
a
A
B
B
A
B
A
B
B
A
a
A
B
A
B
A
B
A
B
A
A
A
A
A
(b)
(a)
AAAAAAAAAAAAAAAA
a
B
B
B
B
B
B
a a
BBBBB
A
A
A
AAAAAAAAAAAAAAAA
A
A
A
B
B
A
B
A
A
B
A
A
A
B
A
A
BBBBBB
A
3
B
A
A
B
A
B
A
A
B
A
a
3
A A
B
A
B
AA
B
A
B
AA
B
A
B
A
B
A
B
B
A
L
B
A
A
B
A
a
B
A
A
B
A
3
A
A
BBBBBB
A
A
A
A
B
A
A
A
B
A
a
3B
A
A
3
B B
AAAAAAAAAAAAAAAA
3
BB3BBBB9BBBBBBBBBBBB
B
B
BB9BBB
B
B
a
B
A
A
A
A
A
A
A
A
B
B
B
B
3
A
A
A
A
A
A
A
A
B
B
B
B
B
AAAAAAAAAAAAAAAA
B
B
BB
B
B
BBBBBBBBBBBB3BBBBBBB
(f)
Li
988
B3
B3
E3
E3
E3
B BBBBBBBBBBB BBBBBB
Li
B
B
B
B
B
B
A
AA
A
A
A
A
A
A
BBBBBB
B
B
a
B
3
B
B
B
B
B
B
B
B
B
B
BBBBBB
A
A
A
A
A
A
A
A
A
A
A
A
A
A
AAAAAAAAAAAAAAAA
3B
8 B
BBBBB B
B
BBBBBBBBBBBBBBBBBB
(g)
Fig. 6.
B
B
3
8
B
3
B
B
B
B
B
B
B
B
B
B
B
B
B
AAAAAAAAAAAAAAAA
A
A
A
A
A
A
A
A
A
A
A A
AA
A
A
A
A
A
A
A
%AAAAAAAAAAAAAAAA
A
A
A
A
AAAAAAAAAAAAAAAA
B
B
B
A
A
A
AA
A A
A
A
A
A
(a)
Continued.
BH868
I)
B
A
AROBBB BBBBAA
BBBBB8a
R
8
AAAAAAAAAAAAAAAA
REFERENCES
A
A
AA
AA
BU
BS
a
B
A
A
B
B
a
H
B
BBBBBA
A
A
A
A
A
AA
A A
AAAAAAAAAAAAAAAA
B
B
Ba
B
B
Bf
d3
B
B
B
*S
A
B
A
A
B3
a
A Note
-B
BOBSBBBABBa
BAB
B BR R
(b)
(a) The original line A consisting of 80 points. The line does not
intersect itself. (b) The flnal result of the algorithm where a line B
is drawn at a distance 5 from the line A. Line B consists of two unconnected segments even though the line A does not intersect itself.
Automatic Detection of
Texture Gradients
on
Fig. 7.
AZRIEL ROSENFELD
Abstract-The rate and direction of maximum change of texture
coarseness across a surface are important cues to the orientation
of the surface relative to the observer. This note describes a simple
method of automatically detecting these "texture gradients."
Index Terms-Image processing, picture processing,
sis, texture analysis, texture gradients.
scene
analy-
It was pointed out by Gibson 25 years ago [3] that the "texture
gradient" of a surface is an important cue in determining the
orientation of the surface relative to the observer's line of sight. By
"texture gradient" is here meant the rate and direction of maximum
change of texture coarseness across the surface.
About 15 years ago, Carel et al. [2] proposed a method of automatically detecting gradients, based on counting the numbers of times
edges are crossed by line scans in various directions. More recently,
Bajcsy and Lieberman [1] have described a texture gradient detection scheme, based on analyzing the Fourier power spectra of pieces
of the surface, determining a characteristic "element size" for each
piece, and looking for trends in these characteristic sizes as one moves
across the surface.
A simple space-domain method of texture gradient detection was