Introduction

In opposition to traditional RGB imaging and machine vision, spectral imaging techniques allow seeing far beyond what our eyes can. Indeed, the underlying concept is to utilize spectroscopy techniques to associate a spectral response to a given spatial point. This allows access to more information regarding a given sample depending on the utilized technique. For example, Laser-induced breakdown spectroscopy imaging enables the visualization of the atomic species distribution at the sample surface, whereas Raman imaging allows inference of its molecular content. Yet, as with RGB imaging, the richness of real-world scenarios may be challenging to recreate due to the limitations of the imaging technique.

To put into perspective the specific limitations of each spectroscopy technique and how they may influence the final result, one can focus on the spectral imaging techniques previously referred to as practical examples, LIBS and Raman Imaging. LIBS is based on the analysis of discrete emission lines observed during laser-induced plasma decay and may be utilized to assess the presence of elements at the sample surface by comparing the obtained peaks with a reference database. Scanning the sample surface in a point-wise manner, this technique can be converted into a microscopic spectral imaging approach by scanning the sample surface and combining it with appropriate numerical algorithms for signal processing and advanced analysis1,2. LIBS imaging potential resides in the ability to detect several chemical elements in a wide range of concentrations, along with a high sensitivity, spatial resolution, and versatility1. Yet, LIBS also has its limitations. For example, non-specific signals related to continuous emission in earlier stages of plasma decay may often hide smaller spectral signatures in non-gated methodologies1. Saturation or self-absorption effects are also common to occur in larger plasma volumes or concentrations3. Moreover, both operating conditions (e.g. humidity, equipment alignment, and laser variation)4, line interference, and sample heterogeneity (e.g. surface roughness, and chemical matrix)5 may strongly affect the intensity of the signal in nonlinear manners. Combined, all these factors affect the linear response range of the technique, meaning that maintaining a linear relation between the recorded intensity and chemical element concentration is a very challenging task, especially in samples of varying matrix or heterogeneity.

Looking at the second example, Raman imaging presents a relatable scenario. Raman spectroscopy is a non-contact and non-destructive technique based on the detection of photons that have been inelastically scattered due to interactions with molecular vibrations. Thus, Raman imaging may allow the identification of distinct molecular compositions with a high spatial resolution by scanning the sample surface in a point-wise or line-scan manner and applying convenient signal processing6. Unfortunately, typical signals are of ultra-low intensities, often requiring integration times that may hinder the quality of the acquired signal in terms of signal-to-noise ratio (SNR). Adding to that, non-specific fluorescence is also a common problem of Raman spectroscopy and presents itself as one of the major drawbacks of this technique as it may lead to the saturation of a wide spectral region.In this context, maintaining an ideal signal-to-noise ratio across the whole sample surface is a challenge of uttermost relevance. Finally, Raman imaging can face experimental challenges such as sample damage from heating or photobleaching.

Making a connection between these problems with the limitations of RGB imaging, one also encounters similar challenges when reproducing a given visual landscape that is illuminated in uneven manners. Indeed, limitations such as a short dynamic range, external illumination, and shot noise typically lead to subpar results such as saturated regions or loss of contrast. To circumvent these challenges, techniques focused on dynamic range enhancement such as High Dynamic Range (HDR)7,8 or multiple exposure fusion9,10 are now well-established tools in photography, exploring acquisition at various conditions (namely exposure time) to maximize contrast and dynamic range. Given such success, one can argue that bridging these concepts to the subject of spectral imaging may present interesting opportunities to circumvent the specific limitations in a versatile manner.

The solution presented in this manuscript builds upon this vision, showcasing an unprecedented approach inspired by multi-exposure fusion techniques9,10 to spectral imaging. In particular, by extending a set of metrics related to the well-exposedness of RGB imaging to the subject of spectral imaging namely with LIBS and Raman techniques, we demonstrate that it is possible to establish a robust and agnostic approach that may be utilized in multiple imaging systems with minor adaptations. In specific, the metrics are utilized in the calculation of a global weight map, allowing the fusion of datasets with distinct yet relatable information to minimize the presence of over and under-exposed regions in the image. The results presented showcase the qualitative efficacy of our approach for both Raman and LIBS imaging. Furthermore, using a quantitative approach, we show that the tool is extremely helpful for feature extraction on classification problems, presenting a promising and versatile solution for advancing mineral identification across diverse spectral imaging systems.

Methodology

