Poems

A transputer network for fast operations on digitised images

Description
A transputer network for fast operations on digitised images
Categories
Published
of 9
All materials on our website are shared by users. If you have any questions about copyright issues, please report us to resolve them. We are always happy to assist you.
Related Documents
Share
Transcript
  3 A Transputer Network for Fast Operations on Digitised Images H.R. Arabnia' and M.A. Oliver Abstract Algorithms for the translation and scaling of a digitised image are described. The algorithms have been designed to work on a transputer network which has a simple topology. This transputer network was srcinally proposed for the arbitrary rotation operation on dig- tised images'. The data structure used to represent the image is closely related to runlength encoding. Both operations can be performed in real time on non trivial images. 1. Introduction In a previous paper' we described an algorithm for the rotation of a digitised image on a particular network of transputers. In designing that algorithm: first, we assumed that we had an imaginary parallel computer; next, we chose an image data structure that could exploit our computer; then, we designed the algorithm (at this point we changed the configuration of our ima- gnw machine to suit the algorithm); and finally, we proposed the network of transputers as a realisation of our imaginary parallel computer. This approach resulted in an algorithm and a parallel machine that matched each other very closely. In this paper, we are concerned with the problem of how to exploit the same network to translate and scale images. Therefore, our approach is more tradi- tional here: we design and target the algorithms at a particular machine (the transputer network); we are not allowed to change or modify the machine architecture, nor are we allowed to change the image data structure used in the algorithm for the rotation operation (the stripcode image data structure). Therefore, the network used in this paper may not be the best parallel computer for the translation and scaling operations (the network was proposed for the 'Computer Science Department 415 GSRC, University of Georgia Athens, Georgia 30602 USA Computing Group School of Mathematical University of Bath Bath Avon BA2 7AY England Sciences arbitrary rotation operation). Nevertheless, it is essen- tial to be able to implement other geometrical opera- tions on the same network in order to have a useful machine. The algorithms for the translation and scaling operations described in this paper exploit the network. An algorithm is also given for the combination of two images, which turns out to be a very simple process. The data structure used to represent the image is 'stripcode' which we first used in a different context2.3. 1.1. Stripcode Data Structure Stripcode is essentially runlength code which exploits the horizontal coherence between adjacent pixels on a scan. Thus some account is taken of the image structure and so a reduction in the number of data objectsf in the image representation results. Consider a runlength coded image and spec@ a background colour. Each strip of colour, other than those of the background colour, is specified by the position coordinates of its srcin (ordinal number of its first pixel, scanline number), length (number of pixels), and colour. Since the background colour is not coded, in the stripcode representation an image is represented by a smaller number of data objects than is the case for runlength code. The coordinate system has its srcin in the lower left corner of the image space with the x-axis to the right and they-axis up. An image made up of strips is shown in figure 1; the numbers inside the strips ,.. ....,. I ... .,.I.,..,, I , I, ... , ,..,,I*.,, II.I,I..., ,.., *., ---..;..--;---.;.---:---: ._.. .-.; .-.. .---: __.; _._. .---.; .._ ___. ----- --...; .._ ~--.l~~~::l-... .--..I ..._ -...-.-- .-..+.-.-- -...+.... .---. ... -... ...-. , i6: i5i ; .___. ____ ,. . .. .- ._. I I. .... ..... ____L____ _... ..... . _.... ._.. ,,......, ... ..__.. ... . . ..I . . ..I . I I, ,,,IIIII.I II,I...II. .,,..... , .,,..III.. ,,..... .. ._.L .... _... L... a.__... .... ~.-.. .._. ._._ ..._. Figure 1. A stripcode image; the numbers indicate the order in memory fA data object is the basic unit in the image data struc- ture. For example if the image data structure is run- length code then each run is one data object, or if the image data structure is a quadtree then each leaf is one data object.  4 fl. R Arahnia el al. / Far1 Operarions on Digiiised Images represent the order in which they would be stored in a list (1 indicates the first strip in the list, 2 indicates the second, and so on). 1.2. The Transputer Network The image raster is divided into a number of blocks. Each block contains an equal number of scanlines. Figure 2 shows an example where the raster is divided into four blocks. Figure 2. A raster divided into four blocks There muld be as few as two blocks and as many as there are scanlines. A transputer is allocated to each block. These transputers are connected into a ring in the order of the blocks. Figure 3 shows a transputer network which is required for a raster subdivided into four blocks. Figure 3. The transputer network for four blocks The stripcode for each block is held in the local memory of the transputer which is assigned to that block. In the example shown in figures 2 and 3, the strips in Block 1 will be held in the memory of TI, Block 2 in T,, and so on. After any operation each transputer will hold the stripcode for that part of the resultant image which is in its block; namely, the block to which the transputer is assigned. In order to handle input and output, extra com- munication channels must be used in the ring. Two ways in which input and output can be handled are described in a previous paper’. In this paper it is assumed that each transputer holds the strips belonging to its block, before translation or scaling commences. The combination of two images using the network of transputers is a simple process. Each transputer can locally combine the parts of the two images that over- lap the block allocated to it. The result of the combina- tion in each transputer wiU belong to the same block to which this transputer is assigned. The program fragments are written in Occam4. However, we have taken the liberty to use subscripts in variable names which are printed in italic. Also, the arithmetic operator precedence of ordinary arithmetic has been assumed; accordingly, the extensive use of parentheses in arithmetic expressions has been omitted. 2. Translation In order to translate an image by X, , where X and Y are both integers, each transputer in the ring incre- ments the x-coordinates of the strips in its block by X and they-coordinates by Y. The strips that are entirely outside the image space are discarded and those par- tially outside are clipped to the image space. If the image is moved in the horizontal direction, so that X 0 and Y = 0, then the translated strips will belong to the same blocks as before. In this case the process of translation is complete. But if the image is moved in an arbitrary direction then the strips after translation will not belong to the same block as before. Hence the translated strips must be moved to the appropriate transputers. There are two cases to consider. First case: the vertical translation distance is a multiple of the number of scanlines in a block. In this case the contents (translated strips) of each transputer are placed in another transputer in order to get them to the correct blocks. This is done by sending the contents of each transputer rn nodes round the ring. The code that follows calculates m: IF YrO TRUE) m:= B- CYm rn := - Y/S) where B is the number of blocks and S s the number of scanlines in each block. Second case: the vertical translation distance is not a multiple of the number of scanlines in a block. In this case the contents (translated strips) of a transputer can. overlap two adjacent blocks. Thus the translated strips in each transputer can be divided into two sets, namely boftomet and topset; each set belongs to a different but  H. R Arabnia et al. i ...................................... lock4 ...... ..... ...................................... t ..................................... ...................................... lock 3 .................. ... .............. ............. .......... ...... blcrck 2 ... lock I Fast Operations on Digitised Images - a) rrips in TI and T2 before tranrformafion Figure 4. An example of the vertical movement of strips adjacent block. An example is shown in figure 4 where the image space contains twelve scanlines and is divided into four blocks; 4(a) shows the strips in TI and T2 (refer to figure 3) before, and 4@) shows the strips in TI and T2 after, the transformation. Notice that the strips in topset of T, and bottomset of T2 ust be placed in the same transputer. In general the strips in topset of T,, and bottomset of T,, +I belong to the same block of the image space. In order to move the translated strips to the correct transputers, each transputer performs the step that follow. (i) Find the translated strips in each set. Those that satisfy the condition, (y Z lower ) AND (y < upper ) belong to the bottomset and the rest to the topset. Where y is the y-coordinate of each translated strip. The variables lower and upper are found by: SEQ upper : = base+ Y+S S * S lower := upper - S --integer division-- where he s the y-coordinate of the first scanline of the block (such that in figure 4: base is 0 for block 1, 3 for block 2, ...) and S is the number of scanlines in each block S is 3 in figure 4 . Note that, to find the translated strips in each set, the list of the translated strips only needs to be checked from the start of the list until one is found that does not satisfy the above con- dition; the translated strips up to this point belong to bottomset and the rest to toper. (ii) Concurrently, output all strips in bortomet to the bottomset of the next transputer and input into the bottomset all strips in borromset of the previous transputer. Hence each transputer now holds in its ................ block 3 block 2 ...................................... t ..................................... ...................................... block I 5 fopset in T, botfomef n T2 roper in T, botfomet n T, ...................................... b) trips in TI nd T2 after tramformation bottomset the contents of the bottomset of the pre- vious transputer. To avoid deadlock and achieve concurrency a double buffer technique is used. iii) Copy all strips in topset onto a result area, resultbuffer, and append the mntents of (the new) bottomset to the same area. Now each transputer holds the strips belonging to one and only one new block in its resultbuffer. These blocks are not in the correct transputers. (iv) Finally the contents of resultbufler (block data) of each transputer is sent m nodes round the ring, to get each block data in the correct transputer. The local variable m of each transputer is equal to the rn of the others. The code that follows calculates m. IF Y>O TRUE) m : = B - Y/ S)) - --integer division-- m := - Y/S) --integer division-- The algorithm is illustrated by the example that fol- lows. Example Consider the case shown in figure 4 where X = 0 and Y = 5 (i.e. the second case above). It is assumed that the strips have already been translated and clipped (figure qb)). The contents of each transputer (refer to figure 3) at the end of each step of the alpr5thm is shown below. Step (i) TI has c, d, e in its topset and a,b in its bor- tomet. T2 has g in its topset and f in its bottomset. T3 has nothing. T4 as nothing.  6 H. R. Arabnia ei al. 1 Fast Operations on Digrtised Images Step ii) TI has c, d, e in its topser and fin its bot- tomset. T2 has g in its topset and nothing in its bot- tomet. T3 has nothing. T4 has nothing in its topset but it has a, b in its bottomset. Step iii) T, has c, d, e, fin its resultbuffer. T2 has g in its resubbuffer. T3 has nothing. T4 as a, b in its resultbuffer. Step (iv) m is found to be 2. TI has nothing in its resuitbuffer. T2 has a, b in its resultbuffer. T3 has c, d, e, fin its resultbuffer. T4 has g in its resultbuffer. Thus each transputer holds the data for its own block. 3. Scale In general, when a digitised image is scaled, the resul- tant image gets degraded. Thus for a series of scale operations, each operation should be performed on the srcinal image (source) in order to avoid cumulative degradation. Because of this degradation problem, the usefulness of scaling operations is, in general, fairly limited. However, the scale operation does play a role in the geometrical manipulation of digitised images, because more complex geometrical operations can be created by combining the low level operations (low level operations such as translation, scale, rotation, ...). There are a number of applications where the scale operation is useful. One example is in hand-drawn images used in electronic publishing. An artist can draw an image of sue M by N (M and N are chosen by the artist) where M and N are larger than H and V (V scanlines each H pixels long) respectively. He can work on small portions of the image he is creating; each por- tion is small enough to be displayed on the screen. Since the image space (M and N) are chosen by the artist, we can assume that this image space can hold as much detail as he wants to have. When all portions of the image are drawn, he can combine the images to get an M by N image. In order to see the overall result he needs to display the full image. The full image must be scaled down so that it can be displayed on the screen. Obviously, some details will not be shown on the display (here the observer does not need to see the details). When he is reasonably satisfied with his crea- tion he then displays the image onto the display device that the image was oripally targeted at (a device with a very high resolution). Another application is in simple pattern recogni- tion. In general, the process of recognition is an expen- sive operation. It is sometimes advantageous to reduce (scale down) the image to be processed and apply the recognition process on the small image. There may just be enough details in the small image to recognise some patterns. If more details is needed then use the srcinal image (we have a two-level pyramid). Now the algorithm for the scale operation. An image can be scaled horizontally by a factor H and vertically by a factor V about a specified point X, ). In general, when the image is scaled the boundaries of the scaled strips will not lie on pixel boundaries: the scaled image is aliased *. 3.1. Horizontal Scale The horizontal scale is straightforward because the strips after scaling will belong to the same blocks as the srcinal strips. So in order to scale an image horizon- tally, each transputer in the ring performs the steps that follow on its local strips. Transform the initial and the final x-coordinates of the strips. Digitise the x-coordinates of the scaled strips. Discard the strips with no lengths as well as those that are entirely outside the image space. Clip the strips to the image space. This is simple since the strips that are partially outside the image space can only have their initial x-coordinates at the left and/or their final xcoordinates at the right of the image space. 3.2. Vertical Scale It is more complicated to scale an image vertically. There are two problems. First, not only will the scaled strips not be in the correct blocks but aerent parts of a scaled strip might need to be placed in Werent blocks. Second, in general the strips after transforma- tion will not have unit thicknesses - thus the scaled strips will not be strips. The algorithm puts the scaled strips in the correct blocks (i.e. correct transputers) and if necessary divides those that overlap more than one block. It is assumed that each transputer has already transformed its strips; digitised the coordinates of the scaled strips; discarded those with no lengths or no thicknesses as we as those that are entirely outside the image space; clipped them *We are studying a mded version of the transputer network where antialiasing can be performed in parallel with the slightly modified) algorithm reported here, by using an additional ring of transputers. This will be re- ported in future if successful . .  H. R Arabnia et al. 1 Fart Operations on Digitised Images 7 second bird execution execution block2 blocti block, block4 block, block block, block2 to the image space.. The ‘scaled strips’ which result are referred to as ‘boxes’ for the remainder of this section. The steps (i), ii), (iii), (iv) which follow are per- formed B times by each transputer where B is the number of blocks. (i) Find the boxes that should be in the transputer allocated to block) - including those that par- tially overlap the block. Put these boxes in an area called ibuffer i for intermediate). For values of j at each execution of this step for individual trans- puters refer to the example shown in table 1. ii) Clip the boxes in ibuffer to block, space. iii) Merge the boxes in ibuffer into the boxes already in an area called boxbuffer (initially empty) in order of their y-coordinates so that the boxes in boxbuffer have increasing y-coordinates; ibuffer is now empty. This is to ensure that when the boxes are converted into strips (step (v) below) the strips will be generated in the correct order. (iv) Concurrently, output the contents of boxbuffer to the boxbuffer of the next transputer on the ring and input into the box&uffer the contents of boxbuffer of the previous transputer on the ring. Each transputer now holds in its boxbuffer the contents of boxbuffer of the previous transputer. To avoid deadlock and achieve concurrency boxbuffer is a double buffer. After B executions of the above steps, each transputer’s boxbuffer will hold only those boxes that belong to the block assigned to this transputer. (v) at this stage the contents of boxbuffer is part of the scaled image, made up of boxes, that is visible in the block to which this transputer is allocated. Convert these boxes to strips. There is no need for this conversion if V < 1, because the boxes will already have unit thicknesses. founh execution block, blockl block2 block, In order to understand the process order of the blocks in each transputer consider an image space made up of four blocks. In table 1 the process order of the blocks in each of the transputers is shown. Refer to figures 2 and 3 for block and for transputer identities. It is seen from table 1 that the first blocks to be considered by the transputers are their own blocks. At step (iv) the data for the boxes in boxbufer) from these blocks are sent one step round the ring: the next block to be considered is chosen to be the same as that for the data which has just arrived at the transputer from the ring. Accordingly, the data for each block is built up from its possible sources as the block data (in buxbufer) is moved round the ring. The example that follows dustrates the above algorithm. The subsection 3.2.1 gives detailed descrip tion of the more complex steps in the algorithm. Table 1. Process order of blocks in a ring of four tran- sputers Example The image shown in Egure 5(a) is to be scaled vertically by 3/2 about the ongin 0, . The image space is divided into four blocks, B = 4, and each block has two scanlines. It is assumed that each transputer has already transformed its strips, figure 5@); digitised the coordinates of the scaled strips, figure 5(c); discarded those that are entirely outside the image space; clipped them to the image space. The description which fol- lows traces the path of the data for the second block, but note that the strips on each block are computed concurrently. The transputer identities and the process order of the blocks are shown in figure 3 and table 1 respec- tively. TI has a, b, c, d; T2 has e, f, ; T3 has h; T4 has nothing in its local memory, figure 5(a). Refer to figure 5(c) to follow the steps below. T2 checks what overlaps block2 (step (i)). It finds e, J puts them in ibuffer. It clips the boxes in ibuffer to block, space (step (u)); ibufer still has e, f: Merge produces e, fin boxbufer (step G)); ibuffer is emptied. It outputs e, to TI step (iv)). TI receives e, f and puts them in its boxbuffer (step (iv)). It checks what overlaps block, (step (i)). It finds c, d; puts them in ibuffer. It clips the boxes in ibuffer to block2 space (step ii)); The clip process produces c2, d2 in ibuffer. Merge produces c2, d2, e, fin boxbufer (step ) ibuffer is emp- tied. It outputs c2, d,, e, f to T4 (step (iv)). T4 receives c2, d2, e, f and puts them in its boxbuffer (step (iv)). It checks what overlaps block, step (i)). It Ends nothing so steps ii) and iii) do nothing. It outputs c2, d2, e, f o T3 (step T3 receives c2. d2, e, f and puts them in its boxbuffer (step (iv)). It checks what overlaps block2 (step (i)). It finds nothing. Steps ii), ii) do nothing. It outputs c2, d2 e, f to T2 (step (iv)). (iv)).
Search
Tags
Related Search
We Need Your Support
Thank you for visiting our website and your interest in our free products and services. We are nonprofit website to share and download documents. To the running of this website, we need your help to support us.

Thanks to everyone for your continued support.

No, Thanks