Coordinate logic filters and their applications in

1 downloads 0 Views 2MB Size Report
combinations) among corresponding binary values of two or more signals. .... for dilation and erosion and for opening-closing of CL filters. ...... structuring element, and its size depends on the scale factor K. This filter actually .... [8] B. Mertzios and K. Tsirikolias, Coordinate logic filters in image processing, IEEE Winter Work-.
CIRCUITS SYSTEMS SIGNAL PROCESSING VOL. 17, No. 4, 1998, PP. 517-538

COORDINATE LOGIC FILTERS AND THEIR APPLICATIONS IN IMAGE PROCESSING AND PATTERN RECOGNITION* B. G. Mertzios 1 and K. Tsirikolias 1

Abstract. In this paper we present a number of image processing applications using co-

ordinate logic filters, which execute coordinate logic operations among the pixels of the image. These filters are very efficient in various 1D, 2D, or higher-dimensional digital signal processing applications, such as noise removal, magnification, opening, closing, skeletonization, and coding, as well as in edge detection, feature extraction, and fractal modeling. In this paper we present some typical image processing applications using coordinate logic filters. The key issue in the coordinate logic analysis of images is the method of fast successive filtering and managing of the residues. The desired processing is achieved by executing only direct logic operations among the pixels of the given image. Coordinate logic filters can be easily and quickly implemented using logic circuits or cellular automata; this is their primary advantage.

1. Introduction

Logic operations have been successfully used for a variety of image processing tasks with binary images. Logic operations find numerous image processing applications, such as the removal of isolated points that usually represent noise, separation of multiple objects, extraction of depth maps and skeletons, shape smoothing, coding, region filling, and shape recognition and restoration [4]. In this paper we present coordinate logic (CL) filters [3], [13], [14], which are applicable for both binary and gray-level images, as well as a number of typical image processing applications, such as edge and feature extraction, noise removal, and image magnification, that use CL filters. CL filters constitute a novel class of nonlinear digital filters and are based on the execution of coordinate logic operations (CLOs) [3]. The CLOs are logic operations (AND, OR, NOT, and their combinations) among corresponding binary values of two or more signals. For * ReceivedMarch 12, 1997; revisedNovember12, 1997. 1 AutomaticControl SystemsLaboratory,Departmentof Electrical and ComputerEngineering, Democritus Universityof Thrace,67 100 Xanthi. Greece.

518

MERTZIOS AND TSIRIKOLIAS

binary signals or images, CL filters coincide with morphological filters. For graylevel images, CL filters may behave similarly to morphological ones, but they are considerably faster because the sorting operation is not required. CL filters are very efficient in various image processing and analysis applications, such as edge and feature extraction, calculation of the pecstrum, [6], shape description and recognition, shape smoothing, image magnification, skeletonization, region filling, coding, fractal modeling, special video effects, and lowpass and highpass filtering. CL filters can also execute the operations of erosion, dilation, opening, and closing, which until now have been implemented only by morphological filters. The CL filters that use only the CLOs coordinate OR (COR) and coordinate AND (CAND) satisfy the defining property of idempotency of morphological filters [7], [9]-[11] for opening, closing, and their combinations. However, the second defining property of increasingness of morphological filters is not generally satisfied by CL filters. The CL filters implementing CLOs that involve the coordinate logic NOT (CNOT) operation do not satisfy in general either of the properties of increasinghess and idempotency of morphological filters. In this case, a useful characteristic CLO is the coordinate logic XOR (CXOR). In gray-level images the use of certain CL filters that include the CXOR operation is very appropriate for very fast and efficient edge detection and edge enhancement applications. There is no need to compute the difference of the original and filtered image, as must be done with morphological filters. Morphological filters constitute a class of order statistics (OS) filters, because the dilation and erosion operations that correspond to max and rain operations can be considered as a kind of sorting. In contrast, CL filters do not involve any kind of sorting, because the dilation and erosion operations result in signal values that may not be included in the initial set of input signal values. Thus, we can conclude that CL filters in general do not fall into the class of OS filters. A class of nonlinear filters that is based on Boolean operators is that of the generalized stack (GS) filters [5]. The difference between GS filters and CL filters is that the stack filters operate on signal levels, whereas CL filters operate on binary representations. The definition of GS filters is based on threshold decomposition and Boolean operators. Threshold decomposition maps the 2"-level input signal (where n is the word length) into 2n - 1 binary signals by thresholding the original signal at each of the allowable levels. The set of 2n - 1 signals is then filtered by 2n - 1 Boolean operators, which are constrained to have, the stacking property. The multilevel output is finally obtained as the sum of the 2" - 1 binary output signals. In contrast, CL filters decompose the signal into n binary signals that operate in parallel. It is thus readily seen that CL filters are simpler and faster than GS filters, because they achieve the desired processing by executing only direct logic operations among the binary values of the given signal. CL filters can execute quickly and easily the four basic morphological operations (erosion, dilation, opening, and closing). The key issue in the coordinate logic

COORDINATELOGICFILTERAPPLICATIONS 519

