Memory Organization for Image Segmentation Based on Region Growing

A solution is proposed for determining and organizing the size of the FIFO-stack in memory, required for load the coordinates of adjoining pixels in an image segmentation algorithm based on region growing. The FIFO-stack, organized on the idea of a ring multi-bit shift register, is considered, and the expression of memory calculations is performed through storing process in parallel registers. The conditions for maximum loading of the memory stack are formulated, for which an expression is obtained that allowing to accurately determining the required size of the FIFO-stack, which provides memory resources savings. ___________________________________________________________


INTRODUCTION
Memory allocation is one of the main problems of organizing data processing in computer systems.This problem is particularly related for systems on a chip with a limited size of RAM [1][2][3][4].Insufficient memory allocation can lead to data loss and system malfunction.Excessive memory allocation leads to its inefficient use.Despite the lack of a universal approach to memory allocation, the exact values of its necessary capacity for specific algorithms under extreme conditions can be obtained.For avoiding limitation of memory resources, researchers developing an methods of image compression [5], while it's possible to reduce required memory by image pre-processing techniques.Among image pre-processing algorithms, segmentation algorithms are the most demanding of RAM capacity [6][7][8][9].Segmentation result leads to the separation of an image into areas with the same or similar properties.The simplest segmentation algorithms are based on region growing in the surrounding area of the previously selected initial growth pixels and use stacks to store the coordinates of adjacent pixels attached to the grown region [10 -12].Stacks can be organized according to the FIFO principle (first in -first out) or LIFO (last infirst out) [13,17].They differ in the order of data sampling and, accordingly, in the memory capacity required to store the coordinates of pixels at maximum load.These applications of image processing and analyzing widely used in medical applications [19][20][21], remote sensing [22] and aerial images, which requiring high memory resources [14,16].Many of presented methods of image segmentation refers to allocating of segments and their characteristics, such as edges, size and borders of segments in homogenous regions, regardless an important calculation factor of memory resources [23][24][25].
The aim of this work is to deriving an expression, which allows calculating the size of the FIFO stack, required for storing the coordinates of adjoining pixels depending on the image size for the segmentation algorithm based on region growing.The formatter will need to create these components, incorporating the applicable criteria that follow.
The structure of this paper as follows: Section 2, describes formulation of the problem; section 3, shows the derivation an expression that determining the calculation of memory; section 4 present the evaluation of memory savings for the exact calculation of the size of FIFO-stack.Section 5 concludes the conclusion.

FORMULATION OF THE PROBLEM
As a result of image segmentation On Fig. 1 showing the fragment of the halftone image, the matrix of values of pixels corresponding to it and the segmentation matrix containing six segments are given.Algorithm of region growing [15 -18] describes the following sequence of operations in image segmentation, assuming that the initial pixels of growth in the image are already allocated [8,16]: 1) Coordinates of the next initial pixel of growth placed in FIFO stacks coordinates of adjacent pixels, where This expression does not take into account the fact that the filling of the stacks of coordinates is accompanied by the selection of data from them, in consequence of which the inequality is always satisfied F P Y X  .Thus, it is necessary to accurately determine the size