Spectral imaging is a versatile approach that may extend over various spectroscopic techniques. Combining spectral modalities with sample scanning schemes, revolutionized our ability to analyze samples by enabling the acquisition of spectra at multiple points across a sample, unlocking insights into its molecular and elemental compositions.

LIBS operates on the principle of analyzing discrete emission lines resulting from plasma decay induced by a laser. LIBS imaging involves scanning the sample surface in a point-wise manner and employing numerical algorithms for signal processing and analysis1,2. It boasts advantages such as the detection of multiple chemical elements in a wide concentration range, high sensitivity, spatial resolution, and versatility. However, at the application level, it may encounter challenges in distinguishing samples with similar elemental compositions as well as problems related to plasma uniformity.

Raman spectroscopy on its side, hinges on the detection of photons from an excitation laser that are inelastically scattered due to interactions with molecular vibrations. The spectrum obtained allows for the extraction of valuable chemical information regarding vibrational modes and molecular interactions, which can be related to given molecular signatures when compared against a database. Raman imaging, achieved through point-wise or line-scan surface scanning, facilitates a non-contact and non-destructive exploration of different molecular compositions with high spatial resolution11,12,13.

At the experimental level, LIBS and Raman spectroscopy encounter challenges that may eventually lead to a nonlinear response of the acquired signal, eventually degrading the quality of the produced images and risking observing final results that do not correspond to the analytical content of the sample. To be more specific, LIBS imaging encounters challenges such as continuum background, self-absorption, matrix effects, line interference, heterogeneity of the sample, and nonlinear response or saturation of the detector, just to mention the most common ones2,14. Regarding continuum background and self-absorption, a convenient choice of pre-processing tools (e.g. baseline removal2,15,16, mathematical corrections of self-absorption15,17,18,19,20) or hardware (e.g. controlled pressure or gas atmosphere, double-pulse configurations just to name a few examples3,21,22,23) is well known to mitigate these effects to some level. Besides, self-absorption can also be seen as beneficial to increase the dynamic range of the technique, as it may translate into a nonlinear dependency of the recorded emission signal as higher concentrations or larger plasma volumes are analyzed2. Focusing on matrix effects and heterogeneity, the challenge is often harder to deal, with calibration-free and plasma analysis approaches24,25,26, or context-based calibration curves27,28 offering the most promising solutions but being less explored in the context of LIBS imaging due to significant computational load. Finally, the nonlinear response and saturation of the detector may also degrade the visual information of LIBS-based images. Indeed, while nonlinearity may to some point be mitigated with proper calibration of the spectrometers, saturation on the detection side is far more challenging to deal with. Indeed, while some acquisition conditions (higher pulse energy, better collection hardware or more sensitive spectrometer) may be beneficial (e.g. to see elements present in ultra-low concentrations), it may often lead to the saturation of regions of the spectra featuring higher line intensities, degrading the image generated for these saturated wavelengths. Note also that this problem may be highly convoluted with others already discussed (e.g. continuum emission and line interference), as the raw detected intensity may be pushed by these effects to the nonlinear and less sensitive regime of the detector. Focusing on Raman Imaging methodologies, fluorescence is one of the most common obstacles29. While it is possible to optimize the wavelength of the excitation laser to minimize these effects, this is often not enough to guarantee the quality of the final signal. In this context, time-domain, frequency-domain, and computational techniques are commonly regarded as the most suitable alternatives. Time-domain methods typically use laser pulses to separate the two signals, building on the knowledge that fluorescence has a much longer lifetime compared to Raman scattering30,31. Some examples include Kerr gating and time-gated detectors, which can efficiently suppress fluorescence background while enhancing the Raman signal32,33. The efficiency of these methods has been proven but often require high-energy pulsed lasers, which can limit their application in real-world scenarios. On the other hand, frequency-domain methods modulate the excitation laser and may make use of the difference in response times between fluorescence and Raman emissions34. Additionally, computational methods like polynomial fitting, wavelet transforms, and derivatives are commonly used to subtract fluorescence after data acquisition, though they may introduce artifacts into the spectrum35,36,37.

Focusing on handling the trade-off between sub-optimal signal-to-noise ratios and saturation in high-intensity spectral regions, a promising solution may be to utilize a form of multi-exposure fusion of multiple datasets. In conceptual terms, the idea of multi-exposure is that the fusion of distinct data acquired at different exposures aims to minimize the impact of some limitations, reducing the presence of over and under-exposed regions in the final image.