analysis of images using CL filters is the fast successive filtering and managing of the residues, exactly as it is for classical morphological filters. Thus, CL filters are expected to be suitable for all tasks that are executed by morphological filters. Moreover, CL filters operate in a simpler and faster way than morphological filters do, because they achieve similar results by executing only elementary logic operations among the pixels of a given image, and they are appropriate for high-speed real-time applications. Specifically, CL filters can be easily implemented using logic circuits or cellular automata networks, and they are characterized by inherent parallelism. In addition, the application of CL filters can also be used to execute useful tasks in image processing that cannot be done by classical morphological filters. One such task is the implementation of an approximation of the majority function [ 1] by the majority coordinate logic filter and fractal transformation. In Section 2 we provide the definitions of CL operators and we derive some properties that characterize the nature of CL operators and their application on digital signals. In Section 3 we derive the basic CL filters that execute the dilation, erosion, opening, and closing operations, as well as the filter structures. In Section 4 we prove the morphological properties of duality for dilation-erosion and for opening-closing of idempotency for opening and closing and extensivity for dilation and erosion and for opening-closing of CL filters. In Section 5 we discuss some image processing applications using CL filters; these include edge extraction, noise removal, image magnification, and pattern recognition. Section 6 provides concluding remarks.

2. Coordinate logic operations on digital signals The underlying idea in coordinate logic image processing (CLIP) is the execution of coordinate logic operations (CLOs) among gray-level pixels. These CLOs are executed among the corresponding binary bits of equal length of the considered pixels, without counting the carry bits. The fundamental properties of logic operations also hold for CLOs, because they constitute an extension of Boolean algebra

[31. For our discussion, we will assume two numbers A and B in the decimal system; in their binary sequence of length n they are written as A=[al

a2 ... an],

B=[bi b2 ... bn].

2.1. Definitions The following definitions refer to the coordinate operators that are used by CL filters.

520

MERTZIOS AND TS1RIKOLIAS

Definition 2.1 (Coordinate Logic Operation). The coordinate logic operation o of two numbers A and B in the decimal system, in their binary sequence, is given by

(2.~)

C = [cl c2 . . . cn] = A C o B ,

where Co is the CL operation corresponding to the logic operation o. The ith bit ci is defined as the output of the logic operation o among the corresponding ai and bi bits of the operands, i.e., ci = aiobi,

i = 1, 2 . . . . . n.

(2.2)

The operation o may be the logical OR, AND, or NOT, or a function of them. A distinct characteristic of the coordinate operators is that they do not encounter any carry bits as occurs in regular logical operations among binary sequences. Definition 2.2 (CNOT (A)). The coordinate logic NOT operator of a number A in the decimal system, in its binary sequence, is given by C=~ct

c2 ... c n ] = C N O T A ~

(2.3)

where the ith bit ci is the logical NOT of the corresponding ai bits of the number A, i.e., cl = NOT ai, i = 1, 2 . . . . . n. (2.4) It is seen that the CAND and COR operations result in values that are not included in the initial range of the values of the pixels. However, this characteristic does not constitute a problem in the proposed image processing and feature extraction procedure, because, after each successive filtering, only the population of the remaining pixels is important, not their gray-level values. For the rest of the image processing tasks that are presented in this paper, the specific characteristic is either ignored by the combinations of the CL operators or has a beneficial effect, e.g,, in fractal transform.

2.2. Properties o f coordinate logic operations

Let there be two integer positive numbers A and B in the decimal system. Let also the CAND and COR operations of the numbers A and B be E = A CAND B

=

[el

e2

,..

en]

D = A COR B = [d~ d2 ... dn].

(2.5) (2.6)

The fundamental properties of logic operations also hold for coordinate logic operations, because they constitute an extension of Boolean algebra [3]. These properties are summarized in Table 1. The following Theorems 2.1 and 2.2 provide useful relations among A, B, and D, E in the decimal system.

COORDINATELOGIC FILTER APPLICATIONS 521 Table 1. Fundamental properties of coordinate logic operations 1. Fundamental laws

2. Commutative laws 3. Associative laws 4. De Morgan's laws

5. Absorption laws

| 0 CAND A = 0, 9 A CAND A = A,

0 COR A = A A COR A = A (idempotence laws) e(2n-I)CANDA=A, (2n - 1)COR A = (2n - 1) 9 A CAND CNOT(A) = 0, A COR CNOT(A) = (2n - t) 9 A CAND B = B CAND A, A COR B = B COR A 9 A CAND (B CAND C) = (A CAND B)CAND C 9 A COR(B COR C) = (A COR B) COR C 9 CNOT(A1 CAND A2 CAND ... CAND An) = CNOT (A1) COR CNOT(A2) ... COR CNOT(An) 9 CNOT(A1 COR A2 COR ... CAND An) = CNOT(A1) CAND CNOT(A2) ... CAND CNOT(An) 9 A COR (B CAND A) ----A, A CAND (B COR A) = A | (A COR B) CAND (A COR C) = A COR B CAND C

