An Improved OTSU Algorithm Using Histogram Accumulation Moment for Ore Segmentation

: When using image processing technology to analyze mineral particle size in complex scenes, it is difﬁcult to separate the objects from the background with traditional algorithms. This paper proposes an ore image segmentation algorithm based on a histogram accumulation moment, which is applied to multi-scenario ore object location and recognition. Firstly, the multi-scale Retinex color restoration algorithm is used to improve the contrast in the dark region and eliminates the shadows generated by the stacked adhesion ores. Then, the zero-order and ﬁrst-order cumulative moments close to the selected gray level are calculated, reducing the error caused by noise. Finally, the selected gray level gradually approaches the optimal threshold to avoid falling into local optimum. It can segment mineral images with unimodal or insigniﬁcant bimodal characteristic histogram effectively and accurately. Ore images in three different scenarios are used to verify the accuracy and effectiveness of the proposed method. The experimental results demonstrate that the proposed algorithm provides better segmentation results than other methods.


Introduction
Mineral separation is the process of separating useful minerals from useless solid materials as much as possible to obtain the raw materials required for the smelting process [1].The crushing of minerals is an important part of mineral separation.The minerals are gradually made smaller by the multi-stage crusher.The quality of the crushing directly affects the technology of mineral separation and the granularity of the minerals is a significant indicator to measure the crushing process [2].Many studies have focused on the particle size detection of the mineral selection.Nowadays, most mineral factories in China detect the granularity by manual screening.The whole process is highly labor intensive and of poor efficiency and the results are susceptible to human mood.
In recent years, with the rapid development of artificial intelligence and pattern recognition technology, the method of detecting mineral particle size by machine vision has gradually increased [3,4].Researchers use image processing algorithms to segment minerals automatically [5,6].This not only avoids the error caused by manual screening but also reflects the result of the mineral granularity detection visually.The shape of the mineral can be described, and the mineral particle size measured with rich analytical data by extracting geometric characteristics of the particles.Image segmentation is one of the important steps in mineral particle size detection.The quality of image segmentation directly affects the result of particle size detection.According to the mineral collection environment, researchers use the specific segmentation algorithm to achieve particle recognition and localization under specific environment.Many articles have mentioned the method of image processing to segment mineral particles.For example, Wang et al. [7] used the modified marker watershed algorithm to segment copper particles.The grain surface area was estimated from perimeter analysis of sectioned particles and 3D volume grade was established.However, the copper particles were not compact and stacked and the segmentation algorithm did not involve particle adhesion.Cemal et al. [8] suggested a simple normalized color-based statistical segmentation algorithm for ore images.The objects are determined by the color components of the minerals, so the method is not suitable for ores containing only one mineral.Heydari et al. [9] employed watershed transform and morphological methods to estimate the size distribution of iron-ore green pellets.The shape of iron-ore targets is close to a circle and the collected images with large gap pixels are easy to segment.However, the method is not effective for irregular minerals in complex scenes.Zhang et al. [10] argued that the contrast of a coal pile image was improved by a combination of multiple filters and the double-threshold method was used to allocate the coal particles.Then, the particle size was calculated by extracting the perimeter.However, compared with the ore image, the surface of the coal pile is too smooth, so it is not proper for ore with large noise.
Since most segmentation methods set a specific detection environment, they are unsuitable for ores in complex scenes.OTSU [11] based on statistical measurement is a classic global threshold segmentation, having the advantages of speediness, stabilization and high universality [12,13].Hua et al. [14] obtained the aggregate size by using OTSU.Gajalakshmi et al. [15] advised that the grain boundaries of various metals were determined using OTSU and Canny edge detection techniques.Chi et al. [16] introduced a threshold selection method combined with OTSU to calculate the volume distribution of nanoparticles in brain parenchyma.Ahmed et al. [17] detected the cracks in concrete image using OTSU and multiple filtering.However, the OTSU method merely considers the gray-scale information.For an image with unimodal or inconspicuous bimodal histogram distribution, it tends to fall into local optimum and cannot effectively find the global optimal threshold.
In response to the mentioned problems, some scholars have proposed some improved OTSU algorithms.Malarvel et al. [18] offered an improved OTSU method for segmentation of weld defects on radiography images.Although the threshold value always lies at the left bottom side of the unimodal distribution, it is only suitable for images with a dull and large proportion background.Yuan et al. [19] suggested an improved OTSU method using the weighted object variance for defect detection.It cannot meet the requirement for ore images, as the noise is mixed with the target pixel.Azeroual et al. [20] presented a fast image edge detection based on the Faber Schauder Wavelet and OTSU.Harb et al. [21] put forward an improved image magnification algorithm based on OTSU thresholding.Zhang et al. [22] proposed a double-window OTSU algorithm to solve the problem of uneven gray distribution.Still, this method needs to select the window size according to the ore target.
The ore images have many noises and are prone to over-segmentation and under-segmentation because of the influence of the collection environment.The traditional OTSU algorithm is difficult to select an appropriate threshold accurately for unimodal or inconspicuous bimodal histogram distribution image.By analyzing the problems existing in OTSU and its improved methods, this paper proposes an improved OTSU algorithm for ore image segmentation based on histogram accumulation moments.The contributions of the proposed algorithm are summarized as follows: Ore images are very noisy and are prone to over-segmentation and under-segmentation due to the influence of the collection environment.It is difficult to select an appropriate threshold accurately for unimodal or inconspicuous bimodal histogram distribution image using the traditional OTSU algorithm.By analyzing the problems existing in OTSU and its improved methods, this paper proposes an improved OTSU algorithm for ore image segmentation based on histogram accumulation moments.The contributions of the proposed algorithm are summarized as follows: (1) The object contrast in dark areas is improved and the shadow from stacked and adhesive ores is eliminated by using the multi-scale Retinex color restoration algorithm; (2) An improved OTSU algorithm is proposed.It reduces the error caused by image background and noise by calculating the gray-level zero-order and first-order cumulative moments closed to the selected area.The selected gray level gradually approaches the optimal threshold to avoid falling into the local optimum.This algorithm can be used in the segmentation of mineral images with unimodal or insignificant bimodal properties; (3) The validity and accuracy of the proposed algorithm is verified from the qualitative and quantitative analysis in multi-scenario ore image segmentation.

