Automatic image analyser

Automatic image analyser

Automatic image a lyser A portable system for automatic image analysis has been b a s e d on a microprocessor. M C Toner, M Dix a n d H Sawistowski de...

6MB Sizes 4 Downloads 171 Views

Automatic image a lyser A portable system for automatic image analysis has been b a s e d on a microprocessor. M C Toner, M Dix a n d H Sawistowski describe the new application.

Automatic image~nalysis systems have traditionally performed image processing using either special-purpose hardwired logic or minicomputer software. It is now possible to design a real-time image analyser based on a microcomputer and such a system is described briefly. The analyser performs advanced image processing and yet is portable and inexpensive. The enormous potential o f microcomputers is illustrated by an application such as this. The design of systems performing automatic image analysis has changed rapidly in the last decade. Advances in the range and capability of electronic components at first allowed automatic analysis to be performed by specialpurpose hardware. The design of the logic circuitry was complex, however, and the finished product was inflexible in operation. A more recent trend has been to perform the analysis of images almost entirely by software, since logic designs are far easier to write in software than to implement in hardware. Image-analysing computers, as they are known, are available commercially and generally consist of a specially designed detector interfaced to a minicomputer; costs of such sophisticated systems are often prohibitive. For inexpensive image analysers it is sensible to utilize the large amount of development effort that has gone into standard television equipment, the penalty being a reduction in accuracy and precision. Very few systems performing real-time analysis of objects imaged by a TV camera have been described in the published literature, and none have been based on microprocessors. The recent advent of microcomputers now makes it possible to use a small dedicated processor for image reconstruction and analysis with all the advantages that microprocessors bring: cheapness, portability, flexibility, high reliability and low power consumption. A major disadvantage is that microprocessors often have to be programmed in a machine-level or lowlevel assembly language, but this difficulty is being eased by the increasing availability of assemblers and high-level languages. A system which makes use of standard television equipment and a microprocessor can therefore use readily-available components, be portable and inexpensive, and yet be powerful enough to perform advanced image and shape analysis for a whole picture frame in a fraction of a second. This article briefly describes such a system and discusses the choice of a suitable microprocessor and techniques for interfacing it directly to standard television equipment. The Department of Chemical Engineeringand Chemical Technology, Imperial College, London SW7 2BY

90

system is intended for use in an instrument for real-time counting and sizing droplets in a spray system in both two and three dimensions 1, 2and which is designed to be portable and to operate in situ in industrial environments.

SYSTEM DESIGN

The rate of video information from a standard television camera is approximately 8 MHz and a fully digitized picture frame amounts to approximately 10Mwords/s. The role of a microprocessor in a portable particle-sizing instrument was initially seen as one of data reduction, both in quantity and rate, so that intermediate data could be dumped as output in real time to, say, a cassette recorder, this data being later fed into a larger computer for offline analysis. A 16-bit processor was required because coordinates of picture elements within a television frame of 625 lines require at least 9 bits for specifying the position along a line; flags are also needed with each coordinate to signify such things as the beginning of a line, empty line, etc. The Plessey Miproc-16 microprocessor in a PK development system was chosen because of its fast execution speed (350ns full cycle time) and because of previous experience with it in developing the Anticipator system 3 for hazard analysis in engineering plant. Many schemes were considered for getting the information from a video frame into memory, including the buffering of various parts of the frame, e.g. one line at a time, in each successive frame. Unfortunately, this required the same picture to be scanned by the camera for many frames, whereas in practice stopping particle motion by flash illumination would yield only one frame for analysis. Each video frame is composed of two interlaced fields which are scanned alternately by the camera; reconstructing a frame by a suitable combination of its fields is difficult by hardware alone, especially when only one frame is available for analysis, i.e. the same picture cannot be scanned continuously. The difficulty of dealing with the interlace produced by standard TV equipment has been one of the major reasons for not using such systems in the past. The use of software, however, readily overcomes this problem. Hardware

Storage of a video frame was achieved using hardwired logic to reduce the data quantity by thresholding in a comparator the greylevel of each picture element into two levels,

microprocessors

~,

_..',.

~~:<

i «

9900

I I

MICROCOMPUTER * FAMILY

'-

~~~.

COll~A'TIBILITY l"~~

I

~ ~

t~

I