Theorem 2.1. Let E and D be defined by (2.5) and (2.6), respectively. Then 0 < E < m i n ( A , B)

(2.7)

m a x ( A , B) < D < (2 n - 1),

(2.8)

where n is the word length; i.e., the C L O s C O R and C A N D of A and B represent a measure of the maximum andofthe minimum functions of A and B, respectively. P r o o f . T h e p r o o f results directly by taking into account the definitions o f A N D and O R and f r o m the fact that no carry bits are encountered in the coordinate operations. N o t e that (2 n - 1) is the m a x i m u m n u m b e r represented by a w o r d length o f n bits. T h e o r e m 2.1 can be e x t e n d e d to the case of m o r e than two numbers. [] T h e o r e m 2.2. Let E and D be defined by (2.5) and (2.6), respectively. Then O + E = A + B,

(2.9)

i.e., the decimal number S = A + B equals the sum of D = (A C O R B) a n d E = (A C A N D B) in the decimal system. P r o o f . T h e s u m o f d e c i m a l numbers A, B, in their binary sequences, is given by S = [co s~ sz .o. Sn],

(2.10)

Si = ai X O R bi X O R ci+1,

(2.11)

w h e r e si is the ith bit

and ci is the carry bit to be added to the operand bits o f the next (i + 1)th l o w e r bit position, g i v e n by

ci = (ai A N D bi) O R (ai O R hi) A N D ci+l.

(2.12)

522

MERTZIOS AND TSIRIKOLIAS

The sum S* of the decimal numbers E and D, in their binary sequences, is given by

s * = D + E =[c~ s 1 s 2 ... Sn],

(Z13)

where s~ is the ith sum bit and c~ is the carry bit of the smm~nation of D and E, respectively. Using known Boolean identities, we can write

s* = di X O R ei XOR c*i+t = (ai AND bi) XOR (ai OR bi) XOR

s

= [(ai A N D bi) AND NOT (ai OR bi)] OR [NOT (ai A N D bi) A N D (ai OR bi)] XOR C*+l

(XOR definition)

= [(ai A N D bi) A N D (NOT ai AND NOT bi)] OR [(NOT ai OR NOT bi) A N D (ai OR bi)] NOR ci+ 1 = [(NOT ai OR NOT bl) A N D (ai OR bi)] NOR c~+1

= [(ai A N D NOT bi) OR (NOT ai AND bi)] XOR c~+I = ai X O R bi XOR c;+ 1,

(De Morgan laws) (Absorption law) (Distributive law) (2.14)

i = n - 1, n - 2 . . . . . 1.

c* = (di A N D ei) OR (di OR ei) AND c~+1 = [(ai A N D bi) A N D (ai OR bi)] OR [(ai AND bi) OR (ai OR bi)] AND t'i+l -'* = (ai A N D bi A N D ai) OR (ai A N D bi AND bi) OR [(ai A N D bi) OR (ai OR bi)] AND c*+1

(Distributive law)

= (ai A N D bi) OR (ai A N D bi) OR (ai OR bi) A N D c*i+1 (Idempotence and absorption laws)

= (ai A N D bi) OR (ai OR bi) AND ci*+l = ci, i = n - 1, n - 2 . . . . . 0 ( 2 . ! 5 ) with initial condition cn = c n* = 0. According to (2.15), ci+ 1 = ci+l, and therefore it results from (2.14) that s~ = si. Therefore, D + E = A + B. [] T h e o r e m 2.3. Let there be A, B, A < B, such that for the smallest i for which t~ bi = 1, it holds that6(ai)8(bi - 1) = 1. Then

ai

n

E = A CAND B = A - ES(ai

- l)3(bi)2 i < A

(2.16a)

i=1 n

D = A COR B = B + E S ( a i

- 1)8(bi)2 i >_ B,

(2.16b)

i=1

where 8(.) is the delta or Dirac function. Proof. In the cases where ai ~ b i = 1 (where ~ denotes the XOR), then d i = ~ and ei = O. Therefore, the contribution of the ith position to the difference A - E or the difference D - B is 8(ai - 1)8(bi)2 i, and (2.16a) and (2.16b) result. []

COORDINATE LOGIC FILTER APPLICATIONS 523

C o r o l l a r y 2.1. It results from Theorem 2.1 that

A - E = D - B = K = ~(ai

- 1)8(bi)2 i,

(2.17)

i=1

i.e., the C L O R and A N D operation differ from the m i n and m a x operations by an equal quantity K. Therefore, the application o f CL operations, instead o f m i n , m a x operations, on two numbers A and B, attenuates or amplifies them by the same quantity K. T h e o r e m 2.4. Let there be A, B with A < B. Then E = A C A N D B = m i n ( A , B) = A

(2.18a)

D = A C O R B = m a x ( A , B) = B

(2.18b)

