{'fraction_non_alphanumeric': 0.027895752895752895, 'fraction_numerical': 0.008976833976833977, 'mean_word_length': 4.9511774842044805, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Split and Merge Based Quantitative Approach to Select Filter Combination for Image Segmentation

With the advent of image analysis and computation in different domains, image segmentation has emerged as the most crucial step to achieve a compact segment-based description of image scene by decomposing it into meaningful segments of similar attributes. The pre-and-post filtering operation reduces the effect of noise from the segmented image. The Cameraman image is pre-filtered using Laplacian, Median and Min filter. The Split and Merge method for Region based image segmentation which guarantees to connected regions are now applied on the filtered image. The Median, Laplacian and Sobel filter is then used to post-filter the segmented image. The PSNR and MSE values are calculated to quantitative evaluation of segmented images. The quantitative evaluation of post-filtered segmented image shows that median filter produces most effective result with lowest MSE of 84.89 dB and highest PSNR of 5.72 dB.


Introduction
To analyze or interpret an image automatically, preprocessing is done which involves segmenting the image into different objects of interest e.g. separation of foreground from the background [6]. Image segmentation has firmed its ground in many practical applications that involve a visual interpretation, namely in medical imaging, object detection (face detection, pedestrian detection, brake light detection etc. More accurate the segmentation, more successful is the recognition of objects in the image.
Basically, segmentation is the process of subdividing an image into its constituent regions or objects. Segmentation algorithms are based on either similarity or discontinuity of intensity/gray level values. A number of image segmentation algorithms with increased complexity have been developed over the years. All these algorithms work on the use of any of the three main criteria: the homogeneity within a segment, separation from adjacent segments and shape homogeneity. Typically, the segmentation algorithms can be grouped into three major categories on the basis of their segment formation properties, namely Threshold Based Segmentation [11,22], Boundary based Segmentation [9,16] and Region Based Segmentation [10].

Features of various segmentation techniques
Threshold based segmentation produces regions of uniformity within the given image based on some threshold criteria on the attributes of pixels [11].These algorithms are computationally less expensive but causes noise, blurred edges or outlier [8] in the image. Contrary to this, the boundary based techniques rely on edges found in an image and tries to locate points of discontinuities in images. This segmentation method is very sensitive to noise and hence post-processing is required. However, region based segmentation algorithms partition the entire image into sub regions depending on some homogeneity criteria [3,14].

Region Split and Merge Technique
The region split and merge technique falls under region based segmentation and is combination of top-down and bottom-up approach [4]. In this image is first split into homogeneous regions on the basis of homogeneity criteria. The regions formed after first split will be individually checked for the homogeneity and any two adjacent homogeneous regions will be merged into one region. The merging of homogeneous connected regions is a combination of two phases: first is to find the pair of adjacent homogeneous regions and second is to choose a certain merging criterion [2,4,10]. The algorithm halts when no further merging is possible. This technique produces large number of region boundaries, other than the horizontal and vertical ones [13]. But the algorithm of this approach leads to increase in computational speed [10] with lesser complexities and hence improves segmentation quality [4]. It also guarantees connected regions [9] i.e. there are no gaps due to missing edge pixels. Due to the inherent advantages of region based segmentation technique, the performance of image segmentation is elaborated in this paper using split and merges technique.

Methodology Adopted
To apply pre and post filter techniques in order to segment the image using split and merge technique and evaluate the performance of algorithm, the system architecture being followed is explained with the help of flowchart as given in fig. 1.  Pre-filtering is done to preserve and sharpen the edge information [5,15]. Spatial filters offer more versatility as they can be used for non-linear filtering applications as well [7]. The fundamental of filtering an image lies in its convolution with the mask of pre-defined filter [20]. Sharpening linear filters (laplacian, unsharp and laplacian of Gaussian filter) enhance the pixel neighbourhood in the image. Contrary to linear filters, nonlinear spatial filtering (median, max and min filters) is based on nonlinear operations with pixels encompassed by the filter [21].
Splitting is a recursive process. Quad tree decomposition method is exploited in the current work to split an image into four equal sized-quadrants and it depends upon a homogeneity criterion. The current work uses the attribute of intensity of pixels as the homogeneity criterion. The regions formed after first split will be individually checked for the homogeneity. The equation (1) denotes the homogeneity criteria for splitting and merging the image. This is interpreted as a region is split into four equal sub-regions or quad-regions if the value of Q comes out to be 'False'.
In equation (1), Q is called as predicate, m and σ are the mean (average intensity) and standard deviations of pixels in a quad-region, respectively, while 'a' and 'b' are constants whose values are set during experimentation. So the average intensity (m) of a particular region should be greater than 0 and below a certain threshold value. The experimentations in current work were done by taking various values of 'a' and 'b', but an appropriate homogeneity criterion was obtained by taking 'a' and 'b' as 5 and 200, respectively.

mogeneous Regions
The output of the splitting stage is multiple regions which may or may not be homogeneous depending on whether they fulfil the homogeneity criterion or not, respectively [12]. The non-homogeneous regions are further subject to splitting and the homogeneous regions are merged together. The homogeneity criterion based on average intensity as specified by equation (1) will be followed [2][3]. The new region so formed will be continuously merged with its adjacent regions until the homogeneity criterion will be satisfied.
To make the quad-tree structure based Split and Merge image segmentation capable of adapting to edges of objects in the image, spatial filters may be applied on the segmented image [3,5]. It not only removes noise but may also be helpful to smooth the arbitrary position and orientation of edges of image objects. Preservation of edges can also be done using linear filters like 'Sobel' which returns edges at those points where the gradient of image is maximum [9,19]. Other alternatives include Prewitts method, Roberts method and Laplacian of Gaussian etc.
The next step is to evaluate effectiveness of the segmentation methods by performing quality assessment through subjective evaluation as well as quantitative approaches [23]. The subjective evaluation is based on visual interpretation, the objective evaluation can be done using a number of widely-used quality metrics. A few of these metrics are: PSNR-the peak signal-to-noise ratio (dB), the mean square error (MSE) which is the squared norm of the difference between the original image and  [17,18].
The split and merge algorithm was implemented in MATLAB 7.12 and tested on standard 'cameraman' test image. At first, the image was filtered by applying different spatial filters. The parameters of filters like size, padding options were varied to obtain better results of filtering. Table 1 depicts the detail of filters along with parameter variations. A 3x3 Laplacian filter was applied on the original image and value of alpha was varied from 0 and 1 for fine tuning. Since the Laplacian is a derivative operator, it sharpens the image but drives the constant areas to zero. So the original image is added back to restore the graylevel [7]. The enhancement in edges of foreground (camera man) is clearly visible fig. 3(a). The performance of LOG (Laplacian of Gaussian filter) tends towards blurring the image as the standard deviation is lower below to 0.5. Variations in mask size were also made to analyse the filter. The result of filtering with LOG filter is shown in fig.3 (b). A Median filter offers excellent noise reduction capabilities with considerably less blurring ( fig. 3 (c)). The unsharp filter acts as sharpening operator and enhances edges via subtracting a smoothed version of an image from the original image ( fig. 4(a)). But it was observed that blurring was predominant with increase in filter size. Other spatial filters namely min and max filter were also applied on the test image in fig. 4 (b) and 4 (c) respectively. Best filtered image as listed in table 2 from each category has been selected for further processing.  Split and merge segmentation algorithm was applied on these selected filtered images. It is observed that image filtered with Min and Median filter provides an optimal segmentation as the foreground and background were    fig. 7. The quantitative evaluation shows the filtered output quality of Sobel filter is comparatively poor than Median with of PSNR (dB) of 5.65, and MSE (dB) of 85.03 in all case. Fig. 8 shows the post filtered images using Sobel filter. These two postfiltered images are interpreted visually.  However, it can be deduced from the quantitative analysis that in case of Median as post filter the mean square error is less as compared to other post filters and higher peak signal-to-noise ratio can also be obtained through it and specifically its combination with Laplacian and Min as pre-filters yield most effective. Further, performance of Sobel is also acceptable. It is worthwhile to mention that this combination is able to segment the objects in the image while preserving the edges i.e. edges remain connected, hence this combination also provides critically segmented cameraman image.