~ &~~:~,:{t~~

The Family Concept The 9900 family of 16 bit multipurpose micro-

rWMW~

=tMM-Wt :~:::~;~~:~:,:~;.;.:;:;

t~i~tfi@

~:,-:.;:;::",:;:~:::~:

~~fK@@l ~M!M[@ *n%~n

@@ffit@ %gWH~

tmmW

'iM@l&: ~gl:¥ilt iMfWMi

ImNf6, ·'\;:~gtf~~

;;::::t&

~

the outcome is your skill So it should be with a microprocessor

~rr~~~~~~~i~~~c~~puter I boards and AM PL proto- :,: typing systems offer the i designer complete

if'lff:lfl

nMmM

,:; ~

systems support and so FfWARE compatibi lity.The microprocessors allow a design t~ be tailored to its environment TMS9900 for high performance,TMS9980 for low cost and the SBP9900 for full military operation. Also family support for I10-TMS9901 general purpose 110 and interrupt control,theTMS9902/3 async./sync.communications controllers and soon to be available will be D.M.A., I.E.E.488 Bus and Floppy Disc controllers. Systems Supply offer all these products plus t~e RAMs, PROMs and EROMs to complete an entire microcomputer system.

~: @ @

~1

~:

f

~~

f

i!

~

:f ~.~.1

:~

}

"::::::.:.:.:.~.:~.:.;.:-:-:.:.:.;.:.:.:.:-:- ••,:-:-:.:.:.:.:.:.;.:-:-:.~~-;.;.:.:-:.:.:.:-:-:.:.:;.;.:.:.;.: ·:-:·:-:·:·:';'=-Y:-:':-:':-:-j:-:·:-:·:.:~·;.:·:·:·:..; ·:·:·:-:·:-:" :':-::·:·;·:·:-:';':':-:-=':-:.:-7-::·:-:-:::~

system. The hardware should complement your individual skill. This is the Zilog concept. Zilog from Micropower-your best move. Zilog

Micropower

.2-80 158 instructions, .In depth technical expertlse - both software compatible with all 7B aOSOA instructions hardware and software. • Full producttreining Out-performs any other MPU in 4-. 8- or 16bit operations. Fully facilities. complemented by superb • After sales service of all support chips. . Zilog products. • Complete Zilog range. • Z-BO Microcomputer Board Series. Fully expandable. • T~e U~'s f!rst dedicated..., .2-80 MicrocomputersZlIog distriburorv ~ 'M,ini'capabilities at low ;,~ prices. " <,;,~ ,,\,~ .2-80 Software. The ~ N.~~~'l-" ultimate 'Micro' Software ~ ~~~~~~ and well documented. r-...~\) (f.>~ -'" Optional BASIC inter~CO~y..~~ ~~e~ preter and more. ~ <;<.0 ~~ ,,<-oJ .2-80 The system ~ ~~~'2>~I).'\'l-'\ ~ that's all ~",,,,v'9-~~ together~fflt..~~~~(>'l-<:j ~~ now! ~ ....ft"V O~
1:'00

.V

TEXAS INSTRUMENTS LIMITED

SupplyDivision MS21,Manton Lane,Bedford:MK417PA. Tel: Bedford (0234) 211655, Telex: 82178. Edinburgh 0312295573. Manchester 0614427000. Slough 075333411. Southampton0703 27267. vol 2 no 2 april 78

r-~V::¢O'\~e.
'........

,.~~ ."\~

\)

, ~ ~?>e~~:~ •

:el" <;.<;v <,e ,,0

~;/\1:;~~
V

#(>....

y..~~~,,<><' e·e~
>o\~~'"

91

either black or white, according to a predetermined reference, and by ignoring successive elements of the same polarity. Only the coordinates along each line ol the first elements in a run of either polarity need to be stored, i.e. the border elements of each image, since they comprise the minimum information necessary for simple image analysis. It became apparent that these coordinates, available at a variable rate of up to 8MHz, could be dumped directly into memory by DMA (direct memory access), thus allowing the whole frame to be stored while it is being scanned by the camera, i.e. in 40ms. The RAM memory of the Miproc has a sub-100ns access time, and is therefore suitable for DMA at a maximum datarate of 8MHz. From a total of 5kwords of data memory more than 4 kwords are available for transition coordinates, allowing a maximum number of 8~ transitions per line over the whole picture to be stored. Although a DMA facility was not commercially available for Miproc at that time in late 1976, a suitable scheme had been designed by Plessey Microsystems and with their technical advice a DMA facility was satisfactorily incorporated into the system. A mode selector was included to

[ I

Miproc

Figure 1. Block diagram of the system

enable the operator to select an appropriate operating sequence, e.g. to initiate DMA dumping of the next frame by a front-panel switch or to let it be triggered by software. A standard Teletype interface was combined with an interrupt unit so that alphanumeric I/O would occur only under interrupt control and would not therefore substantially delay execution of the analysis program. Figure 1 is a schematic diagram of the system which shows the main components. A video mixer and TV monitor are used by the operator to set comparator reference levels by observing the position of detected transition points superimposed on the original images. I igure 2 shows the camera, monitor, comparator and microcomputer assembly.

Software It was soon realized that instead of using the Miproc as a preliminary processor of the data, its powerful instruction set combined with the optional index register would be sufficient for complete image analysis; further offline processing would not then be necessary. An algorithm was developed based on linking all transitions belonging to the same image and a program written for counting and sizing each image in terms of vertical diameter, perimeter and area; a dimensionless shape factor could also be calculated. The program, written in Miproc nmemonic assembly language, allowed individual output of size parameters for each image in a frame or accumulation of results over many frames, e.g. [or film analysis. Ordered searching through the data when linking transitions belonging to the same image is facilitated by constructing a pointer table which contains the address of the start of each scan line. Interleaving these addresses from each interlaced field in effect interleaves the data in each field, so that the problem of interlace is overcome. Since a monitor program was not available with Miproc, an operating system was written to construct and drive I/0 routines to and from the Teletype under interrupt control. Developing the algorithm, writing and debugging the complete program took many hundreds of manhours; the task was eased by using a crossassembler run on a PDP 11/05 minicomputer. Lack of a high-level language was inconvenient, but resulted in an efficient program of minimum length being written, which conveniently just fitted into a block of 1 kword. A routine to dump the contents of memory pictorially has been written, and currently being designed is the facility to recreate from memory a video frame for display on the TV monitor.

PERFORMANCE

Figure 2. The complete image analyse/', comprising comparator (foreground), microcomputer assembly, video camera (top) and monitor fright)

92

The high speed of the overall analysing process is due to the fast instruction execution time of Miproc. Images in one picture frame with a total of 1000 transitions, e.g. 50 shadows 10 lines high, are completely counted and analysed in terms of three size parameters and a shape factor, and all results sorted into appropriate size ranges, in 80ms, including 40 ms for scanning and dumping the picture into memory. Thus the time per transition for analysis is ap-

microprocessors

proximately 40/~s, equivalent to executing more than 1O0 basic machine instructions. This number of machine-code instructions executed for each analysed transition gives some indication of the complexity of the software required for complete analysis. As it has turned out, image analysis could be performed by a slower and cheaper microprocessor as long as fast-access memory is retained for DMA storage; converting the present system to any microcomputer should be straightforward.

illustrates the power and potential of microcomputers in general.

ACKNOWLEDGEMENTS This work was supported by the Science Research Council. The authors are grateful to Mr L R T Tyley for originally suggesting the use of a microprocessor in this application, and to Plessey Microsystems for technical advice.

REFERENCES

CONCLUSIONS The great advantage of a microprocessor in this application is that with a suitable choice of hardwired logic to make the data quantity compatible with available memory, full image analysis on two grey-levels has been achieved: this was beyond expectation when the project was commenced. In addition, the system is portable, flexible and inexpensive compared with commerical instruments of comparable capability. Finally, the successful implementation of a microprocessor in this relatively difficult application

1 Dix, M J, Sawistowski, H and Tyley, L R T 'Instrumentation and techniques for a direct computeraided analysis of drop and particle systems, in Rolls, P J (ed.) High speedphotograph2 Chapman and Hall, London (1975) pp 404-407 2 Tyley, L R T, Sawistowski, H and Dix, M J Device for evaluating drop systems UK Patent No 1453 OS3 (I 976)

3 'MIPROC-16 monitors safety' Product Review Microprocessors Vol 1 No 3 (1977) p 204

The most significant event about microcomputers in ,Q~, business and at home. Two conferences plus I major exhibition plus seminars/workshops / plus public debates.

I

I I

elf

I

; ....

• ........

/

Please send me a fullydetailed brochure about

The 1978 Do-it-yourself Computer Show Name Address

W e s t Centre Hotel, L o n d o n

/ I

Return to: Online Conferences Cleveland Road, Uxbridge, UK UB8 2DD

J vol 2 no 2 april 78

93