ifffor each ai = 1, the corresponding bi is also 1, or, equivalently, ~ (ai - 1)3 (bi 1)=1. P r o o f . If bi = 1 for all the bit positions where ai = 1, then di = 1 and ei = 1. If ai = 0 and bi = 1, then di = 1 and ei = 0. If ai = 0 and bi = 0, then di = 0 and e i = 0. Therefore, in all cases we have d / = bi and ei = ai. [] T h e o r e m 2.5. Let Ai, i = 1, 2 . . . . . N, be decimal numbers. Then 0 < A1 CANE) Az . . . C A N D AN = C A N D { A / , i = 1, 2 . . . . . N} < min{Ai}

(2.19a)

max{Ai} < D = A1 C O R A2 . . . C O R AN = COR{A/, i = 1, 2 . . . . . N} < D < (2 n - 1).

(2.19b)

In (2.19a) note that E = min{Ai } iff all Ai have ones at all the bits where min{Ai } has ones, whereas in (2.19b), D = (2 n - 1) iff all Ai have zeros at all the bits where max{Ai} has zeros,

Proof. T h e t h e o r e m is easily proved by extending Theorems 2.1 and 2.4 for C L O s a m o n g m o r e than two numbers.

[]

T h e o r e m 2.6. Let A, B, A < B be decimal numbers, i.e., f o r the greatest i f o r which ai ~ bi = 1, it holds that 3(ai)6(bi - 1) = 1 and E = A C A N D B, D = A C O R B. Then E=0

and

D=A+B O, then D < A + B.

(2.21)

(ii) If the summation of A and B is A + B > 2" - 1, then E > 0.

(2.22)

Proof. (i) It results from (2.9) that A + B - D = E > 0, i.e., D < A + B. (ii) If A + B > 2" - 1, then using (3.9) it results that E = A + B - D > 2 n - 1 - D > 0. D

3. Derivation of coordinate logic filters A two-dimensional (2D) digital signal will be denoted by a 2D set

G = { g ( i , j ) , i = 1 , 2 . . . . . M, j =

1,2 . . . . . N},

(3.1)

where M and N denote the finite dimensions of the signal in the horizontal and vertical directions, respectively. The corresponding filtered output signal is denoted by F = { f ( i , j ) , i = 1,2 . . . . . M, j ---- 1,2 . . . . . N}. (3.2) In what follows, for simplicity we will usually denote the input and output images as G and F, respectively. At this point we derive four basic morphological operations, dilation, erosion, opening, and closing, using CL filters. First we decompose the given gray-level image G in a set of binary images & = {sk(i,j), i = t , 2 . . . . . M, j = t, 2 . . . . . N} k = 0, 1 . . . . . n - 1, according to the decomposition of the (i, j ) pixel, as follows: n--I

g(i, j ) = ~

sk(i, j ) 2 k,

i = 1, 2 . . . . . M, j = 1, 2 . . . . . N,

(3.3)

k=0

where sk (i, j), k = 0, 1 . . . . . n - 1, are the binary components of the decimal pixet values g(i, j), i = 1, 2 . . . . . M, j = 1, 2 . . . . . N.

3.1. Dilation The CL dilation of the image G by the stIucturing element B is denoted by GDB(g(i, j)) or, for simplicity, by GB~ and is defined by F=GB ~ n--1

=

Z]( Sk(i, J,) ,) nk2 k=0

,

i = 1, 2 . . . . . M, j = 1, 2 . . . . . N,

~3.4)

COORDINATE LOGIC FILTER APPLICATIONS

525

where(sk(i,"J)) D B denotes the dilation operation on the binary value sk (i, j) by the structuring element B, given by (sk(i,"J))BD = OR sk(i, j ) ~ B.

Moreover, note that f ( i , j ) ,

i = 1, 2 . . . . . M,

j = 1, 2 . . . . . N is in the range

(maxg(i, j ) ~ B) < f ( i , j) < 2" - 1.

(3.5)

3.2. Erosion

The CL erosion of the image G by the structuring element B is denoted by G~ and is defined by F=Gw

EB

n-1

= Z(st(i,

j))~e2k,

i = 1, 2 . . . . . M, j = 1, 2 . . . . . N,

(3.6)

k=0