Multi-exposure image fusion techniques can be divided into three main categories: spatial domain methods, transform domain methods, and deep learning methods. Spatial domain methods fuse images directly by analyzing features at the pixel or patch level and applying specific rules to generate weight maps. Although these methods can be efficient, they often require additional post-processing to minimize noise and avoid artifacts in the final fused image38,39. On the other hand, transform domain methods, as the name points at, start by transforming images into a different domain for fusion and then reconstructing them. The Laplacian pyramid technique is one of the most commonly used methods, where images are decomposed at multiple scales, fused at each level, and then reassembled. This approach is known for maintaining contrast and preserving details in both overexposed and underexposed regions40,41. Recently neural networks have been popularized to automatically learn fusion strategies from data, with both supervised42 and unsupervised approaches43 offering strong performance and adaptability for large datasets.

Taking inspiration from image processing methodologies9,10 and bridging to spectral imaging, the idea of a multiple exposure fusion approach may be achieved in a few ways:

  • Multiple acquisition conditions on the signal generation side: such as varying excitation laser power in Raman, or pulse energy in LIBS, which indirectly vary the intensity of scattered signal and plasma radiation generated, respectively.

  • Combination of distinct regions of spectrum containing similar information at distinct intensity levels: such as multiple bands of a mineral or multiple emission lines of the same element.

  • Multiple acquisition conditions on the detection side: such as distinct spectrometer conditions, such as gate delay and gate integration time.

For this work, we will concentrate on the first, which may be more relevant for the LIBS and Raman imaging cases (Fig. 1).

Fig. 1
figure 1

Overview of the workflow described in this manuscript. Starting from a sample with a given variable composition (here the mineralogical composition), we acquire multiple spectral imaging datasets with variable parameters. Then, the multi-condition fusion is applied after computing the necessary metrics, and the final result is evaluated using quantitative and qualitative metrics.

Multiple acquisition fusion for spectral imaging

The novel method proposed in this manuscript consists of a streamlined acquisition and processing pipeline to fuse spectral datasets to enhance spectral imaging quality, inspired by dynamic range enhancement techniques of machine vision. For this, we implement a two-part algorithm, as illustrated in Fig. 2.

Fig. 2
figure 2

Pipeline developed for the pre-processing and analysis of the spectral data.

Step 1: pre-processing

The raw signals of a spectral imaging dataset often contain unspecific information that is not correlated with the variable we are trying to measure (eg. chemical element distribution). For example, typical LIBS spectra include not only elemental emission lines (discrete components) but also background resulting from Bremsstrahlung and recombination processes (continuous components). Another example occurs in Raman spectroscopy, for which the acquired spectrum frequently contains a continuous fluorescence component that is unrelated to the molecular structure of the sample itself but that may conceal specific information about the molecular bands. This way, the pre-processing of the signals to remove this contribution is a step of major importance. As both are present in the form of a background baseline, we first use the Asymmetric Least Squares Smoothing algorithm to remove it from each of the obtained spectra44. Subsequently, all points in the acquired spectra are normalized to the sum, and a spatial Gaussian filter is applied. This allows to increase the SNR by reducing saturation effects and smoothing out some of the noise introduced due to point-to-point variability.

Step 2: multiple acquisition fusion

For each of the samples, we acquired signals over \(N_C\) different conditions (e.g., varying pulse energy, laser power), originating in a final dataset which, for each wavelength, we have \(N_C\) spectral images at different acquisition conditions. Our goal is to fuse these datasets into a single image, with improved dynamic range.

To effectively merge these \(N_C\) images into a single one for dynamic range optimization, we start by computing weight maps (\(\varvec{W^m}\)), as inspired by a multi-exposure methodology9. For this, we use an adaptation of the well-exposedness metric (\(m=1\)), whose main goal is to prioritize intensities that are not close to zero (under-exposed intensities) or close to one (over-exposed). Using a Gaussian curve (\(\sigma = 0.2\)), each pixel intensity (\(I_{ij,k}\)) is weighted by a factor that depends on its distance to a target mean intensity of 0.5.

$$\begin{aligned} {\varvec{W}}_{ij,k}^{m=1}=\exp \left( -\frac{(I_{ij,k}-0.5)^2}{2\sigma ^2} \right) \end{aligned}$$
(1)

Where the indices ijk, refer to pixel (ij) of the k parameter.

Adding to well-exposedness, we can also use the absolute value of a Laplacian filter (Eq. 2) applied to each map as a measure of local contrast (\(m=2\)), which assigns higher values to pixels with defined edges and textures.