Problems of OTSU for Ore Segmentation
As a global thresholding segmentation method, OTSU uses the variance of the gray level distribution to find the threshold and divides the image pixels into two categories: Object and background.The optimal threshold is chosen to maximize the between-class variance and the minimum within-class variance.The OTSU algorithm for extracting the global threshold is described as follows: (1) The probability and gray mean value of object and background The gray level of the image into two categories: Object and background.The object class probability is P O and the background class probability is P B .
where p i is the ratio of the number of pixels n i in the gray level i to the overall image, indicating the occurrence probability of gray levels i.
M O and M B represent the gray mean of the object and background class, respectively.
(2) The zero-order, first-order and second-order of cumulative moment The average gray of the entire image is M T .
From Equations ( 1)-( 8), have the following relationship for any t.
Each class of variance is defined by using the second-order cumulative moment of the gray histogram, which is expressed as the object class variance σ 2  O and the background class variance σ 2 B , respectively.
(3) The relationship of between-class variance, within-class and total-variance The variance between the object and background class is σ 2 between .
The within-class variance of two classes is σ 2 within .
The overall variance of the image is σ 2 total .
(4) The selection of optimal threshold After derivation, for the threshold t, the variance between the object and background class is recorded as σ 2 otsu (t).
Discriminant analysis is performed based on σ 2 otsu (t) to find the maximum gray level of σ 2 otsu (t) as the optimal threshold t * .
There is a jump in the gray value between the object and background and the variance can reflect the change of the object-background boundary.The OTSU method involves unsupervised selection of thresholds, automatic optimization through simple calculations and does not need parameter control.It can steadily and accurately segment images with bimodal characteristic gray histograms.
The ores are spread over the entire image and the non-ore parts account for a small proportion of the image.The original ore image is shown in Figure 1. Figure 1a-c  There are many ore objects in ore images.The surface of stones is smooth and strongly reflects light.The gray level of the ore object is mainly concentrated in the left half of the peak region, while the gray level in the right half and at both sides is either too dark or too bright, which represents the background and noise.The gray histogram of the image shows a unimodal state.Figure 2 shows the gray histogram distribution of Figure 1a and OTSU threshold.It is difficult to determine an obvious gray level to separate the object and background pixels since both of them are intermingled in the histogram distribution.Choosing the optimal threshold presents the following challenges: (1) The ore image is affected by uneven illumination, dust and mud coverage.The noise is serious, the target edge is blurred and the contrast between the object and background is low; (2) The mineral is scattered, bulky and stacked.Due to the crushing, the ore particles with sharp edges, angular corners and complex internal texture are stacked and adhered; (3) The object and the background pixels in the image are cross-aliased, mostly resulting in unimodal or inconspicuous bimodal gray histogram distribution.The OTSU algorithm is susceptible to image noise.When the target and background have basically the same area, the segmentation result is better.However, when the difference of both areas is large, and the gray histogram appears unimodal or inconspicuous bimodal, it is difficult to separate the object from the background effectively and accurately with OTSU.The threshold obtained by OTSU is liable to fall into the local optimum and the global threshold cannot be effectively found.Figure 3 shows the segmentation result of OTSU.There are many ore objects in ore images.The surface of stones is smooth and strongly reflects light.The gray level of the ore object is mainly concentrated in the left half of the peak region, while the gray level in the right half and at both sides is either too dark or too bright, which represents the background and noise.The gray histogram of the image shows a unimodal state.Figure 2 shows the gray histogram distribution of Figure 1a and OTSU threshold.There are many ore objects in ore images.The surface of stones is smooth and strongly reflects light.The gray level of the ore object is mainly concentrated in the left half of the peak region, while the gray level in the right half and at both sides is either too dark or too bright, which represents the background and noise.The gray histogram of the image shows a unimodal state.Figure 2 shows the gray histogram It is difficult to determine an obvious gray level to separate the object and background pixels since both of them are intermingled in the histogram distribution.Choosing the optimal threshold presents the following challenges: (1) The ore image is affected by uneven illumination, dust and mud coverage.The noise is serious, the target edge is blurred and the contrast between the object and background is low; (2) The mineral is scattered, bulky and stacked.Due to the crushing, the ore particles with sharp edges, angular corners and complex internal texture are stacked and adhered; (3) The object and the background pixels in the image are cross-aliased, mostly resulting in unimodal or inconspicuous bimodal gray histogram distribution.The OTSU algorithm is susceptible to image noise.When the target and background have basically the same area, the segmentation result is better.However, when the difference of both areas is large, and the gray histogram appears unimodal or inconspicuous bimodal, it is difficult to separate the object from the background effectively and accurately with OTSU.The threshold obtained by OTSU is liable to fall into the local optimum and the global threshold cannot be It is difficult to determine an obvious gray level to separate the object and background pixels since both of them are intermingled in the histogram distribution.Choosing the optimal threshold presents the following challenges: (1) The ore image is affected by uneven illumination, dust and mud coverage.The noise is serious, the target edge is blurred and the contrast between the object and background is low; (2) The mineral is scattered, bulky and stacked.Due to the crushing, the ore particles with sharp edges, angular corners and complex internal texture are stacked and adhered; (3) The object and the background pixels in the image are cross-aliased, mostly resulting in unimodal or inconspicuous bimodal gray histogram distribution.
The OTSU algorithm is susceptible to image noise.When the target and background have basically the same area, the segmentation result is better.However, when the difference of both areas is large, and the gray histogram appears unimodal or inconspicuous bimodal, it is difficult to separate the object from the background effectively and accurately with OTSU.The threshold obtained by OTSU is liable to fall into the local optimum and the global threshold cannot be effectively found.Figure 3 shows the segmentation result of OTSU.By analyzing the problems of existing threshold methods and the complexity of the mineral image itself, an improved OTSU algorithm is proposed for ore segmentation.It aims to realize the mineral identification and localization quickly, effectively and accurately for complex scenes.