Derivation an expression to accurately determine the size of the FIFO-stack of adjacent pixels coordinates
Let the size of the square image 2 Y pixels contains a single area of the same size.The work of the FIFO-stack in the process of segmentation of such an area can be divided into cycles.Within each cycle, from the FIFO-stack, all the coordinates of the pixels that were there at the beginning of the cycle are unloaded, performed their processing and loading the coordinates of pixels adjacent to the treated.
The number of coordinates are loaded into the FIFO-stack in each cycle depends on the position of the initial growth pixel (edge or center of the region).If the initial growth pixel is in the center of the square region, then in each cycle the number of elements in the FIFO stack increases by 8 (Fig. 3,a).Then the number of coordinates to be loaded If the initial growth pixel is in the corner of a square region, then in each cycle the number of coordinates in the FIFO-stack increases by 2 (Fig. 3,b).
Then the number of coordinates to be loaded into the FIFO-stack in the last   Y  .Thus, when the region is segmented with the position of the initial growth pixel in its center, a larger capacity of stack is required (approximately 2 times) than in the case when the initial growth pixel is located in the corner of the region, and in an arbitrary location on the border of the region (Fig. 3, c).
To calculate the capacity of the stack, it is necessary to take into account the order of sampling the values of adjacent pixels.Surroundings corner of pixel (Fig. 4, a) may contain to 5-th unprocessed adjacent pixels, and the neighborhood of the other (non-corner) pixels -up to three pixels (Fig. 4, b).This means that when sampling the coordinates of a corner pixel from the FIFO stack, up to 5 coordinates of adjacent pixels may return to their place and the number of coordinates in the FIFO-stack will increases by 4, and when sampling the coordinates of a non-corner pixel from the FIFO-stack, up to three coordinates of adjacent pixels may return to their place and the number of coordinates in the FIFO-stack will increase by 2. In this case, the segmentation of the square region with the initial growth pixel in the center of this region, the largest number of coordinates in the FIFO stack is formed.If during the processing of the neighborhood of the region, the adjacent pixels are selected not in order but with an interval of two pixels (Fig. 4, c) and sample begins with 4-angular pixels.Unloading from the FIFO-stack, the coordinates of 4 angular pixels of the grown region leads to the return to the FIFO-stack of coordinates of 16 adjacent pixels.Unloading from the FIFO stack, the coordinates of non-corner pixels with an interval of two pixels in k-cycle (total   YY  (Fig. 5).Unloading from the FIFO-stack the coordinates of the remaining non-angled pixels does not load the new coordinates into the stack (the coordinates of all adjacent pixels are already on the stack) and the number of coordinates in the FIFO-stack decreases.Thus, the expression (2) can be used to determine the required size F P FIFO-stack, when YX  and Y, X -an odd.

Evaluation of memory savings for the exact calculation of the size of FIFO-stack
In Fig. 6 shows the size dependence F P of FIFO-stack (memory cells), defined approximately  The saving E M of memory when accurate calculation of the required capacity for FIFO-stack by expression (2) in comparison with the approximate calculation of the expression (1) determined using the relation Eq. ( 3) Under the condition YX  and Y, X -an odd.
From the expression (3) and Fig. 6 it follows, that the memory savings for the exact calculation of the required capacity of the FIFO-stack increases with increasing image size and it is 36,8 and 374,3 times when the image size 100 100  and 1000 1000  pixels respectively.

Conclusion
An expression is obtained that allows to organize accurately the required size of the FIFO-stack in memory, required for storing the coordinates of adjacent pixels depending on the image size through a segmentation process based on region growing algorithm.The FIFO-stack, in memory organized on the idea of a ring multi-bit shift register.Upon obtaining of suggested expression, the condition of the maximum load of stack are accepted, when: a) a segmentation of a square region is performed with an initial of growth pixel in the center of this region.;b) during the processing for the surroundings of the region, adjacent pixels are not selected in order, but at interval of two pixels; c) sample begins with 4-th corner pixels.Using the proposed expression to calculate the required capacity of the FIFOstack reduces the number of memory cells in 36,8 and 374,3 times when the image size 100 100  and 1000 1000  pixels respectively.

Fp
-pointer of stacks;

F 3 )
Implementing the processing cycle of FIFO-stacks F Y and F X , in which coordinates are retrieved   , yx of next processed pixel; corresponding element of the segmentation matrix   , s y x assigned value S n number of segment; checks satisfying the condition of joining the current pixel   , yx adjacent pixels with coordinates   , y y x x   when

FEp
, formed by the input counter CT2.According slice signal "Load" value FE p input counter CT2 increasing by one according to the expression   mod 1F FE P FEpp  .When unloading from the FIFO stack, the "Unload" signal is generated, on the front of which at the stack output, the value of pixel is set from the output of the current cell of the shift register, determined by the pointer value FB p , generated by the output counter CT2.According slice signal "Unload" value FB p output of counter CT2 increasing by one according to the expression  .FIFO-stack is empty, when FE p = FB p .When initialized FIFO-stack input and output binary counters are reset by the «Reset» signal.

Fig. 2 - 1 S
Fig. 2-Structure FIFO-stacks and with coordinates of adjacent pixels

FFX 1 SN
coordinates of adjacent pixels when the image size YX  pixels, presence of one segment on it    , the size of which  

3 -FX
Distribution of the pixels of the segmented square region by the processing cycles of FIFO-stacks F Y and at different positions of the initial pixel growth: a -in the center of region; b -In corner of the region; c -on border of the region

Fig. 4 -
Fig. 4-Distribution of pixels of a segmented region: a -in the neighborhood of the angular pixel; b -in the neighborhood of a non-angular pixel; c -when sampled with interval of two pixels Thus, by the end of the cycle, the number of coordinates in the FIFO stack will increase by 8 compared with the previous cycle, but at the beginning of the cycle, the difference in the number of coordinates in the FIFO-stack between adjacent cycles can reach 16+   8 3 1 y    when sampling adjacent pixels with interval of two pixels, starting with corner pixels.In this case, in the last loop, when the size of the segmented area coincides with the image size, the number of coordinates in the FIFO-stack reaches the maximum value that determines the required size F P of FIFO-stack (number of cells), calculated using an expression by Eq. (2):   16 8 3 1

Fig. 5 -
Fig. 5-The pixel distribution of the segmented rectangular area by the processing cycles of FIFO-stacks YF and XF at the location of the initial of growth pixel in the center of the regionThe following cycles occurs unloading of FIFO-stack coordinates with non-corner pixels of the interval of two pixels (by   2 3 1 Y      pixels in each cycle) and loading into FIFO-stack coordinates     4 3 1 Y      -of adjacent pixels.
expression (2), for the size YX of image (pixels).

Fig. 6 -
Fig. 6-Dependence of FIFO stack size on image size