1 Introduction

Image segmentation, an indispensable stage of digital image processing, plays an important role in further image recognition, analysis and understanding for the meaningful edges, regions, textures and other image features. Generally used image segmentation methods are mainly based on the threshold value [9, 27], edge detection [12, 17, 34], region growing [6, 31], specific theory [13, 26, 35] and other texture characteristic values [2]. Based on the theory that fractal is a typical segmentation method, and has been widely applied in such areas as industrial image detection [19, 30], environmental image monitoring [24], medical image analysis [14], and etc.

In the process of image segmentation, the common chronic problems encountered are under-segmentation and over-segmentation. Under different motivation and input image characteristics, various image segmentation methods have been proposed or improved to resolve their image segmentation problems in different applications [1, 15, 32]. Although there have been developed a lot of edge detection, region segmentation, and other specific theory based methods, there is no image segmentation method that is effective for varieties of images, especially images with lots of irregular objects. Therefore, further studies on such images are still being deepened. Fractal theory, which concept was originally proposed by Mandelbrot [3], provides a new method to express nonlinear image information. The fractal dimension is an important parameter of fractal geometry, which is a new measure of irregular contours. Pentland firstly used the fractal method to segment the actual scene image, and found that there has a clear correspondence between the image and the actual scene [23]. Guo et al. further used the fractal method to segment abrasive particles in the oil image [8]. Despite the images with irregular contours can be segmented by the fractal theory based method, it has difficulties in accurately segmenting images with different shapes of abrasives.

Morphological reconstruction method, which aims at describing the image feature, is acknowledged as a promising approach. The method uses a set of independent operations, concepts and the mathematical algorithm to reshape the objects of interest in order to improve the object accuracy, which is one of the most important methods for improving quality. Wu et al. proposed an improved image segmentation method based on morphological reconstruction, and obtained more accurate results in segmentation of forth images than traditional watershed methods [29]. Morphological reconstruction works well if there are catchment basins that have satisfactory catchment basins in different sizes for all features. If not, over-segmentation or under-segmentation occurs when the catchment basins are not satisfactory. In other words, the approach needs a priori knowledge to obtain the suitable catchment basins. Therefore, obtaining good results becomes difficult when the image includes a complicated background.

To overcome the problems of irregular shapes and complicated background in images, some previous methods used the contiguous matches and the multi-fractal method [33, 36]. The concept of these methods can be summarized as enhancing the availability of the shape features of objects by transforming these features that are unsuitable in their original condition. However, there is still a certain degree of under-segmentation besides some incomplete edges. It is acknowledged that bit-plane images are widely used in information hiding, information compression, etc. [18, 20], and they are also used in segmenting images [4]. Since the bit plane at different levels contains different information, using proper bit-plane information can help to improve the segmentation accuracy through reconstructing the detail features of the images. We think this method is quite important because it enables the segmentation accuracy to be carried out in the feature space. This method is discussed in more detail in section 2.

In order to solve the problems of irregular objects under a complicated background, this paper improves the segmentation algorithm based on the bit-plane and morphological reconstruction, using bit-plane and mathematical morphology operation to accurately identify object edges, and effectively perfect the under-segmentation phenomenon of the traditional fractal method, thus to improve the accuracy of image segmentation. In Section 2, related work is reviewed briefly. We propose an improved method and introduce the bit-plane and morphological reconstruction in Section 3. Section 4 shows the simulation experiments and the analysis of the method is conducted, and a brief summary of the present work is concluded in Section 5.

2 Related work

In recent years, several image segmentation methods have been developed to solve the segmentation problems of under-segmentation or over-segmentation when facing the images with irregular objects in a complicated background. Images with irregular objects in a complicated background usually have the following characteristics: 1) complex textures in the background and plenty of high frequency information; 2) no obvious threshold characteristic due to the very close grayscale between the objects and the background; and 3) the irregularity and uncertainty of object shapes.

