**1. Introduction**

Mineral identification occupies an important position in geological research. Traditional geological mineral identification methods mainly identify minerals by the naked eye or observation instruments. Naked-eye identification heavily relies on the discriminatory ability of the identifier. Observations through instruments, such as the identification of clay minerals and hydrocarbons by using near-infrared spectroscopy [1], and mineral identification and mineral mapping by imaging spectroscopy [2], require special identification instruments. Both methods are labor intensive and their accuracy is often influenced by the experience and ability level of the identifier. In recent years, researchers have used deep learning techniques to reduce these effects, for example, Porwal et al. [3] used artificial neural networks in mineral potential mapping, and Li et al. [4] used convolutional neural networks based on geological big data for mineral prospect prediction. In mineral identification, many works also use intelligent algorithms, and these methods can be classified into three categories according to the test method and the type of data obtained: identification based on chemical composition analysis; identification based on spectral analysis; and identification based on optical pictures. The main types of data involved in identification methods based on chemical composition analysis [5] are energy scattering spectroscopy (EDS) [6], electron probe (EPMA) [7], and laser-induced breakdown spectroscopy (LIBS) [8]. The identification method [9] based on spectral analysis is the most reliable method for mineral identification, but it requires expensive testing instruments and is therefore difficult to be widely promoted. The optical picture-based identification method is the most common identification method, which can be performed by microscopic

**Citation:** Zhang , J.; Gao, Q.; Luo, H.; Long, T. Mineral Identification Based on Deep Learning Using Image Luminance Equalization. *Appl. Sci.* **2022**, *12*, 7055. https://doi.org/ 10.3390/app12147055

Academic Editor: Andrés Márquez

Received: 13 June 2022 Accepted: 10 July 2022 Published: 13 July 2022

**Publisher's Note:** MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

**Copyright:** © 2022 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https:// creativecommons.org/licenses/by/ 4.0/).

<sup>1</sup> School of Information Engineering, China University of Geosciences, Beijing 100083, China; 1004196122@cugb.edu.cn (J.Z.); gaoqi1024@cugb.edu.cn (Q.G.); 15779733478@139.com (H.L.)

images [10–15] and ordinary photographs [16–18]. As shown in Table 1, we summarized the different current mineral identification methods.

All of the above studies enable the identification of minerals, but usually only for a small number of species of minerals, and also lack stable and excellent identification accuracy. In addition, one difficulty in using photo-based mineral identification is that mineral photos in the field are often affected by light intensity as well as shadows, resulting in photos with different photometric details, which can easily lead to errors in identification. For example, the same mineral may be pictured in two colors with strong and weak light intensity, and color is one of the important features used for mineral identification. Therefore, it is difficult to achieve high accuracy with a direct identification of photos taken with cell phones or cameras. Studies using image enhancement techniques to eliminate the effects of extraneous factors on photographs have emerged and demonstrated utility in many other applications. For example, Zhi et al. [19] investigated a new method to improve the change detection accuracy of synthetic aperture radar (SAR) remote sensing images by combining image enhancement algorithms based on wavelet and spatial domains and power law. In addition, regarding the effect of luminance, Xiao et al. [20] relied on Retinex theory and used a two-step approach combining candidate regions and object locations to achieve object recognition in low luminance situations. Xiong et al. [21] achieved the identification of ripe litchi under different lighting conditions based on Retinex image enhancement and improved the accuracy of image identification. In more detail, we compare the accuracy of mineral identification approaches based on image type later on, as shown in Section 4.3.


**Table 1.** Comparison of different mineral identification methods.

There are many models for object detection, such as EfficientDet [22] and YOLOv5. YOLOv5 (as shown in Section 3) extends from YOLOv4 [23], which is one of the most effective object detection models available. Yolov5 has been used in many practical applications such as face recognition [24] and aircraft target detection [25].

In this paper, we combine image enhancement techniques with YOLOv5 for mineral detection to address the effects of illumination factors on image chromatic aberrations. With this method, we achieved the accurate identification of mineral images without relying on specialized instruments for obtaining identification data. In addition, our method enables the more accurate identification of samples with poor lighting conditions (too bright or too dark) than other efforts to identify minerals based on image data. Moreover, our work expands the range of mineral species that can be identified to a greater extent than other works. Our detailed contributions are shown below.

• We first propose a novel image enhancement algorithm, one which combines histogram equalization (HE) and the Laplace algorithm. In subsequent experiments, the algorithm shows powerful results.


The content of this paper is shown as follows. We introduce a novel image enhancement approach in Section 2, combining histogram equalization (HE) and the Laplace algorithm. In Section 3, we focus on the structure of the model we use and briefly describe the training environment and process. In Section 4, we show the results of our experiments and compare them with other methods, in addition to evaluating the model effectiveness using objective evaluation metrics. In Section 5, we conclude the article and propose future work.

#### **2. The Proposed Method**

#### *2.1. Histogram Equalization*