Improved Ore Image Segmentation Algorithm
Ore images are affected by uneven illumination and include dust and slurry.The multi-scale Retinex color restoration algorithm is used to eliminate the influence of illumination.It can enhance the local color and dark details and truly reproduce the ore image in complex scenes.Our improved algorithm calculates the zero-order and first-order cumulative moments close to the object and background parts instead of analyzing the entire gray level distribution.Hence, it reduces the error caused by noise.The optimal threshold is selected to avoid falling into the local optimal, which is not only suitable for bimodal distribution histogram but also effective for segmenting ore images with a unimodal or nearly unimodal distribution.

Multiscale Retinex Color Restoration Algorithm
Factors such as collecting device and shooting environment bring many problems for the object recognition.To overcome the problems, image enhancement technology can highlight the gaps between the ore target and background, making the dark or occlusion area clearer.The traditional enhancement algorithm is mainly for gray images, which lead to lacking color information and losing the details of the original image.Conversely, color image enhancement makes the image colorful, detailed and vivid.
Land [23] proposed a color image enhancement method based on Retinex theory.The method can avoid the influence of illumination light and obtain the innovative appearance by object reflection.The image enhancement based on Retinex can enhance edges and remove over-exposures or under-exposures [24].It is appropriate for different types of images.The multiscale retinex color restoration algorithm [25] (MSRCR) adjusts the ratio between the three channels of the image based on single-scale and multi-scale Retinex.MSRCR emphasizes the dark region information and eliminates the problem of color image distortion.
The image ( , )  f x y can be expressed as the product of the incident and the reflected component.
( , )= ( , ) ( , ) f x y r x y l x y (18) where the object reflection component ( , ) r x y reflects the image high-frequency detail information and the incident component ( , ) l x y represents change slowly low-frequency part in image.
The logarithm is taken on both sides.Then the incident component ( , ) l x y is removed, indicating the influence of illumination is evaded.The reflection component ( , ) r x y is obtained to achieve image enhancement effect.By analyzing the problems of existing threshold methods and the complexity of the mineral image itself, an improved OTSU algorithm is proposed for ore segmentation.It aims to realize the mineral identification and localization quickly, effectively and accurately for complex scenes.