Miao et al. use the fractal theory to segment CBN images captured by an optical video microscope, points out that the key procedure is to establish the relationship of the fractal dimension and the complicated topography change of the CBN grains [19]. Due to the complicated CBN images, the images used in segmentation are three-dimensional (3D) images, and the fractal dimension of the abrasive wear topography calculated is based on the protrusion height of the abrasives. It is known that the 3D images are often used to reconstruct the wheel topography through the method of image mosaic coupled detection, which is very time-consuming job due to the huge information in 3D images during image processing [5, 11]. In order to reduce the processing time, two-dimensional (2D) images were accordingly studied. An earlier study conducted on abrasive images was conducted by Huang et al. [10]. The morphological method was used in abrasive image segmentation. As the big color difference between the abrasives and the background, the abrasive image can be readily detected by the adaptive threshold method. Wu et al. proposed an approach based on quadratic gray-level histogram connected components labeling to segment the object abrasive from the image [28]. Although the abrasive contour can be segmented, some background boundaries are still hard to remove. Then, Lin et al. use a multiple algorithm of snake model and mathematical morphology to segment the global and local contours of abrasive images, and pointed out that the contours of abrasives are hard to accurately segment due to the complexity of background in images [16].

As abrasive images often include the complexity of background besides the irregularity of abrasive shapes, it is easy to cause over-segmentation. For the features of abrasive images with complex background are much closer to the natural scene, Song et al. use fractal dimension to identify the wear abrasives [25]. The fractal dimension was calculated based on the methods of Exact, Faena and Fast, respectively. Based on the results, it is found that the fractal dimension of abrasive contours helps distinguish the difference among the different shapes of abrasives. Aiming at the problem of ferrography image segmentation, an image segmentation algorithm was proposed based on combining Gabor transform and fractal features in order to make full use of the fractal characteristics [7]. Then, using the fuzzy C means clustering method to achieve image segmentation. The method proposed in [7] is able to distinguish the background area difference in gray level and segment the images.

Based on previous studies on image segmentation, it can be found that most images are segmented directly based on the threshold value, edge detection, region growing, specific theory and other texture characteristic values besides subsequent morphological processing, which is shown in Fig. 1a. Therefore, the segmentation result is directly restricted by the segmentation method itself. If over-segmentation or under-segmentation occurs, the results can be hardly improved. When processing images with irregular objects under a complex background, the problems of over-segmentation and under-segmentation are difficult to avoid.

Fig. 1
figure 1

Completion process of (a) the previous method and (b) the proposed method. Most previous methods are used to complete image segmentation directly based on the threshold value, edge detection, specific theory, etc., while the proposed method is used to complete that based on bit-plane and morphological reconstruction in order to solve problems of over-segmentation and under-segmentation

We propose a new method for such images in order to solve problems of over-segmentation and under-segmentation, which is shown in Fig. 1b. During the segmentation process, the segmentation results are regarded as the coarse segmented results. Then, the coarse segmented results are improved based on the bit-plane and morphological reconstruction, which main role is to fix the missing features and eliminate the invalid features, and finally the fine segmented results can be obtained.

3 Improved abrasive image segmentation method

Our proposed method consists of two steps: using a fractal dimension method to obtain the coarse segmented results, and then reconstructing the coarse segmented results based on bit-plane and morphological reconstruction to obtain the fine segmented results. In this section, we first introduce the blanket fractal dimension method in Section 3.1 and then describe the reconstruction method in Section 3.2.

3.1 Blanket fractal dimension

The fractal dimension is usually used in image processing. Generally, the more complex the texture features, the bigger the fractal dimension and surface roughness, and there are more noise points in images. The fractal dimension can be calculated by the methods of box dimension algorithm, ε-blanket algorithm, fractal brown and random algorithm (FBR), etc. [13, 21]. For abrasives, three-dimensional structures with certain shapes and sizes in space, have the height distribution, an acquired abrasive image usually has similar information in the gray distribution. Therefore, the ε-blanket algorithm is much suitable for such images. An abrasive image f(x, y) can be regarded as hills with similar height proportional to their gray values [22]. The main idea of the algorithm of calculating the fractal dimension of a one-dimensional set of points is to employ area of the image as a global measure. The area is computed based on blanket constructed around the original image surface through successive iterations of thickening of the blanket. The upper surface, Uε(x, y), and the lower surface, Bε(x, y), of the blanket in εth iteration, respectively, can be given as