$$\begin{aligned} {\varvec{W}}_{ij,k}^{m=2}=\nabla ^2 I_{ij,k} \end{aligned}$$
(2)

Where the Laplacian filter is approximated using finite differences through the convolution with a kernel

$$\begin{aligned} K = \begin{bmatrix} 0 & 1 & 0 \\ 1 & -4 & 1 \\ 0 & 1 & 0 \end{bmatrix} \end{aligned}$$
(3)

In order to merge both metrics, the final weights are then computed as a product, with the influence of each metric being controlled using multiplicative factors, respectively, as follows:

$$\begin{aligned} {\varvec{W}}_{ij,k} = \prod _{m} \omega _{m} ({\varvec{W}}_{ij,k}^{m}). \end{aligned}$$
(4)

with \(\omega _{M}\) a factor that represents the weight attributed to each metric. In our case, we decided on \(\omega _{M}=1\), but it can be further optimized according to the problem and spectral imaging technique. After combining the metrics, each final weight map is normalized over the \(N_C\) acquisition conditions (in our case \(N_C=3\)) in accordance to

$$\begin{aligned} {\varvec{W}}_{ij,k} = \frac{{\varvec{W}}_{ij,k}}{\sum _{k'=1}^{N_C}{\varvec{W}}_{ij,k^{'}}}. \end{aligned}$$
(5)

After computing the weights for each pixel and for each image, the multi-condition fusion explores a pyramidal algorithm scheme41 to preserve most of the details at various distinct scales. In essence, each layer of each pyramid contains band-pass filtered versions of the images at different spatial scales, which allow the capture of different spatial frequency details. We will construct two pyramids per acquisition condition k: a Gaussian Pyramid for the weights and a Laplacian pyramid for the input images.

On one hand, for the construction of the Gaussian pyramid for the weights, each l-th layer \(G^{l}(W_{ij,k})\) is obtained via the consecutive applications of the reducing function Reduce(.) - corresponding to the convolution with a binomial filter45 followed by downsampling operation - to the previous layer.

On the other hand, the Laplacian Pyramid for the input image is also constructed layer-by-layer \(L^l\) but using the difference between consecutive layers of G for each input image \(I_k\):

$$\begin{aligned} L^l(I_{ij,k}) = G^{l}(I_{ij,k}) - Expand(G^{l+1}(I_{ij,k})). \end{aligned}$$
(6)

where Expand(.) stands for the expanding operation, obtained via upsampling followed by convolution with a binomial filter45.

Having constructed the two pyramids, we can blend them into a final pyramid \(P^l\) by summing across all acquisition conditions k as

$$\begin{aligned} P_{ij}^{l} = \sum _{k = 1}^{N_C} G^{l}(W_{ij,k}) L^{l} (I_{ij,k}). \end{aligned}$$
(7)