where (sk(i, j))e8 denotes the erosion operation on the bindary value sk(i, j ) by the structuring element B, given by (s~=(i,"J))Be = AND sk(i, j ) ~ B.

Moroever, note that f (i, j ) i = 1, 2 . . . . . M, j = 1, 2 . . . . . N is in the range 0 < f ( i , j ) < min(g(i, j) 6 B).

(3.7)

3.3. Opening

An erosion followed by a dilation tends to remove all small objects and projections, without changing the overall size of an object. The resulting CL operation is called E D opening and is denoted by (Gn)n.

3.4. Closing

A dilation followed by an erosion tends to fill holes and concavities, without changing the overall size of an object. The resulting CL operation is called closing E and is denoted by (G D B)B.

526

MERTZIOS AND TSIRIKOLIAS

3.5. Filter structures

The CL-based erosion and dilation operations have a similar functionality with those of the corresponding morphological operations. Specifically, CL-based erosion tends to remove small objects and small projections, whereas dilation tends to fill holes and concavities in objects; i.e., the operations have complementary smoothing actions sharing the characteristic of either decreasing or increasing the size of an object. The output ranges of CL-based erosion and dilation satisfy (3.5) and (3.7), respectively. Various filter structures may be considered, depending on the size of the edge, the location of the origin, and the type of CLOs, and depending on whether or not the origin is taken into account. Indicatively, one characteristic rhombus structuring element is described by *

[,1

9

where [.] denotes the location of the origin (i, j) and 9 denote the pixels in the structuring element. The filter structure of a 2D CL filter, corresponding to this rhombus structuring element, is f ( i , j ) = g(i - l, j ) o g(i, j - l) o g(i, j ) o g(i + l, j ) o g(i, j + t).

(3.8)

Using the filter structure of (3.8), the erosion of the image G using CL filters is given by f ( i , j ) = g(i - 1, j ) CAND g(i, j - 1) CAND g(i, j )

CAND g(i + 1, j ) C A N D g(i, j + 1).

(3.9)

The new state of each pixel depends only on the present state of that pixel and those of its neighbors, thus the new states for each pixel in the filtered image can be computed independently and simultaneously. In a cellular context, the "neighborhood" of a given cell is defined as the extent of the structure of the CL filter when the origin of the structure of the CL filter is centered on that cell.

4. Properties of coordinate logic filters This section discusses the most fundamental properties of the operations of erosion, dilation, opening, and closing when they are implemented by CL filters. These properties hold for both binary and gray-level signals and images.

(1) Duality properties for dilation and erosion Dilation

G D = NOT(NOT G)Be

(4.1)

Erosion

G~ = NOT(NOT G)B9.

(4.2)

COORDINATE LOGIC FILTER APPLICATIONS

527

The proof of (4.1) and (4.2) results from the application of the De Morgan laws in coordinate logic [ 13]. The preceding duality properties allow for the interchange of the functionality of the image and its complementary image. These properties can also be extended to derive the duality properties for opening and closing.

(2) Duality properties for opening and closing Opening

( G .E) . D = NOT((NOT G)~).DE

(4.3)

Closing

( G .D) . E = NOT((NOT G).).. . o

(4.4)

Proof. Applying dilation of Gw we obtain from (4.2), E D B, DE (GB) B= (NOT(NOT G)B)8 D D = NOT((NOT G)e)

(4.5)

where property (4.1) was applied on NOT(NOT G)~. This proves property (4.3). Property (4.4) may be similarly proved. []

(3) Idempotence property for opening and closing E D

Opening

=

(t

E D E (G.).).

)~

(4.6)

B

Closing

(4.7)

Proof. The CLOs and morphological operators coincide for binary images St ={st(i,j), i = 1,2 . . . . . M, j = 1,2 . . . . . N}k = 0 , 1 , 2 . . . . . n - l , thus the idempotence property for opening and closing holds for each one of the binary images St. Therefore, for opening we have E D

E D (st).)...

(4.8)

From (4.8) we may write n--I

n-1

E) D

= =

2,. B

(4.9)

B

which is property (4.6) in its decomposed form. Therefore the opening operation has the idempotence property for CL operation. The closing property (4.7) may be similarly proved. [] (4) Extensivity for dilation and erosion. Dilation and erosion operators are related by G.~ _< C _< a .~ (4.10)

528 MERTZIOSANDTSIRIKOLIAS (5) Extensivity for opening and closing. Opening is an antiextensive operation, and closing is an extensive operation: E D

(GB) e G.

(4.1!)

5. Image processing applications In this section we will review some typical image processing applications using CL filters. In all these applications the rhombus structuring element described in Section 3 is considered.

5.1. Feature extraction The key issue in the morphological analysis of images is successive filtering and measuring of the residues. The particular method of filtering is usually based on erosion or opening, or some related variant. The feature extraction methodology in CL filters is similar to that of classical morphological filters in the digital case, because various features are extracted using a measure of the number of activated pixels in the residue. Hence, using CL filters, we can obtain the pecstrurn and other tools for shape analysis, [6], just as it is done with classical morphological filters. 5. L 1. Edge extraction. We can achieve edge extraction in an image G with CL filters using the same approach adopted with morphological filters. Specifically, first the erosion of the image G is extracted, and then the eroded image is subtracted from the original image. This operation is faster using CL filters than using topological min/max operations. Various combinations may be used to obtain the edges of an image, such as G ~ - G, G - Gw etc. A more symmetric treatment between the image and its background would be the edge estimator G~ - G~eo Edges in different orientations can be obtained by using a properly oriented, 1D structuring element. The size of the structuring element controls the thickness of the edge markers. The following CL edge detector is proposed:

[(C~~ CXOR G) - (C~ CXOR C)].

(5.1)