$$ {U}_{\varepsilon}\left(x,y\right)=\max \left\{{u}_{\varepsilon -1}\left(x,y\right)+1,\underset{s_1\left(x,y\right)}{\max }{u}_{\varepsilon -1}\left(x,y\right)\right\} $$
(1)
$$ {B}_{\varepsilon}\left(x,y\right)=\min \left\{{B}_{\varepsilon -1}\left(x,y\right)-1,\underset{s_1\left(x,y\right)}{\min }{B}_{\varepsilon -1}\left(x,y\right)\right\} $$
(2)
$$ {U}_0\left(x,y\right)={B}_0\left(x,y\right)=f\left(x,y\right) $$
(3)

In the formulae, S1(x, y), represents 3 × 3 pixel neighborhood and f(x, y) denotes the pixel intensity. The term of addition or subtraction of 1 ensures thickening of the blanket in every iteration. The blanket volume, Vε(x, y), and the blanket area, Aε(x, y), can be calculated as a sum of differences, which can be written as

$$ {V}_{\varepsilon}\left(x,y\right)=\sum \limits_{\left(x,y\right)}\left\{{U}_{\varepsilon}\left(x,y\right)-{B}_{\varepsilon}\left(x,y\right)\right\} $$
(4)
$$ {A}_{\varepsilon}\left(x,y\right)=\frac{V_{\varepsilon}\left(x,y\right)-{V}_{\varepsilon -1}\left(x,y\right)}{2} $$
(5)

Considering the gliding window of the fixed size, a series of the blanket areas, A (ε), can be calculated based on Eq. (5), and the fractal dimension D can be obtained as

$$ \log A\left(\upvarepsilon \right)=\left(2-D\right)\mathrm{log}\upvarepsilon +\log K $$
(6)

One of the biggest problems of the image segmentation method based on fractal dimension is causing under-segmentation due to irregular objects in the complex background. Figure 2 shows an abrasive image and its segmentation result directly using the fractal dimension method. It should be mentioned that the original image comes from the database which is made up of abrasive images taken by the experiments, which details can be found in Section 4.1. Based on Fig. 2, it can be observed that there is a serious problem of under-segmentation. Although the segmented results have been improved based on morphological processing, the edges of segmented abrasives are still incomplete.

Fig. 2
figure 2

Illustrations of (a) the original abrasive image and (b) segmented results based on the fractal dimension method. Abrasive sizes, shapes and colors are inhomogeneous in the image besides the rich background textures. These features pose a challenge to the image segmentation

The segmentation results have seriously under-segmentation, the edges of abrasives are incomplete. In order to solve the problem, we propose bit-plane and morphological reconstruction to improve the segmented results, which role is to fix the missing features. In Section 3.2, we describe how this method works.

3.2 Improved abrasive image segmentation method based on bit-plane and morphological reconstruction

3.2.1 Bit-plane

For a given 8-bit grayscale image, I(x, y), each pixel of the image under the same bit can form a binary image according to the gray value of the pixel, and the binary image usually called as the bit-plane image. Therefore, we can obtain eight bit-plane images through decomposing all pixels of the image under 8-bit. The bit-plane image, b(x, y), can be described as

$$ I\left(x,y\right)=\sum \limits_{i=1}^8{b}_i\left(x,y\right)\times {2}^{i-1} $$
(7)
$$ {b}_i\left(x,y\right)\in \left[0,1\right]\kern0.5em i=1,2,...,8. $$
(8)

Generally, the characteristics of bit-plane image become more complex when the bit changes from a low value to a high value. Random textures of the image gradually decrease, and the outline of the original image gradually becomes clearer from the approximate random noise.

