• Nem Talált Eredményt

LCW-LEVEL EXTENSIBLE LANGUAGE SYSTEM POR IMAGE PROCESSING

Andrzej BIELIK, Michal l&ODKCWSKI, Maria PIOTROWICZ.

Institute of Biocybernetics and Biomedical Engineering, Polish Academy of Sciences

KRN 55

00-818 Warsaw, Poland

Abstract

We present in the paper a proposal for a standard set of primitives of picture processing yfcarallel and sequen­

tial/operations together with means to compose any opera­

tion from them. These composition rules take a form of a language* It is built as an extension of the C language.

The method of implementation of the system is also essen­

tial in our approach. Since we use a special compiler- compiler technique of implementation, we gain extensi­

bility and portability of the system,

I. INTRODUCTION

Pirst of all, we distinguish in a picture processing system three different levels :

1, machine instruction / or operation primitive / level$

2. operation / or composition language / level* and 3. user command / or task / level*

This distinction may look different in different systems depending on what is assumed as primitive in a given sys­

tem* Access to pixels, some primitive operations on them, and some scanning control primitives are primitives for a sequential processor, whereas for array processor some

operations on the whole pictures are primitives* The dif­

ference between levels lies in their form rather than contents* While levels 1 and 3 are sets of parameterized commands, level 2 is a set of expressions built according to some composition rules. Decomposition of the system into levels makes it modular and enables its analysis.

We deal here only with levels 1 and 2.

The first thing in system analysis is to check whether it contains all three levels. Level 1 must always be pre­

sent* Thus only the question of level 2 is important for us here. Systems with this level included are versatile

in the sense that indefinite number of qualitatively different operations can be expressed in them.

Systems built as libraries of subroutines / e.g. SPIDER / 1 / / in fact lack composition language level and,

in consequence, are not versatile. You will always find

an operation for which you will have to write a new,

special subroutine, even though the library were embedded in a language. The point is that the elements of opera­

tions should be embedded in the language rather than ope­

rations themselves. Otherwise the language ants as a user command language rather than composition language.

The next important point is the method of implementa­

tion of the composition language. Several approaches were taken in published systems.

1 . Picture operations primitives embedded in existing ge­

neral purpose language as procedures /e.g. in C /2/ /;

2. Picture operations primitives and composition language built over existing general purpose language as its extension :

2.1* by means of preprocessor /e.g. over PASCAL /3/ /;

2.2. by means of modification of existing compiler /e.g. ALGOL 60 /4/ /.

Although approaches 1 and 2.1 give systems which are easily extensible / new operations can be easily added / and are portable / changed hardware implementation of primitives is met by change of appropriate procedures /, yet they suffer from cumbersome syntax. On the other hand, approach 2.2. ensures excellent syntax, but systems are hard to

modify. Therefore we have taken another approach. We use a special compiler-compiler which enables easy modifica­

tions and convenient syntax at the same time.

The questions of the set of primitives and the composition language themselves are, of course, most important design problems. We have chosen the usual way of extending gene­

ral purpose language with pictorial primitives and mecha­

nisms. We have taken the G language for that purpose.

be

Next sections will devoted to pictorial extensions as well as compiler-compiler description.

II. PICTURES

Pictures are represented as 2D arrays of numbers.

They can be of any size and any gray value range / up to 2 bytes / including binary pictures. They can be stored in main memory, display memory, or mass storage.

Some picture analysis tasks / e.g. the intelligent recognition / require processing of parts of pictures only. Typically, they are windows and grids. The grid is a set of pixels evenly spaced over picture. The grids are usefull for rough picture processing.

III. PICTURE SCANNING OPERATIONS

The picture operation is an arbitrary function with pictorial arguments and/or results. We distinguish a broad class of most often used operations and call them scanning operations. They are those which can be written in the form of the following function :

f / x , S ^ ^ f / p / x / » ••• / / y where:

x is the pixel from the whole picture or its part, Sx is the neighbourhood of pixel x,

p /x/ is a pixel preceding x / relatively to some order /.

If f depends on x only, then it is called point-wise opera­

tion} If it depends on then it is called local opera­

tion} If it depends on f /p/x/, ••• / then it is called sequential operation / because to compute its value in a given pixel, its value in the preceding pixel is necessary/.

If f does not depend on f /p/x/, ... / then it is called parallel operation / because its value in any pixel does not depend on the computation order /, The parallel as well as

sequential operations could be point-wise or local.

IV. PRIMITIVES OP PICTURE SCANNING OPERATIONS

Picture operation of the form described in previous

section can be divided into 3 independent processes : control of picture scanning, access to pixel / or to its neighbourhood / and the proper computation of pixel value / or its neighbourhood /.

First and second processes take most of the execution time of the whole operation / when they are implemented on universal computer /. The idea is to supply the user with

the above processes as primitives by means of which the ar­

bitrary picture operation can be composed. Processes of scanning control and access to pixel can be divided into 2 groups : concerning whole picture / executed only once for whole picture / and concerning pixel / executed for every pixel /* In consequence, a user obtains the follo­

wing procedures :

- initiation of scanning / control and access to pixel / for whole picture}

- transition to successive image pixel} and

- access to current pixel or to its neighbourhood.

The following standard kinds of scanning are realized : - sequential

- lexicographical / row-wise from left to right and from top to bottom /

- reversed lexicographical / row—wise from right to left

and from bottom to top /.

The lexicographical scanning is most effective because it coincides with image alocation in computer memory*

Therefore it can be used to simulate parallel scanning / provided that the input and output images are distinct /.

All of the above primitives are realized in following versions : for the whole image, window and grid; for dif­

ferent types of images; and for different types of picture store.

The proper pixel processing is realized through direct use of processor instruction or language in which the pro­

cedures are embedded*

The above approach has made it possible to attain mo­

dular extensibility as well as time-effectiveness of our system. The time-effectiveness is achieved owing to simpli­

fication of control and access to pixel by means of extra­

cting the part which concerns a whole picture, and due to possibility of execution of control processes and access to pixel only once for many operations on the picture.