It gives results very similar to those obtained with morphological edge detectors and is faster than the morphological detectors because no sorting is needed. Edge extraction and enhancement may also be achieved by direct application of CL filters on the original image, without using arithmetic subtraction between images. Such an edge detector CL filter requiring only b CL operators, where b is the number of pixels belonging to the structuring element B, is given for b = 6 by f (i, j) = g(i, j) CAND CNOT[g(i - 1, j) CAND g(i + I, j) CAND g(i, j + 1) CAND (g(i, j - 1)].

(5.2)

COORDINATE LOGIC FILTER APPLICATIONS

529

In this equation the filter structure of (3.8) was used. In the same class of edge detector CL filters are those that use CXOR operations. One such simple CL filter is given by

f(i, j) = [g(i, j - 1) CXOR g(i, j + 1)] COR [g(i + 1, j) CXOR g(i - 1, j)].

(5.3) In this CL filter, the CL operation CXOR detects the existence of difference in a specific direction, while the logic operation COR detects the existence of a difference in an active neighbor. The performance of the proposed CL edge detectors can be improved by using threshold values or other sophisticated algorithms depending on the specific application. Figure la shows an original MRI image G1 and Figure lb shows the edges of G1 using the CL filter of (5.1). Figure 2a shows another original physical image G2, and Figure 2c shows the edges of G2 using the CL filter of (5.2).

5.1.2. Pecstrum. An excellent approach to extracting geometrical information from signals is via mathematical morphology. The goal of mathematical morphology is the quantitative description of geometrical structures. In this paper we show an analysis tool, based on the principles of mathematical morphology, that can be used to quantitatively describe the geometrical structure of a signal. This well-known tool is called the pecstrum, which is short for pattern spectrum. The pecstrum possesses many qualities that make it attractive for use in low-level computer vision tasks, including the abilities to operate on data gathered from multidimensional sensors, be efficiently implemented on cellular logic computer architectures, and provide a compact, quantitative description of shape and structure that has a direct physical interpretation. The pecstrum function is written as follows:

P(n)

Mes(G~s G(n+I)B) , Mes(G) -

=

-

n = 0 , 1, 2 . . . . .

(5.4)

where N

Mes(G) = ~

N

~

F(g(i, j)),

g 6 N,

(5.5)

i=1 i=1

g(i, j) denotes the integer gray-level value, and F(x) = 1 ifx > 0 and F(x) = 0 ifx = 0. Moreover, G* denotes any of the operations of erosion, dilation, opening, or closing of the image G by the structuring element nB.

5.1.3. Multiresolution feature separation. Spatial image features of various resolutions can be decomposed by a multiresolution morphological method called the

feature width morphologicalpyramid (FMP) [6], [7]. The FMP image decomposition is a multistage process in which the input image is filtered by an open-close (OC) filter at each stage. The filtered image from the current stage becomes the input of the next stage, and the difference between the input image and the output image is calculated. The structuring element used in the OC filter of the next stage

530

MERTZIOS AND TSIRIKOLIAS

Figure la. An original MRI image GI~

Figure lb. The edges of the image G1 using the CL filter of (5. t).

has a larger size than the one used in the current stage. For a primary image Fo, its N-level FMP {L1, L2 . . . . . LN} is described by Fi = OCi(Fi-~),

(1 _< i < N)

(5.6)

Li

(1 < i < N), LN = FN-1,

(5.7)

=" F i - I

-

Fi,

where OCi (X) is an OC filter for the ith stage using a set structuring element Bi. The first N - 1 decomposed subimages are called feature images, because each of them contains fine image features of known resolution.

COORDINATELOGICFILTERAPPLICATIONS 531

Figure 2a. An original image G2.

~gure 2b. The edges of the image of G2 using the CL filter of (5.2).

5.2. Noise removal--The majority coordinate logic filter Using coordinate logic operations in combination with Boolean algebra, we can build powerful filters for noise cleaning. In what follows we present the majority coordinate logic (MCL) filter. In binary signals, the majority function is a simple predicate whose output is 1, if and only if more than half of the input units are ON [1]. If the population is k, then the output of the function will be the value that has the majority. Ifk is odd, the majority is (k + 1)/2 terms or more; ifk is even, the majority is k/2 terms or more. If no pixel value in the specific neighborhood satisfies the majority criterion, the output of the function is 0. However, usually in practice, for this case we set the initial pixel value f(i, j) = g(i, j), instead of 0. In the regular majority function, the output of the function will be the pixel value that has the majority in this neighborhood. However, the majority CL filter implements the majority function at each binary level of the signal in the specific active neighborhood by selecting the n bits having the majority in this neighborhood in each of the n binary images. The majority CL filter results by checking all the possible combinations of k objects, taken (k + 1)/2 each time. Thus the

532

MERTZIOSANDTSlRIKOLIAS

majority CL filter implements quickly and easily an approximation of the measure of the majority value that is suitable for additive noise removal. If we consider an active neighborhood of 5 pixels defined by the filter structure of (3.8), the output f(i, j) of the majority CL filter that implements the majority function at each binary level of the signal is formed by selecting those bits that correspond to at least (5 + 1)/2 = 3 binary pixels of equal value. The specific majority CL filter results by checking all the possible combinations of 6 objects, taken 3 each time, as follows:

f(i, j) = [g(i, j) CAND g(i + 1, j) CAND g(i, j + 1)] COR [g(i, j) CAND g(i, j + 1) CAND g(i, j - 1)] COR[g(i, j) CAND g(i + 1, j) CAND g(i - 1, j)] COR [g(i, j) CAND g(i, j - 1) CAND g(i + 1, j)] COR[g(i, j - 1) CAND g(i + 1, j) CAND g(i, j + 1)] COR [g(i, j - 1) CAND g(i, j + 1) CANE) g(i - 1, j)] COR[g(i + 1, j) CAND g(i, j + 1) CAND g(i - l, j)] COR [g(i, j - 1) CAND g(i - 1, j) CAND g(i + 1, j)] CON[g(/, j - 1) CAND g(i - 1, j) CAND g(i, j)].