Figure 3 shows the bit-plane results of the abrasive image, it can be observed that random textures of the images are basically in the low bit-planes such as b1, b2, b3, and b4, the abrasive features are mainly embedded in the high bit-planes such as b5, b6, b7, and b8, especially the bit-planes of b6 and b7. Moreover, it can be also observed that the edges or regions of abrasives in the high bit-planes are obvious, although there is much noise in the background. Therefore, the obvious edges and regions could be further used in abrasive contour reconstruction.

Fig. 3
figure 3

Bit-plane images under individual bit through decomposing all pixels of the abrasive image

3.2.2 Morphological processing

Morphological processing is a very useful method for representation and description of object shape. There are four basic operations in grayscale mathematical morphology, which including erosion operation, dilation operation, opening operation and closing operation. Assuming A and B are the sets in Z2 according to the reference [6], the four operations are described as follows.

  • Erosion operation The erosion of A by B, denoted AB, is the set of all points z such that, translated by z, is contained in A. The erosion operation can be defined as

$$ A\odot B=\left\{z|{(B)}_z\subseteq A\right\} $$
(9)

For B has to be contained in A is equivalent to B not sharing any common elements with the background, its equivalent equation can be expressed as

$$ A\odot B=\left\{z|{(B)}_z\cap {A}^c=\varPhi \right\} $$
(10)

where Ac is the complement of A and Φ is the empty set.

  • Dilation operation The dilation of A by B, denoted AB, is the set of all displacements, z, such that B and A overlap by at least one element. The dilation operation can be defined as

$$ A\oplus B=\left\{z|{\left(\widehat{B}\right)}_z\cap A\ne \varPhi \right\} $$
(11)

Or

$$ A\oplus B=\left\{z|{\left(\widehat{B}\right)}_z\cap A\subseteq A\right\} $$
(12)

where \( \widehat{B} \) is simply the set of points in B whose (x, y) coordinates have been replaced by (−x, −y), and it can be defined as

$$ \widehat{B}=\left\{w|w=-b,b\in B\right\} $$
(13)
  • Opening operation The opening of the set A by structuring element B, denoted AB, is the erosion of A by B, followed by a dilation of the results by B. The opening operation can be expressed as

$$ A\circ B=\left(A\odot B\right)\oplus B $$
(14)

In other words, the opening of A by B is obtained by taking the union of all translates of B that fit into A. Therefore, its equivalent equation is

$$ A\circ B=\cup \left\{{(B)}_z|{(B)}_z\subseteq A\right\} $$
(15)
  • Closing operation The closing of the set A by structuring element B, denoted AB, is simply the dilation of A by B, followed by an erosion of the results by B. The closing operation can be expressed as

$$ A\cdot B=\left(A\oplus B\right)\odot B $$
(16)

3.2.3 Object reconstruction