Finally, the multi-condition fusion image \(I^{'}\) is obtained through the collapse of the pyramid, which is obtained according to an iterative methodology:

  • Starting with the top-most level \(P^{l_{\text {max}}}\):

    $$\begin{aligned} F^{l_{\text {max}}}_{ij} = P_{ij}^{l_{\text {max}}} \quad \text {for } l = l_{\text {max}} \end{aligned}$$
  • For each subsequent level \(l\), the current reconstructed image (\(RI\)) is upscaled and then added to the next level of the pyramid \(P^{l-1}\):

    $$\begin{aligned} F^{l-1}_{ij} = Expand(F^{l}_{ij}) + P_{ij}^{l-1}\quad \text {for } l = l_{\text {max}} - 1, \ldots , 0 \end{aligned}$$

To facilitate the comprehension of the method, an illustrated overview of this pipeline is represented in Fig. 3, which uses a multi-condition LIBS imaging dataset as an example.

Fig. 3
figure 3

Illustrative example of the Multi-Condition Fusion pipeline. Starting with N maps acquired at different acquisition conditions, these serve as the input for two different steps. First, a Laplacian Pyramid based on each spectral map is built. Then, weight maps for each image are calculated, using the well-exposedness and contrast metrics, and a Gaussian Pyramid based on the weight maps is constructed. Finally, all pyramids are combined into a single one. The collapse of the final pyramid results in the final multi-condition image.

Performance evaluation metrics

While we are expecting increases in the visual quality of the resulting images when applying the multi-condition image fusion algorithm, it is still important to establish some metrics in order to evaluate and benchmark properly its advantages. For this, we will support our analysis with quantitative and qualitative metrics.

Quantitative metrics

To evaluate the quality of the final multi-condition fused maps we decided on the use of two metrics: (i) the Peak Signal-to-Noise Ratio (PSNR), and (ii) the contrast.

The Peak Signal-to-Noise Ratio is defined as the ratio between the maximum possible power of a signal and the power of corrupting noise as

$$\begin{aligned} PSNR = 20\log _{10} \left( \frac{MAX_I}{\sqrt{MSE}} \right) \end{aligned}$$
(8)

where MSE stands for the mean-squared error of the measurement and is given by \(MSE = \frac{1}{mn}\sum _i^{m-1} \sum _j^{n-1} (T_{ij}-I_{ij})^2\) where \(T_{ij}\) would be the pixel′s true value. For practical purposes, in our case the maximum possible power for the spectral maps (\(MAX_I\)) corresponds to a pixel value of 1. Regarding the calculation of the MSE, we considered an image region that should not contain any signal (i.e. \(T_{ij}=0\) only background noise) thus being computed as the mean pixel value in the image regions containing only the background signal. A higher PSNR indicates that the signal has less noise relative to its maximum possible value, which implies better quality in the spectral maps.

For the contrast, we use the sum of the absolute value of a Laplacian filter applied to the interest maps. A second-order derivative filter - the Laplacian filter - highlights edges or areas of abrupt intensity changes in an image. For each map, by summing the absolute values of the Laplacian filter as

$$\begin{aligned} {\varvec{C}}=\sum _{ij}\nabla ^2 x_{ij,k} \end{aligned}$$
(9)

, we measure the maps’ overall contrast (C) or the sharpness and clarity of features. Higher contrast values indicate stronger and more distinct transitions between different regions or features, corresponding to better image detail and structure.

Qualitative metrics using a sample classification problem

Besides the increase in quality of the images for visualization purposes, the enhanced imaging dataset of maps can also be used to increase the performance of spectral imaging in final applications such as sample analysis or common sample classification6,46,47,48. To illustrate and benchmark this possibility, we will explore the impact of this approach in a case study concerning minerals’ identification.

Following previously explored strategies1,6, a processing pipeline for automatic mineral identification was implemented in Python using standard processing and machine learning libraries, namely SciPy49 and scikit-learn50. This pipeline can be used for both Raman and Laser-Induced Breakdown spectroscopy and is outlined in Fig. 2. The pipeline starts by first extracting the most relevant features from both the Raman and LIBS data by manually selecting the spectral regions of interest, according to the samples and known databases. This results in a reduction of the total hyperspectral cubes from \(N_x \times N_y \times N_\lambda\) into smaller datasets of dimension \(N_x \times N_y \times N_{bands}\) and \(N_x \times N_y \times (N_{lines})\) for Raman and LIBS, respectively. Furthermore, to avoid bias by feature range, we apply a min-max scaling to each feature.

The subsequent phase involves training a data-driven model for mineral-type discrimination utilizing the reduced datasets. We employed an unsupervised approach using a k-means clustering model from the scikit-learn library50. To determine the optimal number of clusters \(N_c\), we applied the empirical elbow method1 alongside a direct comparison to the number of mineral types we aim to identify. This unsupervised clustering technique labels each pixel in the dataset into one of the \(N_c\) clusters for each sample. By training the algorithm on one or more samples, the positions of the \(N_c\) centroids are iteratively updated until convergence, with clusters assigned based on their proximity to the centroids. Finally, the centroids may be related to the mineral type by analyzing the relevant extracted features (i.e. relevant elements or bands).

Experimental setups

The spectral data was collected utilizing custom-built Raman and Laser-Induced Breakdown Spectroscopy systems. The LIBS imaging setup consists of a Quantel CFR 200 Q-Switched Nd:YAG laser operating around 1064 nm, with a pulse duration of 8 ns and a maximum pulse energy of 211 mJ operating at 20 Hz. The laser pulses are focused onto the sample surface (spot size \({300}\,\,{\upmu }\hbox {m}\)) using a plano-convex lens with a focal distance of 200 mm. An 8-channel CCD spectrometer (Avantes) is used to acquire the spectra, with a wavelength detection range of 180 - 920 nm. The spectrometer gate delay was fixed at \(1.3{1}\,\,{\upmu }\hbox {s}\), and the integration time was fixed at 1.05 ms. For each channel, an optical fiber and lens collimator are used to collect the emitted light. We use two motorized sample stages, that allow for position control in the transverse plane, as well as a z-axis manual control to move the sample within the focal depth of our system (roughly 13 mm), before the acquisition. The system components are controlled with the help of a computer and firmware and software libraries developed in-house and synchronized utilizing a digital delay generator.

On the other hand, the Raman imaging system makes use of a coherent SureLock BT-785 excitation laser diode with a central wavelength of 785 nm and a maximum output power of 400 mW. At each scanning point, spectra were acquired using a Raman spectrometer (Wasatch Photonics WP 785 ER), which has a spectral range of 270-3350 \(\hbox {cm}^{-1}\) and a typical spectral resolution of 8 \(\hbox {cm}^{-1}\). Data was collected from every point with an integration time of 200 ms, without averaging. The laser and spectrometer were fiber-coupled to a Raman probe tip (Ballprobe RP 785 from Wasatch Photonics) with a spot size of \({200}\,\,{\upmu }\hbox {m}\). The probe was positioned at the focal distance from the sample (approximately 5 cm).

Results and discussion

Sample description

To better understand the capabilities of the algorithm we selected a challenging case study of a rock sample with multiple types of lithium-bearing minerals below the millimeter range. To improve measurement quality, the samples were prepared with a planar cross-section. However, no polishing method was used, thus porosity and roughness may still induce variations in the signals.

The mineralogical composition of the sample in which we performed Raman and LIBS Spectroscopy includes petalite, spodumene, albite, and quartz (see Fig. 1), with typical chemical formulas given in Table 1. As Petalite and Spodumene have similar chemical composition, the case study from the mineral classification perspective is challenging when utilizing the LIBS technique, but may be easily approached with Raman spectroscopy. In specific, for the classification algorithm, the most intense bands of the Raman spectra were located based on the RRUF mineral database for 785 nm of excitation wavelength and utilized as features for the classification model (Table 1, with resulting images and typical spectrum in the supplementary material). Similarly, for LIBS technique, we selected one spectral line for each relevant chemical element (Table 1, with resulting images and typical spectrum in the supplementary material). The intensities recorded are registered as the extracted features for each pixel. In this specific case, we focused on lines that typically experience saturation, to further evaluate the capabilities of our new methodology in dealing with this class of challenges. Special care was taken to select spectral regions that minimized interference with other elements or bands.

Table 1 Detailed information about the four most relevant minerals observed in the sample.

Raman imaging

For the Raman Imaging dataset, a step size of 0.4 mm was chosen to scan a total area of 27 mm \(\times\) 25 mm. In particular, for the multiple excitation power dataset, we used three different incident laser power of 120 mW, 160 mW and 240 mW.

In Fig. 4, we can see examples of the maps for the Raman bands of one of the main minerals present in our sample (petalite, as identified in Table 1) compared side by side the results for different acquisition conditions and the results from the fusion algorithm. For simplicity reasons, we chose to present the maps for only one mineral in the main manuscript, but the remaining maps can be found in the supplemental material.

Fig. 4
figure 4

Raman Imaging maps obtained for a Petalite-related scattering band (490 \(\hbox {cm}^{-1}\)) and for the three different exposures (from left to right). The final multi-condition fusion result is also presented.

To qualitatively explore the advantages of performing multi-condition fusion, we start by analyzing the individual datasets. First, regarding noise, we observe that for individual acquisition conditions, the power 240 mW leads to better qualitative results. Yet, it comes accompanied by some saturation in the zones where the petalite is present, which strongly affects contrast. This is confirmed by the quantitative metrics presented in Fig. 5: the 240 mW dataset features slightly improved PSNR but lower contrast when compared against the other acquisition conditions.

Fig. 5
figure 5

Contrast and Peak Signal-to-Noise Ratio of the maps corresponding to the main Raman emission bands.

Then, analyzing the images from the fusion algorithm, we qualitatively see that while the background noise level is minimized, the contrast stays high as there are no saturated zones. Besides, all the details seem to be preserved, with the spatial filtering also helping the enhancement of the image quality. The quantitative metrics confirm the qualitative analysis: for all 4 main Raman emission bands, we verify that the multi-condition procedure results in maps with higher PSNR and contrast, in agreement with our previously described expectations.

Another interesting finding in this dataset is how it may allow to tackle the detrimental effect of saturation due to fluorescence as illustrated in Fig. 6. Indeed, due to the sample characteristics, there is a region of strong fluorescence that saturates the detector along the right edge of the sample. After baseline removal, the saturated region becomes dark in the final spectral map, as observed in the figure. Yet, for lower excitation power (120mW) the highlighted region in the inset is not saturated and allows the observation of details that are hidden in the higher-power images. Our methodology allows the fused map to preserve these small details, while clearly improving the signal-to-noise ratio of the lower excitation power image.

Fig. 6
figure 6

Example of the Raman dataset showing saturation due to fluorescence. Raman maps for the 509 \(\hbox {cm}^{-1}\) band, acquired at different laser powers after processing, and the final multi-condition fusion map. (right) Spectra for the point highlighted in the spectral maps for the different energies prior to the baseline removal. Note that baseline removal leads to the appearance of dark regions on the saturated points of the spectral image.

LIBS imaging

Following the promising results from the Raman Imaging dataset, we proceed with our analysis by exploring the general capabilities and agnostic characteristics of our fusion algorithm, studying the application of the multi-condition fusion approach on a LIBS imaging dataset.

For the case of LIBS, we used as the variable parameter for multiple acquisition conditions the pulse energy. In specific, the laser pulse energy was set to approximately 26 mJ, 38 mJ, and 51 mJ, which from previous experiments we knew to result in saturation of some emission lines but also gains in the detection of others of lower relative intensity. For the same sample as before, we scanned a region of 27 mm \(\times\) 25 mm using a step size of 0.25 mm.

The example presented in Fig. 7 shows the comparison between the spectral maps obtained at individual conditions against the one derived from the multi-condition procedure. Once again, the single acquisition condition images reveal the appearance of saturation effects with the increase of the pulse energy, which translates into a loss of contrast as revealed in the metrics presented in Fig. 8. Yet, in contrast to the Raman Imaging case, the PSNR may also decrease in this case, as the intensity signal may be affected by non-specific variations such as background signals, interference with other emission lines, or even the detection of chemical residues in regions outside the sample. Still, even in this case, our multi-condition algorithm can perform properly, significantly enhancing contrast for most of the cases while warranting a high PSNR, which not only validates the agnostic character of the algorithm in relation to the spectroscopy technique utilized but also illustrates its adaptability to variable situations.

Fig. 7
figure 7

LIBS maps for the 819.40 nm Sodium emission line in the sample, for the three different energies, and for the final fused dataset for our sample. For the maps corresponding to other significant emission lines, refer to the supplemental material.

Fig. 8
figure 8

Contrast and Peak Signal-to-Noise Ratio of the maps corresponding to the main LIBS emission lines. Supplementary material includes further results of the same metrics for a complete set of three wavelengths for each relevant chemical element.

Analyzing the specific case of saturation, Fig. 9 depicts LIBS maps for Lithium 670.76 nm emission line that shows clear detector saturation in the higher pulse energy case (see pixel intensity histogram in Fig. 9). Since the maximum value of counts allowed by the spectrometer is around 16k and the chosen Lithium emission line presents various pixels over 14k counts, it enters the region where the response of the detector is no longer strictly linear, has lower sensitivity, and may sometimes even reach its limit. This can be easily noted not only by visual analysis of the resulting spectral image but also by looking at the histogram of the pixel values of the generated image. Again, the multi-condition fusion approach allows to tackle these variations in an agnostic manner, resulting in images with better pixel intensity distribution and allowing better visual perception of the details.

Fig. 9
figure 9

Examples of the Laser-Induced Breakdown spectroscopy dataset showing saturated emission lines. LIBS maps of Lithium (left), acquired at different laser pulse energies (before processing), along with the resulting Multi-Condition Map. We also present the emission spectra (top right), showing a saturated peak at 670.76 nm., as observed in the histogram distributions of pixel intensity.

The LIBS dataset also allows us to benchmark additional advantages of the multi-condition fusion approach beyond the visualization purposes and closer to the final application. In particular, and as detailed in the methodology, we will analyze its impact on sample classification, one of the common applications of spectral imaging. In particular, for the present case study, the goal is to identify the mineral types based on the spatial-spectral signals, for which we followed the methodology implemented in refs.6.

As previously discussed, the case study is quite challenging from the perspective of LIBS as it presents minerals features with similar chemical compositions and some emission lines (in particular lithium ones) commonly saturate. Together, this hinders the linearity of the relation between signal and concentration, which may affect the capabilities of a clustering algorithm to properly separate clusters for spodumene and petalite6. This is not the case for Raman spectroscopy, as clear spodumene and petalite bands can be obtained, which allows us to establish the multi-condition fusion Raman-based classification as a Ground Truth to benchmark the performance of the LIBS classifiers.

Our expectations are validated in the results present in Fig. 10, with the single condition datasets failing to conveniently locate the presence of certain spodumene and petalite regions as a consequence of signal saturation. In contrast, the multi-condition fusion method can enhance the generated spectral maps to the point where there is now a clear distinction between the spodumene and petalite regions. This enhancement is even clearer in the confusion matrices computed for this analysis, which can be found in Figure 10. As inferred from the direct observation of the clustering maps, we can confirm that the multi-condition fusion dataset performs significantly better for the detection of petalite and spodumene, with overall accuracy increasing for all mineral types.

Fig. 10
figure 10

Clustering results for the individual LIBS classifications, as well as for the multi-condition approach for both LIBS and Raman spectroscopy.

Discussion and concluding remarks

The main goal of this manuscript is to introduce a robust pipeline for integrating multi-condition image fusion techniques into the spectral imaging research domain for qualitative and quantitative enhancements both at visualization and final application levels. Inspired by multi-exposure and high-dynamic range methods applied to RGB imaging, the idea is to utilize distinct acquisition conditions on the excitation side to increase the dynamic range of the resulting images without losing details due to noise and saturation.

As far as we are aware, no research has been done in the literature that looks at how HDR principles and approaches can be extended to enhance the quality of spectral images using methods like LIBS and Raman. The method implemented and described in the methodology section is inspired by multi-exposure fusion9,10, utilizing weights based on relevant metrics - such as well-exposedness and contrast - followed by a pyramidal scheme to merge multiple images into a final one. The adaptation of this technique to spectral imaging requires a carefully designed pre-processing strategy in order to address under and over-exposure regions and problems induced by non-specific signals.

To evaluate and prove the capability to apply the method to any spectral imaging technique in an agnostic manner, we have focused on a challenging case study involving mineral samples analyzed with two distinct techniques, Raman and LIBS imaging. Overall, both through qualitative analysis and quantitative metrics, we verified that the multi-condition fusion presents improved visualizations with higher contrast and typically higher peak signal-to-noise ratio. In specific, and upon closer inspection, we may conclude that it allows to circumvent the typical tradeoff between saturation and signal-to-noise-ratio. On one hand, for Raman spectroscopy, the saturation observed for higher excitation laser powers when compared with lower ones was mitigated, allowing to increase image contrast and revealing regions of high and low-intensity signals within the same image. For LIBS, the benefits were similar, with the increase of contrast and preservation without increasing the background noise due to non-specific variations of the technique occurring for higher pulse energies. Quantitative metrics, including Peak Signal-to-Noise Ratio (PSNR) and contrast analysis, corroborate the qualitative observations: in both cases, the multi-condition fusion approach consistently produced maps with higher contrast compared to individual datasets, validating its efficacy in enhancing spectral data quality.

All these findings align with the initial objective of this manuscript and the typical capabilities of a multi-exposure RGB approach, i.e. increasing the signal-to-noise ratio in under-exposed areas while avoiding the saturation of over-exposed regions. Besides, establishing a parallel to photography, it is plausible to expect that multi-condition fusion may not only present an opportunity to increase the dynamic range of spectral imaging techniques but also may allow to preserve its linearity over larger ranges (e.g. concentration of elements in LIBS). Indeed, the results obtained in the improvement at the application level for a mineral classification task align with this hypothesis. Using the same relevant element lines and with the same number of features (i.e. without using multiple datasets), we are able to increase the mineral classification performance for two minerals with similar chemical composition. At the algorithm level, this means that a reliable classification was achieved at the semi-quantitative rather than at the qualitative level (i.e. presence/absence of a given element).

Finally, and putting into a broader perspective, this work demonstrates that the integration of multi-exposure fusion strategies into spectral imaging techniques may present significant advances not only for visualization purposes but also for final applications where regions of both saturation and low signal-to-noise ratio appear simultaneously. The comprehensive range of the results presents evidence to support these claims and pave the way for more reliable spectral imaging methodologies capable of driving future improvements for research and industrial applications, not limited to Raman and LIBS spectroscopy but applicable to any spectroscopy technique. Regarding future work, two major directions emerge. On the one hand, it may be interesting to explore new metrics tailored for specific problems (e.g., line and band interference, fluorescence) in order to mitigate specific issues arising in the context of spectral imaging. On the other hand, while we explore the merge of multiple conditions, this approach may not be ideal for certain applications due to the increased time required for signal acquisition. In that context, multi-line or multi-band fusion may also lead to relevant enhancements in the quality of the generated images.