(5.8)

For binary images, the CL filter becomes simpler, because the CL operations are reduced to simple logic operations. Comparisons with median and mean filters, which are the most prominent filters for noise removal, have been done using signal-to-noise ratio (SNR) criteria. Specifically, Figure 3b shows the application of the filter of (5.8) to the noisy image of Figure 3a, and Figure 3c and Figure 3d show the application of a 4-neighbor median filter and a 4-neighbor weighted mean filter, respectively. The SNR of the "salt-and-pepper noise" image of Figure 2a is 45 dB. The percent improvement of the image is 40% using the MCL filter, 42% using the median filter, and 5% using the weighted mean filter. Thus the efficiency of CL filters is comparable with that of median filters.

5.3. Image magnification CL filters can achieve fast image magnification (zoom) as is described by the following algorithm: Algorithm 1. Image Magnification

Step 1. Let there be an N x M image G4 (Figure 4a). Multiply the coordinates of the pixels of G by an integer K and obtain a new spread image G4 with dimensions (N x K) x (M x K) (Figure 4b). Step 2. The empty areas in the image G4 are "zeros" and represent background. The problem consists in filling this background to obtain the magnified image.

COORDINATELOGICkg~ILTERAPPLICATIONS 533

.

-

: : :

Figure 3a. A noise image G3.

Figure 3b. The result of the application of the majority filter to the image of G3.

The application of a CL filter to the image G4 can solve this problem quickly and easily. The CL filter that has been used for the magnification task has a square structuring element, and its size depends on the scale factor K. This filter actually implements a dilation on the image G4 and therefore it uses the COR operation. The magnified image is denoted by F (Figure 4b). In the considered example the size of the square filter structure is K = 3. Then the structuring element is

[*]

*

9

and the associated CL filter is

f ( i , j) = gl(i, j) COR gl(i, j + 1) COR g~(i, j + 2) COR gl(i q- 1, j) COR g~(i + 1, j + 1) COR gl(i + 1, j + 2) COR g~(i q- 2, j) COR gl(i + 2, j + 1) COR gl(i + 2, j + 2). (5.9) In addition, scaling to a specified direction may be achieved by multiplying only the coordinates of the selected axis and then applying the appropriate CL filter.

534

MERTZIOS

AND TSIRIKOL!AS

,,, :::::2;9;,

:? ) :

!

Figure 3c. The result of the application of a median filter to the image of G3.

Figure 3d. The result of the application of a weighted mean filter to the image of G3.

The results of the image magnification using a K x K CL filter would be exactly the same if every one of the pixels in the small image were replaced by a K x K block of pixels all having the same gray value.

5.4. Fractal modeling We can use CL filters to construct quickly and easily various forms of the wellknown Sierpinsky triangles [2]. The additional advantage of using CL filters to construct Sierpinsky triangles is the gained insight of the relation of direct logic operations to known fractal structures. The pseudocode in BASIC for one specific form of the Sierpinsky triangle is given by the following Algorithm 2.

COORDINATELOGICFILTERAPPLICATIONS 535

Figure 4a. An original image G4.

Figure 4b. The magnified image F after magnification 1 : 3 using CL filters.

Algorithm 2 FOR i = 1 to N FOR j = 1 to N pset(i,i OR j),k NEXTj NEXT i In Algorithm 2, N = 2 ~, and the operation OR is actually the coordinate logic OR (COR), while k represents the drawing color. The command pset(i,i OR j),k is used to set the pixel value k to the position (i,i OR j). Figure 5a shows the result of the execution of Algorithm 2. Figure 5b shows the generation of another fractal form that was created using CL filters. At this point we want to emphasize the relation of direct logic operations to artificial and natural fractal structures. The applications of this remarkable property of CL filters are not confined to the construction of fractals, but also extend to the transformation of an image G to a fractal encoded form F. The goal of this transformation is that, by describing the transformed image as a fractal, we can extract new features and descriptions. The transformed image obviously has a much higher order of self-similarity than the original one, thus making the transformed image attractive for ffactal compression. Because the proposed fractal transfor-

536

MERTZIOS AND TSIRIKOLIA$

V

Figure 5a. The creation of Sierpinsky triangles using CL filters.

-~4,Figure 5b. The creation of a fractal using CL filters.