Histogram equalization [26] is an important method for the statistical analysis of the image grayscale distribution and is useful for images where both the background and foreground are too bright or too dark. This method enables more detail in overexposed or underexposed [27] photographs. The traditional histogram equalization method uses the cumulative distribution function of the probability of each gray level of the image as the transformation function, and according to this transformation relationship, an image with uniformly distributed gray probability density can be obtained. Its cumulative distribution function can be expressed as:

$$s\_k = T(r\_k) = \sum\_{j=0}^k \frac{n\_j}{n} = \sum\_{j=0}^k p\_r(r\_j) \quad , \quad 0 \le r\_j \le 1, \quad k = 0, 1, \cdots, L-1 \tag{1}$$

where *rj* is the normalized gray level before the transformation, *T*(*rk*) is the transformation function, *sk* is the normalized gray level after the transformation, *nj* is the number of pixels with the *k*-th gray level in the original image, *n* is the total number of pixels in the image, and *pr*(*rj*) is the probability of taking the *k*-th gray level in the image before the transformation. However, due to its unselective data processing, it may increase the contrast of background noise and decrease the contrast of useful signals. In addition, the gray level of the transformed image is reduced and some details may be lost. Some images, such as histograms with peaks, are processed to show the unnatural over-enhancement of contrast.

#### *2.2. Laplace Operator Image Enhancement*

The Laplace operator [28] image enhancement is widely used in image processing as a second-order differential algorithm commonly used in the field of digital image processing. It causes the gray contrast to be enhanced, thus making the blurred image sharper. The essence of image blurring is that the image is subject to averaging or integration operations, so the image can be inverse operated. For example, differential operations can highlight image details and make the image sharper. Since Laplace is a differential operator, its application enhances the areas of sudden gray changes in the image and attenuates the areas of slow gray changes. Therefore, the Laplace operator can be selected to sharpen the original image to produce an image describing the abrupt grayscale changes, and then the sharpened image is produced by superimposing the Laplace image with the original image. The basic method of Laplace sharpening can be represented by the following equation.

$$L(\mathbf{x}, y) = \begin{cases} \
f(\mathbf{x}, y) - \nabla^2 f(\mathbf{x}, y)\_\prime t \lesssim 0 \\ 
f(\mathbf{x}, y) + \nabla^2 f(\mathbf{x}, y)\_\prime t > 0 \end{cases} \tag{2}$$

where *<sup>f</sup>*(*x*, *<sup>y</sup>*) denotes the two-dimensional image, <sup>∇</sup><sup>2</sup> *<sup>f</sup>*(*x*, *<sup>y</sup>*) denotes its Laplace operator, and *t* is the neighborhood center comparison coefficient. This simple sharpening method produces the effect of a Laplace sharpening process while preserving the background

information. By superimposing the original image to the processing result of the Laplace transform, we can preserve each gray value in the image so that the contrast at the gray abrupt change is enhanced. The final outcome is to bring out small details in the image while preserving the image background. However, this tends to produce a double response to image edges, which will affect the experimental results.

#### *2.3. A New Algorithm Based on HELaplace*

In order to overcome the shortcomings of the aforementioned classical histogram and Laplace algorithms, and considering the characteristics of using image fusion, this paper proposes a new algorithm for image enhancement by HELaplace. In this paper, we combine the idea of image fusion by first processing the images with histogram equalization algorithm and Laplace operator, respectively, and then fusing the processed images into a new image after weighting the average by a certain proportion. This approach demonstrates a good enhancement effect within a certain percentage range.

We convert the input image *G* into YCrCb (a kind of color coding method) [29] space, and then separate the YCrCb image channels and equalize the image histogram using the CLAHE [30] algorithm, which can improve the details of the image while avoiding the problem of the excessive contrast enhancement of the image. The processed channel and the unprocessed channel are combined and then converted to RGB image *A*. The image is then sharpened and enhanced using the 8-neighborhood Laplace operator with center 5 and image convolution, and the enhanced image is noted as *B*. The weighted average image fusion algorithm can be expressed as:

$$F(i,j) = \lambda A(i,j) + (1-\lambda)B(i,j) \tag{3}$$

where the input image *A*(*i*, *j*) represents the illumination function of the image after HE algorithm processing, *B*(*i*, *j*) represents the illumination function of the image after Laplace processing, and the output image *F*(*i*, *j*) represents the fused image. The size of the image is 256 × 256 pixels, *i* and *j* are the coordinates of a pixel in the image, and *i*, *j* ∈ [256, 256], *A*, *B* ∈ [0, 255].

The algorithm description of HELaplace is shown in Algorithm 1. We apply the HELaplace algorithm to the same image and the result is shown in Figure 1. By comparison, we can see that the image is better after the HELaplace algorithm.


**Figure 1.** (**a**) Original image; (**b**) image processed by HE; (**c**) image processed by Laplace; and (**d**) image processed by HELaplace.