Improved Ore Image Segmentation Algorithm
Ore images are affected by uneven illumination and include dust and slurry.The multi-scale Retinex color restoration algorithm is used to eliminate the influence of illumination.It can enhance the local color and dark details and truly reproduce the ore image in complex scenes.Our improved algorithm calculates the zero-order and first-order cumulative moments close to the object and background parts instead of analyzing the entire gray level distribution.Hence, it reduces the error caused by noise.The optimal threshold is selected to avoid falling into the local optimal, which is not only suitable for bimodal distribution histogram but also effective for segmenting ore images with a unimodal or nearly unimodal distribution.

Multiscale Retinex Color Restoration Algorithm
Factors such as collecting device and shooting environment bring many problems for the object recognition.To overcome the problems, image enhancement technology can highlight the gaps between the ore target and background, making the dark or occlusion area clearer.The traditional enhancement algorithm is mainly for gray images, which lead to lacking color information and losing the details of the original image.Conversely, color image enhancement makes the image colorful, detailed and vivid.
Land [23] proposed a color image enhancement method based on Retinex theory.The method can avoid the influence of illumination light and obtain the innovative appearance by object reflection.The image enhancement based on Retinex can enhance edges and remove over-exposures or under-exposures [24].It is appropriate for different types of images.The multiscale retinex color restoration algorithm [25] (MSRCR) adjusts the ratio between the three channels of the image based on single-scale and multi-scale Retinex.MSRCR emphasizes the dark region information and eliminates the problem of color image distortion.
The image f (x, y) can be expressed as the product of the incident and the reflected component.
where the object reflection component r(x, y) reflects the image high-frequency detail information and the incident component l(x, y) represents change slowly low-frequency part in image.
The logarithm is taken on both sides.Then the incident component l(x, y) is removed, indicating the influence of illumination is evaded.The reflection component r(x, y) is obtained to achieve image enhancement effect.log Since the Gaussian filter can smooth the image while suppressing noise, it is usually used to estimate the incident component.Taking the green channel image f g (x, y) for example, f g (x, y) is filtered by a Gaussian convolution function G(x, y, σ) to obtain a flat incident component estimate log( lg ).
The smoothness log( lg ) is subtracted from the original channel image, removing the influence of the incident component.The faster-changing part is obtained, which is the remaining single channel image detail R g (x, y).
The original image has R, G and B three channels.The scale factor k and the weighting factor are added for adjusting the three channels.The filtering at different scales eliminates the illumination effect on image color.The weighting and summing operations enhance the local color and detail of the image.Then the green channel image detail R msr g (x, y) at multiple scales is obtained.
where M is the number of scales and w k is the weight at the k-th scale.Different scales make the ratio of the restored RGB channels different from the original image, which changes the color of the local area and causes the color distortion of the image.The three-channel color ratio relationship is adjusted by introducing a color recovery factor to reduce the effect of color distortion.R msrcr g (x, y) is the restored green channel image detail.R msrcr g (x, y) =R msr g (x, y)C g (x, y) where C g (x, y) is the recovery factor of the green channel to adjust the proportion of three channel.It is generally expressed as where c is the color correction constant, typically 125.By adjusting the ratio between the three channels, the MSRCR algorithm highlights the object edge information of the dark area, removes the influence of the light and reestablishes the real scene to a high degree.The image enhancement result based on the MSRCR algorithm is shown in Figure 4 below.
Where c is the color correction constant, typically 125.By adjusting the ratio between the three channels, the MSRCR algorithm highlights the object edge information of the dark area, removes the influence of the light and reestablishes the real scene to a high degree.The image enhancement result based on the MSRCR algorithm is shown in Figure 4 below.