The improved image segmentation method based on bit-plane and morphological reconstruction will properly apply the bit-plane results to search correct edges of abrasive according to the results of the blanket fractal dimension. During the reconstruction process, morphological process will apply erosion, dilation, opening and closing operations to reshape the edges of abrasives. Based on the idea, the whole reconstruction process, which consists of four steps, can be expressed as follows

  1. Step 1

    Inversing Bit-plane

    Inversing the binary bit-planes so that abrasives are changed into interesting objects. Taken a binary image, for example, the inversed image is G(x, y) = 1 − b(x, y). Here, b(x, y) is the binary image of the bit-plane.

  2. Step 2

    Establishing and marking the connected regions of bit-plane

    According to the results of different bit-plane results shown in Fig. 3, it can be observed that the most important abrasive features are in the bit-plane of b7, but it has much noise of background. Therefore, the morphological processing method is applied in order to obtain clear connected regions through reducing background noise based on erosion, dilation, opening and closing operations, and the result is recorded as G'(x, y), which is shown in Fig. 4a. In order to use the results based on the marked connected regions, we define \( {G}_i^{\hbox{'}}\left(x,y\right) \) referring to the characteristics of the ith connected region in the bit-plane.

  3. Step 3

    Coarse segmentation of abrasive image

    Using the traditional blanket fractal dimension method to segment the abrasive image, which is shown in Fig. 2b. Although the segmentation results are under-segmentation, it can be used to determine the position of abrasives besides most abrasive edges and a little invalid edges are involved. Therefore, the segmented results, defined as H(x, y), are used as the coarse segmented results of the abrasive image.

  4. Step 4

    Reconstructing abrasive edges

    Taken the ith connected region into account, the abrasive edges of Hi(x, y) are analyzed through comparing the results of \( {G}_i^{\hbox{'}}\left(x,y\right) \) with Hi(x, y) in the same region. If Hi(x, y) are involved in \( {G}_i^{\hbox{'}}\left(x,y\right) \), recording the abrasive edges of Hi(x, y) in the ith connected region. Otherwise, recording the abrasive edges of \( {G}_i^{\hbox{'}}\left(x,y\right) \). Based on the recording results, the abrasive edges in the ith region can be obtained as \( {H}_i^{\prime}\left(x,y\right) \). The results of \( {H}_i^{\prime}\left(x,y\right) \) in the ith region can be expressed as

Fig. 4
figure 4

Illustrations of (a) the results of the connected regions based on bit-plane and (b) the reconstruction results of abrasive edges based on bit-plane and morphological reconstruction. The connected regions include the characteristics of abrasive regions and noisy regions. The reconstruction results have clear abrasive edges through eliminating the small noise caused by background and perfecting the abrasive edges based on bit-plane and morphological reconstruction

$$ {H}_i^{\prime}\left(x,y\right)=\Big\{{\displaystyle \begin{array}{ll}{H}_i\left(x,y\right)& {H}_i\left(x,y\right)\in {G}_i^{\prime}\left(x,y\right)\\ {}{G}_i^{\prime}\left(x,y\right)& \mathrm{Otherwise}\end{array}} $$
(17)

Finally, the whole results of the abrasive image based on the bit-plane and morphological reconstruction can be recorded as

$$ {H}^{\prime}\left(x,y\right)=\sum \limits_{i=1}^N{H}_i^{\prime}\left(x,y\right) $$
(18)

where N is the total number of connected regions.

For the Coarse segmented results have a little noise shown in Fig. 2b, and it is hard to eliminate the noise due to the serious incomplete abrasive edges. Despite the incompleteness of the abrasive edges has been greatly improved, the noise problem still exists. Therefore, we further apply the morphological processing method to eliminate the noise besides forming a complete abrasive contour.

Figure 4b shows the reconstruction results of abrasive edges based on the bit-plane and morphological reconstruction. Compared the results with those based on the blanket fractal dimension shown in Fig. 2b, it can be found that the abrasive edges are more complete and less noisy, which indicates the significant effect of the proposed method.

To better present the segmentation effect obtained by the proposed method in the present work, the segmented results obtained by the blanket fractal dimension method and the proposed method are shown in Fig. 5.

Fig. 5
figure 5

Comparison of (a) the segmented results based on the traditional fractal method and (b) the segmented results based on the proposed method. Abrasive edges are seriously incomplete besides a little invalid edges when using the fractal method, while abrasive edges are much complete and little invalid edges when using the proposed method

It can be observed from Fig. 5 that the segmented results obtained by using the proposed method are much better than those obtained directly through using the traditional blanket fractal dimension method. The abrasive edges segmented by using the proposed method are much clear and complete.

4 Simulation and analysis

4.1 Segmenting experiments

An application field of abrasive segmentation is to determine the number of abrasive particles based on abrasive images acquired by a computer microscope system, which can be used to evaluate the characteristics of abrasive numbers, shapes, sizes and distribution. Therefore, accurately segmenting abrasive images is a key stage for the subsequent analysis of the digital images. Taken the under-segmentation of abrasive images into account, the proposed method is applied to segment abrasive images. In view of the fact that there is no public database of abrasive images at present, we carried out an abrasive image microphotography experiment to establish a sample database for abrasive image analysis. In the experiment, a video microscopy system Hirox KH-1000 was used to acquire abrasive images of brazed diamond tools. The magnification of the microscopic system ranges from 50× to 1000×. The diameter of the diamond abrasives embedded in the tools is about 40 μm. Based on the experimental platform, the sample database was finally established, which consists of about one hundred and twenty abrasive images. In the segmenting experiments, we choose a number of abrasive images randomly from the sample database taking into account of the abrasive numbers in images, the number of abrasive particles ranges from dozens to hundreds.

Simulation experiments were conducted on the Matlab 2014 software and the proposed algorithm was written in Matlab language, on which hardware platform is an associative workstation equipped with 64 bits WINDOWS 7 ULTIMATE EDITION operation system, i7 2.4 GHz dual core processor and 8 GB 1066 MHz running memory.

Generally, abrasive images are much different from each other, and there is no gold standard for abrasive image segmentation. In the present work, we use the artificial observation method to statistically count the number of abrasives in the test images, which method is often used in engineering detection. In order to reduce the error, five workers are employed to count the abrasive number, and the average number of abrasive particles is regarded as the standard value. Therefore, we judge the segmentation accuracy by comparing the results with the artificial results. Moreover, the recall rate of abrasive particles is used as the index of accuracy.

4.2 Results and discussion

To illustrate the segmentation effect of the proposed method, the segmentation results based on the traditional fractal dimension method and the quadratic histogram method [28] are also presented. Figure 6 shows the different results of abrasive numbers detected based on the three methods besides the artificial results.

Fig. 6
figure 6

Comparison of the number of abrasive particles in images with different segmentation methods

It is can be seen from Fig. 6 that all the results of abrasive numbers detected based on the different methods are basically lower than those counted based on the artificial method, this phenomenon further indicates the obvious influence of the complex background in images, and it is easy to cause under-segmentation in the image segmentation process. Based on the results, it is found that the abrasive numbers detected based on the proposed method are the closest to those counted based on the artificial method. Comparing with the results based on other two methods, it is found that the worst results are detected by the quadratic histogram method. From the aspect of abrasive numbers, the order of the three methods from more accurate to less accurate is the proposed method, the fractal method and the quadratic histogram method.

In order to quantitatively express the segmentation accuracy, the recall rate of abrasive particles caused by the three methods is also investigated, and the result of the recall rate is shown in Fig. 7.

Fig. 7
figure 7

Comparison of the recall rate of abrasive particles in images with different segmentation methods

Based on the results of the recall rate shown in Fig. 7, it can be seen that the recall rate generated by the proposed method is higher than that generated by the fractal method and the quadratic histogram method, which indicates that the proposed method can segment abrasive images more accurately. The average recall rate is about 92% when using the proposed method to segment abrasive images, which shows a fairly high robustness. Moreover, it can also can be observed from Figs. 6 and 7 that the number of abrasive particles in the abrasive image has an obvious influence on the recall rate. When the number of abrasive particles is probably less than 40, the recall rate increases with the increasing number of abrasive particles in the images. When the number of abrasive particles is probably more than 40, the changes of recall rate become relatively stable, which is due to the better fractal effect when more abrasive particles in images. Based on the experimental results, it can be concluded that the proposed method is validated to segment abrasive images under a complicated background.

5 Conclusion

The present work proposes a segmentation algorithm to improve the image segmentation effect based on bit-plane and morphological reconstruction, which is suitable for segmenting abrasive images with irregular shapes and different sizes of abrasive particles under a complex background. The coarse segmented results are firstly obtained through using the blanket factual dimension method. Then, the fine segmented results can be obtained through reconstructing the coarse segmented results based on bit-plane and morphology. The experimental results show that the incomplete edges of abrasive particles under the complex background can be perfected whether the sizes of abrasives are large or small. When the number of abrasive particles is probably more than 40, better segmentation accuracy can be achieved for the better fractal characteristics presented by the abrasive images. It is very satisfactory to apply the blanket fractal dimension method for abrasive images when taking into account bit-plane and morphological reconstruction.