mation is a nonlinear transformation, reconstructing the original image from Me transformed one is a very difficult task. We expect to achieve it at the expense of a big computational load and a very small error tolerance, using the properties of CL filters and sophisticated algorithms. The pseudocode for the fractal transformation of an image having dimensions N x M is given by the following Algorithm 3. Algorithm 3 FOR i = 1 to N FORj= 1toM pset(i,i OR j),g(i,j) pset(i,i AND j),g(i,j) NEXTj NEXT i

COORDINATELoGic FILTERAPPLICATIONS 537

The command pset(i,i OR j),g(i,j) is used to set the pixel value g(i,j) to the position (i,i OR j).

6. Concluding remarks This paper presents coordinate logic filters, a new family of nonlinear digital filters that are based on the execution of coordinate logic operations. The key issue in coordinate logic analysis of images is the method of fast successive filtering and managing of the residues. Processing using CL filters is achieved by executing only direct coordinate logic operations among the pixels of a given image. CL filters can be applied to both binary and gray-level images and are efficient in various 1D and 2D processing applications such as opening, closing, region filling, fractal coding, shape smoothing, image magnification, and noise removal, as well as feature extraction tasks, like edge detection, calculation of the pecstrum, and fractal transformation. CL filters provide a tool for processing gray-level images as a set of binary images. Therefore, CL-based decomposition of gray-level images can be used to extend existing processing and analysis techniques (e.g., [ 12]) of binary images to gray-level ones. These tasks are an objective of future work. CL filters may be implemented more easily and quickly than OS and other nonlinear digital filters, using logic circuits or cellular automata, and they are characterized by inherent parallelism. CL filters are functionally similar to morphological filters. In general, using CL filters instead of morphological filters for the development of specific analysis tools does not lead to better performance. The critical advantage of the CL filters is their high-speed implementation and simplicity, because they use only Boolean logic operations, whereas the morphological filters require repetitive time-consuming sorting operations. In certain cases, as in noise removal, where the performance of CL filters is comparable with that of median filters, CL filters show better performance than morphological ones. Also, certain applications, such as fractal modeling, can be implemented by CL filters but not by morphological ones. More sophisticated CL filters may be designed, depending on the specific requirements of the application, using selected bit planes or applying different structure elements at each bit level. Moreover, processing and compression of gray-level images may be done by running the CLOs on the "more significant bit planes" and ignoring the "less significant bit planes" that might correspond to noise.

References [1] S. Ahmad and G. Tesauro, Scaling and generalization in neural networks,Advances in Neural Information Processing Systems I (D. S. Touretzky,ed.), pp. 160-168, 1989. [2] M. E Bamsley,Fractals Everywhere, AcademicPress, New York, 1988.

538

MERTZIOS AND TSIRIKOLIAS

[3] D. L. Dietmeyer, Logic Design of Digital Systems, Allyn & Bacon, Boston, MA, 1971. [4] M. James, Pattern Recognition, BSP Professional Books, Oxford, London, 1987. [5] J. H. Lin and E. J. Coyle, Minimum mean absolute error estimation over the class of generalized stack filters, IEEE Trans. Acoustics, Speech, and Signal Processing, vol. ASSP-38, no. 4, pp. 663-678, Apr. 1990. [6] P.Marag•s• Pattem spectrum and mu••sca•e shaperepresenta••n• •EEE Trans`•n •attern Ana•ysis and Machine Intelligence, rot. PAMI- 1 I, no. 7, pp. 701-716, July 1989. [7] P. Maragos and R. W. Schafer, Morphological systems for multidimensional signal processing, Proc. IEEE, vol. 78, no. 4, pp. 690-710, Apr. 1990. [8] B. Mertzios and K. Tsirikolias, Coordinate logic filters in image processing, IEEE Winter Workshop on Nonlinear Digital Signal Processing, Tampere, Finland, Jan. 17-20, 1993. [9] Y. Nakagawa and A. Rosenfeld, A note on the use oftocal rain and max operations in dJgit,'d picture processing, IEEE Trans. on Systems, Man, and Cybernetics, vol. SMC-8, no. 8, pp. 632-635, Aug. 1978. [10] J. Serra, Image Analysis andMorphologicat Filters, Academic Press, New York and San Diego, CA, 1983. [ 11] 3. Serra and L. Vincent, An overview of morphological filtering, CircuitsSystems Signal Processing, vol. 11, no. 1, pp. 47-108, 1992. [12] I. M. Spiliotis and B. G. Mertzios, Fast algorithms for basic processing and analysis operations on block represented binary images, Pattern Recognition Letters, vol. 17, pp. 1437-1450, Feb. 1997. [13] K. Tsirikolias and B. G. Mertzios, Logic filters in image processing, Proceedings of the International Conference on Digital Signal Processing, pp. 285-287, Florence, Italy, Sept. 4-6, 1991. [14] K. Tsifikolias and B. G. Mertzios, Edge extraction and enhancement using coordinate logic filters, Proceedings of the International Conference on Image Processing: Theory and Applications, pp. 251-254, San Remo, Italy, June 14-16, 1993.