Improved OTSU Segmentation Based on Histogram Accumulation Moment
The MSRCR enhances the edge information of the dark region and removes the influence of uneven illumination.An improved OTSU segmentation algorithm based on histogram accumulation moment (HCM_OTSU) is proposed.The ore object is separated from the background.Then the targets are extracted from the ore image at complex scenes.
The specific steps of the HCM_OTSU segmentation algorithm are as follows.

The Selection of Random Gray Value
The ore image after MSRCR is recorded as f msrcr (x, y).The gray level is {0, 1, • • • , l − 1} and the gray value g is randomly selected from the gray levels as the reference threshold.Then, the whole gray levels are divided into two parts {0, 1, • • • , g} and {g + 1, g + 2, • • • , l − 1}.The gray level probability distributions at different gray value g are distinctive.

Improvement of Zero-Order and First-Order Cumulative Moments
The traditional OTSU method calculates the cumulative moment over the entire gray level.The selection of the threshold is susceptible to non-effective pixels, resulting in incomplete segmentation or over-segmentation.The improved zero-order and first-order cumulative moments are used to calculate the partial gray-scale pixels.It can suppress the disturbance caused by noise and reduce the error produced by irrelevant pixels, which is convenient for finding the optimal threshold.
(1) Calculation of cumulative moment at gray level {0, That is, the 0th order cumulative moment of [0, h o −1] is subtracted from that of the gray level range [0, g]: where, the range of That is, the first-order cumulative moment of [0, h o −1] is subtracted from that of [0, g]: where, the range of (2) Calculation of cumulative moment at gray level {g That is, the 0th order cumulative moment of [0, h b −1] is subtracted from that of the gray level range [0, l − 1]: where, the range of For each gray level h b in {g + 1, g + 2, • • • , l − 1}, the average gray level from h b to the gray value l − 1 is calculated and the first order cumulative moment That is, the first-order cumulative moment of [0, h b −1] is subtracted from that of [0, l − 1]: where, the range of

Selection of Optimal Threshold
For the reference threshold g, the whole image is divided into two categories, in which the object class set is recorded as {0,  The variances of the object and the background are compared separately.The gray levels of the variance maximum are found by using discrimination the analysis, which are respectively recorded as t o and t b .
Determining whether the mean value of t o and t b is equal to the reference threshold g.If they are equal, making g as the optimal threshold t HCM_OTSU .Otherwise, returning into Section 3.2.1 and continuing to select the appropriate random threshold.The selected threshold is avoided falling into the local optimum.

Image Binarization
The average of t o and t b is chosen as the optimal threshold t HCM_OTSU for each pixel p.The larger pixels are considered as ore targets, while the smaller pixels are used as background.f b msrcr (x, y) represents the generated binary image."1" in the Formula (38) represents the ore object pixels and "0" is the background pixels.

Experimental Results and Analysis
The Jiaojia and Sanshandao gold ores were selected as research objects.An industrial camera was installed vertically above the conveyor belt of the crushing plant and symmetric light sources were placed on both sides.Three kinds of ore images (coarse, middle and fine) were selected as the test images.The objects were segmented from the background pixels by the HCM_OTSU segmentation algorithm.
Part of the experimental results is shown in Figure 5. Columns 1, 4 and 7 of Figure 5 are the original ore images ground by three kinds of crushers, columns 2, 5 and 8 of Figure 5

.4. Image Binarization
The average of o t and b t is chosen as the optimal threshold _ HCM OTSU t for each pixel p .The larger pixels are considered as ore targets, while the smaller pixels are used as background.

Experimental Results and Analysis
The Jiaojia and Sanshandao gold ores were selected as research objects.An industrial camera was installed vertically above the conveyor belt of the crushing plant and symmetric light sources were placed on both sides.Three kinds of ore images (coarse, middle and fine) were selected as the  The proposed HCM_OTSU segmentation algorithm is compared with the traditional ore segmentation methods such as OTSU and double-window OTSU.The subjective and objective results are analyzed, respectively.The proposed HCM_OTSU segmentation algorithm is compared with the traditional ore segmentation methods such as OTSU and double-window OTSU.The subjective and objective results are analyzed, respectively.

Qualitative Analysis
Three different types of ore images are used to test the segmentation results and the subjective performance of the HCM_OTSU algorithm is evaluated by comparison with other segmentation methods.The segmentation result is shown in the figure below.
Figure 6a shows the coarse crushing ore image.The large size, rough surface and sharp edges of the particles are the majority, while small irregular ores is a minority.A few mineral is covered by mud and the overall image is dull due to insufficient light.Figure 6a shows the coarse crushing ore image.The large size, rough surface and sharp edges of the particles are the majority, while small irregular ores is a minority.A few mineral is covered by mud and the overall image is dull due to insufficient light.
Figure 6b displays the middle crushing ore image.The difference of overall size is not large, and the stone particles are round and full.The exposure in the middle of the image is too high.
Figure 6c is the fine ore image.The image is unevenly illuminated and the whole image is mixed with powdery particles.
After the contrast of the image is enhanced by MSRCR algorithm, the objects are segmented using different threshold algorithms.
Figure 6d to Figure 6f are OTSU segmentation results for coarse, middle and fine ore images, respectively.
Figure 6g to Figure 6i are double-window OTSU results for these three ore images, respectively.Figure 6j to Figure 6l  The three algorithms of OTSU, double-window OTSU and HCM_OTSU are compared and analyzed as follows: The first column is comparison result of the three algorithms for coarse ores.Figure 6d is the mineral object result segmented by the OTSU methods.It is difficult to divide the large-sized ore completely because of being susceptible to internal texture and sharp angular.
Figure 6g is the result segmented by the double-window OTSU.From the result, large area of Figure 6b displays the middle crushing ore image.The difference of overall size is not large, and the stone particles are round and full.The exposure in the middle of the image is too high.
Figure 6c is the fine ore image.The image is unevenly illuminated and the whole image is mixed with powdery particles.
After the contrast of the image is enhanced by MSRCR algorithm, the objects are segmented using different threshold algorithms.
Figure 6d-f are OTSU segmentation results for coarse, middle and fine ore images, respectively.Figure 6g-i are double-window OTSU results for these three ore images, respectively.Figure 6j-l are the HCM_OTSU segmentation results.
The three algorithms of OTSU, double-window OTSU and HCM_OTSU are compared and analyzed as follows: The first column is comparison result of the three algorithms for coarse ores.Figure 6d is the mineral object result segmented by the OTSU methods.It is difficult to divide the large-sized ore completely because of being susceptible to internal texture and sharp angular.
Figure 6g is the result segmented by the double-window OTSU.From the result, large area of noise appears inside ore profile.It cannot adaptively select the threshold because we need to select the window size by practical experience.
Figure 6j shows the result of the HCM_OTSU.The overall mineral object is clear and the noise of object interior is less.We can realistically segment the ore object.
The second column is the comparison result of the three algorithms for middle minerals.Figure 6e is the result of OTSU.Under the influence of exposure, the objects in the four corners of ore image are submerged in the background.The object is lost, and some boundaries are incomplete.Figure 6h is the result of the double-window OTSU.Most object outlines are clear but there are a lot of voids inside the target.So, the segmentation is incomplete.Figure 6k is the result of the HCM_OTSU algorithm.The overall ore particle is distinct although the boundary of individual is adhesive and incomplete.
The third group is the comparison result of the three algorithms for fine minerals.Figure 6f is the result of OTSU.Affected by uneven illumination, large part of target is submerged in the background.Most mineral objects have serious "sticky" phenomenon.Figure 6i is the result of the double-window OTSU threshold algorithm.The threshold is selected in a small window and the object contours are better preserved.But the "internal holes" noise is serious.Figure 6l is the HCM_OTSU result.It retains the object boundaries and fills the internal holes although a few mineral edges are stuck.
The ore particles are transferred by different conveyor belts and crushed at all levels.The surface of the minerals is rough, and the boundaries are distinct.At the same time, the images of the minerals are photographed in severe environment.So, the traditional threshold method is difficult to segment effectively and accurately.An OTSU segmentation algorithm based on histogram accumulation moment is proposed.It can not only effectively separate ore images with unimodal or insignificant bimodal gray histogram but also have a high noise immunity by improving the 0th order and 1st order cumulative moment of the histogram, not depending on the gray level pixels of the whole image, only considering the effective pixels, selecting the optimal threshold step by step.

Quantitative Analysis
In order to further verify the effectiveness of the proposed method, we compare the results of the HCM_OTSU algorithm with manually drawn by experts.Various analysis indicators are used to evaluate the threshold segmentation performance: mis-segmentation rate, detection rate of ore object and false alarm detection.The mis-segmentation rate is divided into the false negative rate and the false positive rate.The false negative rate reflects that the target pixel is erroneously judged as the background pixel, while the false positive rate represents the background pixel is wrongly divided into the object pixel.
The false negative rate is referred to as Fnr.It represents the result of the algorithm is subtracted from the experts and the ratio of the number of missing pixels to the total number of pixels is obtained.
where the experts result GT represents as a theoretical segmentation reference, MT is the algorithm segmentation result as the actual segmentation and NT is the number of pixels appearing in the actual segmentation but not including in the expert reference image.
The false positive rate is Fpr.It counts the number of extra pixels appearing in the algorithm but not in the reference image.Then, the ratio of the number of extra pixels to the total number of pixels is calculated.
The smaller Fnr and Fpr, the better the segmentation and the closer the segmentation algorithm is to the ideal effect.Table 1 shows the false negative rate and the false positive rate of the three methods for different crushing ore images.Compared with the results of OTSU and double-window OTSU algorithm, the Fnr of HCM_OTSU algorithm are greatly reduced by 0.244 and 0.371 and Fpr are reduced by 0.049 and 0.055, respectively.The false negative rate and false positive rate of the proposed algorithm are the smallest, which means that it achieves the balance between the preserving object boundary and the removing noise.Our method is better for segmenting coarse ore images.
Compared with the other two methods, the Fnr of our proposed algorithm is decreasing in terms of middle ore image, which is reduced by 0.303 and 0.306, respectively.Although the Fpr of our method is 0.145 smaller than OTSU, it is increased by 0.012 compared with double-window OTSU.It indicates that the internal noise is eliminated but a few target boundaries are incomplete.Our method can divide middle ore image well.
The Fnr of our method is reduced by 0.302 and 0.078 and the Fpr is dropped by 0.045 and 0.157 in the fine ore, respectively.The false negative rate and false positive rate of the proposed algorithm are the smallest but there are over-segmentation and under-segmentation to some extent.Our method can roughly segment the fine particle size and the mis-segmentation can be reduced by some subsequent process.
Detection rate and false alarm rate are commonly used in pattern recognition and are widely applied in ore object detection.The related definitions are as follows: Detection rate DR is the correctly identified number of ore target samples.
where N c is the number of ore samples correctly detected and N t is the total number of ore samples.The false alarm rate FAR is the ratio of being wrongly detected as ore objects in the total number of non-ore targets.where N e is the number of non-ore samples detected as ore and N b is the total number of non-ore samples.
Table 2 shows the detection rate and false alarm detection rate of three algorithms for different crushed ore images.It can be seen that the detection rate of the proposed algorithm is 89.6% for the ore objects, which is 34.5% and 29.3% higher than OTSU and double-window OTSU, respectively.The false alarm detection rate is 17.4%, which is 19.5% and 45.8% lower than OTSU and double-window OTSU.Therefore, the proposed algorithm has high detection rate and low false detection rate.The OTSU has the lowest detection rate, which is due to the fact that the threshold selection is biased towards the larger between-class variance.The double-window OTSU has a higher detection rate, while the highest false detection rate.It is because background and dusts are detected as mineral objects mistakenly.
The proposed algorithm is better than the other two methods, which is due to the fact that the threshold only considers pixels closed to the object or background.It can reduce random noise, avoid falling into local optimum and be suitable for mineral images with unimodal or insignificant bimodal.The proposed algorithm can effectively segment the mineral images under different scenarios, meeting the requirement of the visual system for particle size detection.
Our method exhibits high detection rate and low false detection rate in mineral particle size detection.In general, the proposed algorithm can separate object from background pixels accurately and effectively at complex scenes.

Conclusions
An OTSU segmentation algorithm based on the histogram accumulation moment, namely HCM_OTSU, is proposed for ore location and detection in complex scenes.The multi-scale Retinex color restoration algorithm is used to improve the contrast of the target in the dark area and eliminate the shadows generated by the accumulated adhesion ore.The zero-order and first-order accumulation moments close to the selected gray level are calculated, reducing the error caused by image background and noise.The gray level gradually approaches the optimal threshold to avoid falling into local optimum.This algorithm can be used in the segmentation of mineral images with unimodal or insignificant bimodal characteristics.Compared with traditional methods, the proposed algorithm achieves better segmentation results in ore object detection.Additionally, the proposed method is simple and easy to operate and can be applied to real-time ore particle size detection in complex scenes.Future work will focus on the more efficient and accurate edge extraction of ore particle sizes.

Figure 1 .
Figure 1.Images of the original ore.(a), (b) and (c) are crushing ore in Jiaojia gold mine.

Figure 2 .
Figure 2. The gray histogram of ore image and OTSU threshold.

Figure 1 .
Figure 1.Images of the original ore.(a-c) are crushing ore in Jiaojia gold mine.

Figure 1 .
Figure 1.Images of the original ore.(a), (b) and (c) are crushing ore in Jiaojia gold mine.

Figure 2 .
Figure 2. The gray histogram of ore image and OTSU threshold.

Figure 2 .
Figure 2. The gray histogram of ore image and OTSU threshold.

Figure 3 .
Figure 3.The segmentation result of OTSU.

Figure 3 .
Figure 3.The segmentation result of OTSU.

Figure 4 .
Figure 4.The image enhancement based on MSRCR.Figure 4. The image enhancement based on MSRCR.

Figure 4 .
Figure 4.The image enhancement based on MSRCR.Figure 4. The image enhancement based on MSRCR.
are enhanced results processed by MSRCR and columns 3, 6 and 9 of Figure 5 are the results of the HCM_OTSU algorithm segmentation.
the generated binary image.ʺ1ʺ in the formula (38) represents the ore object pixels and ʺ0ʺ is the background pixels.
test images.The objects were segmented from the background pixels by the HCM_OTSU segmentation algorithm.Part of the experimental results is shown in Figure 5. Columns 1, 4 and 7 of Figure 5 are the original ore images ground by three kinds of crushers, columns 2, 5 and 8 of Figure 5 are enhanced results processed by MSRCR and columns 3, 6 and 9 of Figure 5 are the results of the HCM_OTSU algorithm segmentation.

Figure 5 .
Figure 5.The image enhancement based on MSRCR.Partial results of the proposed algorithm.

Figure 5 .
Figure 5.The image enhancement based on MSRCR.Partial results of the proposed algorithm.

Figure 6 .
Figure6ashows the coarse crushing ore image.The large size, rough surface and sharp edges of the particles are the majority, while small irregular ores is a minority.A few mineral is covered by mud and the overall image is dull due to insufficient light.Figure6bdisplays the middle crushing ore image.The difference of overall size is not large, and the stone particles are round and full.The exposure in the middle of the image is too high.Figure6cis the fine ore image.The image is unevenly illuminated and the whole image is mixed with powdery particles.After the contrast of the image is enhanced by MSRCR algorithm, the objects are segmented using different threshold algorithms.Figure6dto Figure6fare OTSU segmentation results for coarse, middle and fine ore images, respectively.Figure6gto Figure6iare double-window OTSU results for these three ore images, respectively.Figure6jto Figure6lare the HCM_OTSU segmentation results.

Figure 6 .
Figure 6.The comparison of ore segmentation result.(a) is coarse ore; (b) is middle ore; (c) is fine ore; (d-f) are OTSU results for (a-c); (g-i) are double-window OTSU results for (a-c); (j-l) are the HCM_OTSU results for (a-c).
1, • • • , g} For each gray level h o in {0, 1, • • • , g}, the occurrence probability from h o to the random gray value g is calculated.The histogram zero-order cumulative moment of gray level {h o For each gray level h o in {0, 1, • • • , g}, the average gray level from h o to the random gray value g is calculated and the first order cumulative moment µ 0 1, • • • , g} and the background class set is {g + 1, g + 2, • • • , l − 1}.Each gray level is taken from the two categories.The object gray level is h o ∈ [0, g] and background gray level is h b ∈ [g + 1, l − 1].The variances are respectively recorded as σ 2 o (h o ) and σ 2 b (h b ).

Table 1 .
The false negative rate and the false positive rate of the three methods.

Table 2 .
The detection rate and false alarm detection rate of three algorithms.